<?php

use Phalcon\Mvc\Model\Migration;

class KorsupgahSubIndikatorMigration_176 extends Migration
{
    public function up()
    {
        self::$connection->execute("
        CREATE TABLE jaga.korsupgah_sub_indikator (
            id serial PRIMARY KEY,
            id_indikator INT NOT NULL,
            nama VARCHAR(255),
            keterangan TEXT,
            created_at timestamp(6) DEFAULT now(),
            updated_at timestamp(6) DEFAULT now(),
            deleted_at timestamp(6),
            created_by int,
            updated_by int
        )");

        $this->batchInsert('korsupgah_sub_indikator', [
            'id',
            'id_indikator',
            'nama'
        ]);

        self::$connection->execute("SELECT setval('korsupgah_sub_indikator_id_seq', (SELECT MAX(id) FROM jaga.korsupgah_sub_indikator));");
    }

    public function down()
    {
        self::$connection->execute("
            DROP TABLE korsupgah_sub_indikator
        ");
    }
}
