<?php

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

/**
 * Class DiskusiObjekMigration_131
 */
class DiskusiObjekMigration_131 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_objek(diskusi_id, objek_id, nama_objek)
				(
					select (select id from jaga.diskusi where uuid=A.id), (select npsn from jaga.sekolah where id=A.objek_id), coalesce((select nama from jaga.sekolah where id=A.objek_id), \'-\')
					from jaga.cerita A where produk_id = \'0fd356ad-5b4e-4f77-b7b4-f964be3731a3\' and objek_id is not null
				);
			'
    );
  }

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