You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.4 KiB

  1. <?php
  2. use yii\db\Migration;
  3. /**
  4. * Class m191112_022131_create_table_file
  5. */
  6. class m191112_022131_create_table_file extends Migration
  7. {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. public function up()
  12. {
  13. $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="文件表"';
  14. $this->createTable('ats_file', [
  15. 'id' => $this->primaryKey(),
  16. 'pid'=>$this->integer(11)->defaultValue(null)->comment('父级id'),
  17. 'name'=>$this->string(255)->defaultValue(null)->comment('名称'),
  18. 'type'=>$this->tinyInteger(1)->defaultValue(0)->comment('类型'),
  19. 'own_type'=>$this->tinyInteger(1)->defaultValue(0)->comment('拥有者类型'),
  20. 'own_id'=>$this->integer(11)->defaultValue(null)->comment('拥有者id'),
  21. 'alias'=>$this->string(50)->defaultValue(null)->comment('别名'),
  22. 'path'=>$this->string(255)->defaultValue(null)->comment('地址'),
  23. 'is_delete'=>$this->tinyInteger(1)->defaultValue(0)->comment('是否删除,1为已删除'),
  24. 'updated_at'=>$this->integer(11)->defaultValue(null)->comment('更新时间'),
  25. 'created_at'=>$this->integer(11)->defaultValue(null)->comment('创建时间'),
  26. ],$tableOptions);
  27. }
  28. /**
  29. * {@inheritdoc}
  30. */
  31. public function down()
  32. {
  33. $this->dropTable('ats_file');
  34. return true;
  35. }
  36. }