m220227_143429_member_level_config.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. use yii\db\Migration;
  3. class m220227_143429_member_level_config extends Migration
  4. {
  5. public function up()
  6. {
  7. /* 取消外键约束 */
  8. $this->execute('SET foreign_key_checks = 0');
  9. /* 创建表 */
  10. $this->createTable('{{%member_level_config}}', [
  11. 'id' => "int(11) NOT NULL AUTO_INCREMENT",
  12. 'merchant_id' => "int(11) unsigned NULL DEFAULT '0' COMMENT '商户id'",
  13. 'store_id' => "int(10) unsigned NULL DEFAULT '0' COMMENT '店铺ID'",
  14. 'upgrade_type' => "tinyint(4) NULL DEFAULT '1' COMMENT '升级方式'",
  15. 'auto_upgrade_type' => "tinyint(4) NULL DEFAULT '1' COMMENT '自动升级类型'",
  16. 'status' => "int(11) NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]'",
  17. 'created_at' => "int(10) unsigned NULL DEFAULT '0' COMMENT '创建时间'",
  18. 'updated_at' => "int(10) unsigned NULL DEFAULT '0' COMMENT '修改时间'",
  19. 'PRIMARY KEY (`id`)'
  20. ], "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员_等级配置'");
  21. /* 索引设置 */
  22. /* 表数据 */
  23. /* 设置外键约束 */
  24. $this->execute('SET foreign_key_checks = 1;');
  25. }
  26. public function down()
  27. {
  28. $this->execute('SET foreign_key_checks = 0');
  29. /* 删除表 */
  30. $this->dropTable('{{%member_level_config}}');
  31. $this->execute('SET foreign_key_checks = 1;');
  32. }
  33. }
粤ICP备19079148号