| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- use yii\db\Migration;
- class m220227_143427_common_attachment_cate extends Migration
- {
- public function up()
- {
- /* 取消外键约束 */
- $this->execute('SET foreign_key_checks = 0');
- /* 创建表 */
- $this->createTable('{{%common_attachment_cate}}', [
- 'id' => "int(11) NOT NULL AUTO_INCREMENT COMMENT '主键'",
- 'merchant_id' => "int(10) unsigned NULL DEFAULT '0' COMMENT '商户id'",
- 'store_id' => "int(10) unsigned NULL DEFAULT '0' COMMENT '店铺ID'",
- 'title' => "varchar(100) NULL DEFAULT '' COMMENT '标题'",
- 'type' => "varchar(30) NULL DEFAULT '' COMMENT '类别'",
- 'sort' => "int(5) NULL DEFAULT '0' COMMENT '排序'",
- 'level' => "tinyint(1) NULL DEFAULT '1' COMMENT '级别'",
- 'pid' => "int(50) NULL DEFAULT '0' COMMENT '上级id'",
- 'tree' => "varchar(500) NULL DEFAULT '' COMMENT '树'",
- 'status' => "tinyint(4) NULL DEFAULT '1' COMMENT '状态'",
- 'created_at' => "int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间'",
- 'updated_at' => "int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间'",
- 'PRIMARY KEY (`id`)'
- ], "ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COMMENT='公用_资源文件分类'");
- /* 索引设置 */
- /* 表数据 */
- /* 设置外键约束 */
- $this->execute('SET foreign_key_checks = 1;');
- }
- public function down()
- {
- $this->execute('SET foreign_key_checks = 0');
- /* 删除表 */
- $this->dropTable('{{%common_attachment_cate}}');
- $this->execute('SET foreign_key_checks = 1;');
- }
- }
|