<?php 

use Phalcon\Db\Column;
use Phalcon\Db\Index;
use Phalcon\Db\Reference;
use Phalcon\Mvc\Model\Migration;

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

    /**
     * Run the migrations
     *
     * @return void
     */
    public function up()
    {
		self::$connection->execute(
			'
				insert into jaga.diskusi(title, content, user_id, kategori_diskusi_id, created_at, updated_at, uuid)
				(select \'Masukan\', isi, coalesce((select um_id from public.um_user where uuid_user=A.user_id), 1), 
				case 
				  when A.produk_id = \'0fd356ad-5b4e-4f77-b7b4-f964be3731a3\' then 4
				  when A.produk_id = \'1ae17fec-0caa-4c85-8eaf-2f90a4a60621\' then 7
				  when A.produk_id = \'56bc47a1-a4ee-4c92-955d-ff2309da06f4\' then 5
				  when A.produk_id = \'6764c74d-c742-4740-b36b-e6a60f153436\' then 5
				  when A.produk_id = \'970e52f0-8658-4d96-bd47-c38d23d74b6f\' then 5
				  when A.produk_id = \'c9e0d05e-39a1-469f-b48b-b320736c1813\' then 6
				  when A.produk_id = \'fa1b6d02-4e1b-4be6-8f25-55f6a4731b86\' then 6
				  else 5
				end
				,created, last_update,id from jaga.masukan A );
			');
    }

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

    }

}
