<?php

use Phalcon\Mvc\Model\Migration;

class PancekFormulirLogMigration_568 extends Migration
{
    public function up()
    {
        self::$connection->execute("
            CREATE TABLE IF NOT EXISTS jaga.pancek_formulir_log (
                id bigserial not null primary key,
                formulir_id integer not null,
                instansi_id integer not null,
                user_id integer not null,
                description character varying(255) not null,
                state_after text,
                created_at timestamp without time zone DEFAULT now(),
                deleted_at timestamp without time zone
            );
        ");
        self::$connection->execute("
            CREATE TABLE IF NOT EXISTS jaga.pancek_answer_log (
                id bigserial not null primary key,
                instansi_id integer not null,
                formulir_id integer not null,
                answer_id integer not null,
                user_id integer not null,
                description character varying(255) not null,
                state_after text,
                created_at timestamp without time zone DEFAULT now()
            );
        ");
    }

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