<?php

use yii\db\Migration;

class m170523_070338_job extends Migration
{
    public function up()
    {
        /* 取消外键约束 */
        $this->execute('SET foreign_key_checks = 0');
        
        /* 创建表 */
        $this->createTable('{{%job}}', [
            'id' => 'int(10) unsigned NOT NULL AUTO_INCREMENT',
            'uid' => 'int(10) unsigned NOT NULL',
            'author' => 'varchar(30) NOT NULL',
            'name' => 'varchar(30) NOT NULL',
            'district' => 'varchar(30) NOT NULL',
            'wage' => 'varchar(30) NOT NULL',
            'amount' => 'int(10) unsigned NOT NULL',
            'days' => 'int(10) unsigned NOT NULL',
            'content' => 'text NOT NULL',
            'addtime' => 'int(10) unsigned NOT NULL',
            'display' => 'tinyint(1) 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('{{%job}}');
        $this->execute('SET foreign_key_checks = 1;');
    }
}

