<?php

use \Phalcon\Mvc\Model\Migration;

class GratifikasiPetaKerawananMigration_576 extends Migration
{
    public function up() {
        self::$connection->execute("
            DROP TABLE IF EXISTS jaga.gratifikasi_peta_kerawanan;
            CREATE TABLE IF NOT EXISTS jaga.gratifikasi_peta_kerawanan (
                id serial not null,
                num integer not null,
                sektor character varying(50) not null,
                sub_sektor character varying(100) not null,
                kegiatan character varying(255) not null,
                penjelasan_kegiatan text,
                penanggung_jawab character varying(255),
                potensi_gratifikasi character varying(255) not null,
                tingkat_risiko character varying(30) not null,
                created_at timestamp without time zone NOT NULL DEFAULT now(),
                updated_at timestamp without time zone,
                deleted_at timestamp without time zone
            );
        ");

        $sql = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'insert_gratifikasi_peta_kerawanan.sql');
        self::$connection->execute($sql);
    }

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