M241007063133QimallAddonsStoreReserveTechnicianScheduling.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M241007063133QimallAddonsStoreReserveTechnicianScheduling
  6. */
  7. class M241007063133QimallAddonsStoreReserveTechnicianScheduling extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $table = 'qimall_addons_store_reserve_technician_scheduling';
  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 = "
  19. CREATE TABLE `qimall_addons_store_reserve_technician_scheduling` (
  20. `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  21. `mall_id` int(11) NOT NULL COMMENT '商城id',
  22. `store_id` int(11) NOT NULL COMMENT '门店id',
  23. `user_id` int(11) DEFAULT NULL COMMENT 'user_id',
  24. `date_time` int(11) DEFAULT NULL COMMENT '日期',
  25. `is_all_day` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否全天(0:不是,1:是)',
  26. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态(-1:删除,0:禁用,1:启用)',
  27. `created_at` bigint(20) DEFAULT NULL COMMENT '创建时间',
  28. `updated_at` bigint(20) DEFAULT NULL COMMENT '修改时间',
  29. PRIMARY KEY (`id`)
  30. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  31. ";
  32. $this->execute($sql);
  33. }
  34. /**
  35. * {@inheritdoc}
  36. */
  37. public function safeDown()
  38. {
  39. echo "M241007063133QimallAddonsStoreReserveTechnicianScheduling cannot be reverted.\n";
  40. return false;
  41. }
  42. /*
  43. // Use up()/down() to run migration code without a transaction.
  44. public function up()
  45. {
  46. }
  47. public function down()
  48. {
  49. echo "M241007063133QimallAddonsStoreReserveTechnicianScheduling cannot be reverted.\n";
  50. return false;
  51. }
  52. */
  53. }