<?php

use Phalcon\Mvc\Model\Migration;

class KorsupgahTargetMigration_176 extends Migration
{
    public function up()
    {
        self::$connection->execute("
        CREATE TABLE jaga.korsupgah_target (
            id serial PRIMARY KEY,
            id_sub_indikator INT NOT NULL,
            nama VARCHAR(255),
            info_nilai TEXT,
            info_lampiran 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_target', [
            'id',
            'id_sub_indikator',
            'nama'
        ]);

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

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