M240929021221QimallAddonsStoreReserveSetting.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M240929021221QimallAddonsStoreReserveSetting
  6. */
  7. class M240929021221QimallAddonsStoreReserveSetting extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $table = 'qimall_addons_store_reserve_setting';
  15. $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
  16. $res = $this->db->createCommand($sql)->execute();
  17. if(!empty($res)) return '';
  18. $sql="CREATE TABLE `qimall_addons_store_reserve_setting` (
  19. `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'ID',
  20. `mall_id` int(10) unsigned NOT NULL COMMENT '商城ID',
  21. `store_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '门店id',
  22. `setting` text COMMENT '',
  23. `status` tinyint(3) NOT NULL DEFAULT '1' COMMENT '状态0禁用,-1删除,1正常',
  24. `created_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
  25. `updated_at` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
  26. PRIMARY KEY (`id`) USING BTREE,
  27. KEY `store_id` (`store_id`) USING BTREE
  28. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='预约门店独立设置';";
  29. $this->execute($sql);
  30. }
  31. /**
  32. * {@inheritdoc}
  33. */
  34. public function safeDown()
  35. {
  36. echo "M240929021221QimallAddonsStoreReserveSetting cannot be reverted.\n";
  37. return false;
  38. }
  39. /*
  40. // Use up()/down() to run migration code without a transaction.
  41. public function up()
  42. {
  43. }
  44. public function down()
  45. {
  46. echo "M240929021221QimallAddonsStoreReserveSetting cannot be reverted.\n";
  47. return false;
  48. }
  49. */
  50. }