<?php 

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

/**
 * Class UsersRolesMigration_146
 */
class UsersRolesMigration_146 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.users_roles(user_id, role_id) 
				(select distinct A.um_id, 1 from public.um_user A
					left join jaga.users_roles B ON A.um_id = B.user_id
					where user_id is null);
			'
		);
    }

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

    }

}
