<?php

use Phalcon\Mvc\Model\Migration;

class AddColumnStranasTargetMigration_241 extends Migration
{
     /**
     * Define the table structure
     *
     * @return void
     */
    public function morph()
    {
        
    }

    /**
     * Run the migrations
     *
     * @return void
     */
    public function up()
    {
    self::$connection->execute('
        -- add column subaksi
	    alter table jaga.stranas_target add column id_subaksi int;

        -- fill the value 
        update jaga.stranas_target as a
            set id_subaksi = b.id_subaksi 
            from jaga.stranas_ukuran_keberhasilan as b
            where a.id_ukuran_keberhasilan = b.id;
    ');
    }

    /**
     * Reverse the migrations
     *
     * @return void
     */
    public function down()
    {

    }
}

