<?php

use yii\db\Migration;

class m170523_070338_custom_service extends Migration
{
    public function up()
    {
        /* 取消外键约束 */
        $this->execute('SET foreign_key_checks = 0');
        
        /* 创建表 */
        $this->createTable('{{%custom_service}}', [
            'id' => 'int(10) unsigned NOT NULL AUTO_INCREMENT',
            'value' => 'varchar(30) NOT NULL',
            'type' => 'varchar(30) NOT NULL',
            'ordid' => 'int(10) unsigned NOT NULL',
            'PRIMARY KEY (`id`)'
        ], "ENGINE=MyISAM  DEFAULT CHARSET=utf8");
        
        /* 索引设置 */
        
        
        /* 表数据 */
        
        /* 设置外键约束 */
        $this->execute('SET foreign_key_checks = 1;');
    }

    public function down()
    {
        $this->execute('SET foreign_key_checks = 0');
        /* 删除表 */
        $this->dropTable('{{%custom_service}}');
        $this->execute('SET foreign_key_checks = 1;');
    }
}

