package jp.agentec.abook.abv.bl.data.tables;

import java.util.ArrayList;
import java.util.List;

import jp.agentec.abook.abv.bl.common.db.SQLiteDatabase;

/**
 * Created by leej on 2018/08/17.
 */

public class ROperationContent extends SQLiteTableScript {

    public ROperationContent() {
        super();
    }

    @Override
    public List<String> getCreateScript(int version) {
        List<String> ddl = new ArrayList<String>();
        StringBuffer sql = new StringBuffer();

        sql.append(" CREATE TABLE r_operation_content ( ");
        sql.append("        operation_id BIGINT NOT NULL ");
        sql.append("      , content_id BIGINT NOT NULL ");
        sql.append("      , operation_content_flg BOOLEAN NOT NULL DEFAULT 0 ");
        sql.append("      , PRIMARY KEY (operation_id, content_id)      ");
        sql.append("      , FOREIGN KEY (operation_id) REFERENCES t_operation (operation_id) ");
        sql.append("      , FOREIGN KEY (content_id) REFERENCES t_content (content_id)");
        sql.append(" ) ");

        ddl.add(sql.toString());

        return ddl;
    }

    @Override
    public List<String> getUpgradeScript(int oldVersion, int newVersion) {
        return null;
    }

    @Override
    public List<String> getMigrationScript(SQLiteDatabase databaseConnection, int oldVersion, int newVersion, Object... params) {
        return null;
    }
}
