<?php

use yii\db\Migration;

/**
 * Class m191112_022131_create_table_file
 */
class m191112_022131_create_table_file extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function up()
    {
        $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="文件表"';
        $this->createTable('ats_file', [
            'id' => $this->primaryKey(),
            'pid'=>$this->integer(11)->defaultValue(null)->comment('父级id'),
            'name'=>$this->string(255)->defaultValue(null)->comment('名称'),
            'type'=>$this->tinyInteger(1)->defaultValue(0)->comment('类型'),
            'own_type'=>$this->tinyInteger(1)->defaultValue(0)->comment('拥有者类型'),
            'own_id'=>$this->integer(11)->defaultValue(null)->comment('拥有者id'),
            'alias'=>$this->string(50)->defaultValue(null)->comment('别名'),
            'path'=>$this->string(255)->defaultValue(null)->comment('地址'),
            'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'),
            'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
            'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
        ],$tableOptions);
    }

    /**
     * {@inheritdoc}
     */
    public function down()
    {
        $this->dropTable('ats_file');
        return true;
    }
}