<?php

use Phalcon\Mvc\Model\Migration;

class AlterOmspanPaguMigration_523 extends Migration {
    public function up()
    {
        self::$connection->execute("ALTER TABLE jaga.omspan_dana_desa_pagu ADD COLUMN IF NOT EXISTS pagu_tambahan integer;");
        self::$connection->execute("ALTER TABLE jaga.omspan_dana_desa_pagu ADD COLUMN IF NOT EXISTS kecamatan character varying(255);");
        self::$connection->execute("DELETE FROM jaga.omspan_dana_desa_pagu WHERE tahun = 2023 AND updated_at IS NULL");
    }

    public function down()
    {
        self::$connection->execute("ALTER TABLE jaga.omspan_dana_desa_pagu DROP COLUMN IF EXISTS pagu_tambahan;");
        self::$connection->execute("ALTER TABLE jaga.omspan_dana_desa_pagu DROP COLUMN IF EXISTS kecamatan;");
    }
}
