<?php

use Phalcon\Mvc\Model\Migration;

/**
 * Class RolesMigration_211
 */
class StranasFokusMigration_159 extends Migration
{
    public function up()
    {
        self::$connection->execute('
        CREATE TABLE jaga.stranas_fokus (
            id serial PRIMARY KEY,
            kode varchar(10),
            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('stranas_fokus', [
            'id',
            'nama'
        ]);

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

    public function down()
    {
        self::$connection->execute("
            DROP TABLE IF EXISTS jaga.stranas_fokus;
        ");
    }
}
