M250121175530AddStoreCommonSyncLogs.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M250121175530AddStoreCommonSyncLogs
  6. */
  7. class M250121175530AddStoreCommonSyncLogs extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = <<<SQL
  15. CREATE TABLE `qimall_addons_store_common_sync_logs` (
  16. `id` int(11) NOT NULL AUTO_INCREMENT,
  17. `mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '商城ID',
  18. `type` varchar(255) NOT NULL DEFAULT '' COMMENT '类型',
  19. `self_store_id` int(11) NOT NULL DEFAULT '0' COMMENT '自身门店ID',
  20. `source_store_id` int(11) NOT NULL DEFAULT '0' COMMENT '源门店ID',
  21. `type_id` int(11) NOT NULL DEFAULT '0' COMMENT '自身门店的类型id',
  22. `source_type_id` int(11) NOT NULL DEFAULT '0' COMMENT '源门店的的类型id',
  23. `created_at` int(11) NOT NULL DEFAULT '0',
  24. `updated_at` int(11) NOT NULL DEFAULT '0',
  25. PRIMARY KEY (`id`),
  26. KEY `idx_index` (`type`,`self_store_id`,`source_store_id`,`source_type_id`) USING BTREE
  27. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='门店同步日志表';
  28. CREATE TABLE `qimall_addons_store_sync_goods_logs` (
  29. `id` int(11) NOT NULL AUTO_INCREMENT,
  30. `mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '商城ID',
  31. `self_store_id` int(11) NOT NULL DEFAULT '0' COMMENT '自身门店ID',
  32. `source_store_id` int(11) NOT NULL DEFAULT '0' COMMENT '源门店ID',
  33. `goods_id` int(11) NOT NULL DEFAULT '0' COMMENT '自身门店的商品id',
  34. `source_goods_id` int(11) NOT NULL DEFAULT '0' COMMENT '源门店的商品id',
  35. `created_at` int(11) NOT NULL DEFAULT '0',
  36. `updated_at` int(11) NOT NULL DEFAULT '0',
  37. PRIMARY KEY (`id`)
  38. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='门店商品同步日志表';
  39. ALTER TABLE `qimall_addons_store` ADD COLUMN `is_sync` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '是否需要同步:0:否,1:是',
  40. ADD COLUMN `sync_status` TINYINT(1) NOT NULL DEFAULT '0' COMMENT '同步状态:0:待同步;1:同步中;2:同步完成';
  41. SQL;
  42. $this->execute($sql);
  43. }
  44. /**
  45. * {@inheritdoc}
  46. */
  47. public function safeDown()
  48. {
  49. echo "M250121175530AddStoreCommonSyncLogs cannot be reverted.\n";
  50. return false;
  51. }
  52. }