M241007063457QimallAddonsStoreReserveTechnicianSchedulingTime.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M241007063457QimallAddonsStoreReserveTechnicianSchedulingTime
  6. */
  7. class M241007063457QimallAddonsStoreReserveTechnicianSchedulingTime extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $table = 'qimall_addons_store_reserve_technician_scheduling_time';
  15. $sql = "select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
  16. $res = $this->db->createCommand($sql)->execute();
  17. if (empty($res)) {
  18. $sql = "
  19. CREATE TABLE `qimall_addons_store_reserve_technician_scheduling_time` (
  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. `sid` int(11) DEFAULT NULL COMMENT '排期id',
  25. `start_time` int(11) DEFAULT NULL COMMENT '开始时间',
  26. `end_time` int(11) DEFAULT NULL COMMENT '结束时间',
  27. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态(-1:删除,0:禁用,1:启用)',
  28. `created_at` bigint(20) DEFAULT NULL COMMENT '创建时间',
  29. `updated_at` bigint(20) DEFAULT NULL COMMENT '修改时间',
  30. PRIMARY KEY (`id`)
  31. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  32. ";
  33. $this->execute($sql);
  34. }
  35. }
  36. /**
  37. * {@inheritdoc}
  38. */
  39. public function safeDown()
  40. {
  41. echo "M241007063457QimallAddonsStoreReserveTechnicianSchedulingTime cannot be reverted.\n";
  42. return false;
  43. }
  44. /*
  45. // Use up()/down() to run migration code without a transaction.
  46. public function up()
  47. {
  48. }
  49. public function down()
  50. {
  51. echo "M241007063457QimallAddonsStoreReserveTechnicianSchedulingTime cannot be reverted.\n";
  52. return false;
  53. }
  54. */
  55. }