m220227_151444_addon_wechat_rule.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. use yii\db\Migration;
  3. class m220227_151444_addon_wechat_rule extends Migration
  4. {
  5. public function up()
  6. {
  7. /* 取消外键约束 */
  8. $this->execute('SET foreign_key_checks = 0');
  9. /* 创建表 */
  10. $this->createTable('{{%addon_wechat_rule}}', [
  11. 'id' => "int(10) unsigned NOT NULL AUTO_INCREMENT",
  12. 'merchant_id' => "int(10) unsigned NULL DEFAULT '0' COMMENT '商户id'",
  13. 'store_id' => "int(10) unsigned NULL DEFAULT '0' COMMENT '店铺ID'",
  14. 'name' => "varchar(50) NOT NULL DEFAULT '' COMMENT '规则名称'",
  15. 'module' => "varchar(50) NOT NULL DEFAULT '' COMMENT '模块'",
  16. 'data' => "text NULL COMMENT '数据'",
  17. 'sort' => "int(10) NOT NULL DEFAULT '0' COMMENT '排序'",
  18. 'status' => "tinyint(4) NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]'",
  19. 'created_at' => "int(10) NULL DEFAULT '0' COMMENT '创建时间'",
  20. 'updated_at' => "int(10) NULL DEFAULT '0' COMMENT '修改时间'",
  21. 'PRIMARY KEY (`id`)'
  22. ], "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='微信_回复规则名称表'");
  23. /* 索引设置 */
  24. /* 表数据 */
  25. /* 设置外键约束 */
  26. $this->execute('SET foreign_key_checks = 1;');
  27. }
  28. public function down()
  29. {
  30. $this->execute('SET foreign_key_checks = 0');
  31. /* 删除表 */
  32. $this->dropTable('{{%addon_wechat_rule}}');
  33. $this->execute('SET foreign_key_checks = 1;');
  34. }
  35. }
粤ICP备19079148号