M220906070724QimallAddonsStoreExtra.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M220906070724QimallAddonsStoreExtra
  6. */
  7. class M220906070724QimallAddonsStoreExtra extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $table = 'qimall_addons_store_extra';
  15. $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
  16. $res = $this->db->createCommand($sql)->execute();
  17. if(!empty($res)) return '';
  18. $this->createTable($table, [
  19. 'id' => $this->primaryKey(),
  20. 'mall_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('商城id'),
  21. 'store_id' => $this->integer(11)->notNull()->defaultValue(0)->comment('门店id'),
  22. 'give_setting' => $this->text()->comment('赠送设置'),
  23. 'deduct_setting' => $this->text()->comment('抵扣设置'),
  24. 'status' => $this->tinyInteger(1)->notNull()->defaultValue(1)->comment('状态[-1:删除;0:禁用;1启用]'),
  25. 'created_at' => $this->integer(11)->notNull()->defaultValue(0)->comment('添加时间'),
  26. 'updated_at' => $this->integer(11)->notNull()->defaultValue(0)->comment('修改时间'),
  27. ]);
  28. $this->addCommentOnTable($table,'门店额外信息表');
  29. }
  30. /**
  31. * {@inheritdoc}
  32. */
  33. public function safeDown()
  34. {
  35. echo "M220906070724QimallAddonsStoreExtra cannot be reverted.\n";
  36. return false;
  37. }
  38. /*
  39. // Use up()/down() to run migration code without a transaction.
  40. public function up()
  41. {
  42. }
  43. public function down()
  44. {
  45. echo "M220906070724QimallAddonsStoreExtra cannot be reverted.\n";
  46. return false;
  47. }
  48. */
  49. }