<?php

use Phalcon\Mvc\Model\Migration;

class KorsupgahPeriodeMigration_176 extends Migration
{
    public function up()
    {
        self::$connection->execute("
           CREATE TABLE jaga.korsupgah_periode (
                id serial PRIMARY KEY,
                nama VARCHAR (255),
                keterangan TEXT,
                started_at timestamp(6) NOT NULL,
                ended_at timestamp(6) NOT NULL,
                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_periode', [
            'id',
            'nama',
            'started_at',
            'ended_at'
        ]);

        self::$connection->execute("SELECT setval('korsupgah_periode_id_seq', (SELECT MAX(id) FROM jaga.korsupgah_periode));");
    }
    public function down()
    {
        self::$connection->execute("
            DROP TABLE korsupgah_periode
        ");
    }
}
