<?php
use Phalcon\Mvc\Model\Migration;

class CreateMcpPenaltyScoreAndAttachmentMigration_540 extends Migration {
    public function up()
    {
        self::$connection->execute('
            CREATE TABLE IF NOT EXISTS "jaga"."korsupgah_mcp_penalty_score" (
                id SERIAL PRIMARY KEY,
                id_instansi INTEGER,
                name VARCHAR(100),
                id_template INTEGER,
                year INTEGER,
                score INTEGER,
                description TEXT,
                created_by INTEGER,
                created_at TIMESTAMP(6) DEFAULT NOW(),
                updated_by INTEGER,
                updated_at TIMESTAMP(6),
                deleted_by INTEGER,
                deleted_at TIMESTAMP(6)
            );
        ');

        self::$connection->execute('
            CREATE TABLE IF NOT EXISTS "jaga"."korsupgah_mcp_penalty_score_attachment"(
                id SERIAL PRIMARY KEY,
                id_template INTEGER,
                id_attachment INTEGER,
                created_by INTEGER,
                created_at TIMESTAMP(6) DEFAULT NOW(),
                updated_by INTEGER,
                updated_at TIMESTAMP(6),
                deleted_by INTEGER,
                deleted_at TIMESTAMP(6)
            );
        ');
    }

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

        self::$connection->execute("
            DROP TABLE IF EXISTS jaga.korsupgah_mcp_penalty_score_attachment;
        ");
    
    }
    
}
