M230627012405QimallAddonsCloudStockPushDelayLog.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace addons\CloudStock\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M230627012405QimallAddonsCloudStockPushDelayLog
  6. */
  7. class M230627012405QimallAddonsCloudStockPushDelayLog extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $table = 'qimall_addons_cloud_stock_push_delay_log';
  16. $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
  17. $res = $this->db->createCommand($sql)->execute();
  18. if(!empty($res)) return '';
  19. $sql="CREATE TABLE `qimall_addons_cloud_stock_push_delay_log` (
  20. `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  21. `mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '商城id',
  22. `user_id` int(11) NOT NULL DEFAULT '0' COMMENT '用户id',
  23. `agent_user_id` int(11) NOT NULL DEFAULT '0' COMMENT '用户id',
  24. `stock_log_id` int(11) NOT NULL DEFAULT '0' COMMENT 'stock_log_id',
  25. `goods_id` int(11) NOT NULL DEFAULT '0' COMMENT '商品id',
  26. `order_id` int(11) NOT NULL DEFAULT '0' COMMENT 'order_id',
  27. `not_yet_num` int(11) NOT NULL DEFAULT '0' COMMENT '商品id',
  28. `order_type` varchar(255) NOT NULL COMMENT '订单类型',
  29. `time_limit_fill_user_ids` text,
  30. `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  31. `created_at` bigint(20) NOT NULL DEFAULT '0',
  32. `updated_at` bigint(20) NOT NULL DEFAULT '0',
  33. PRIMARY KEY (`id`) USING BTREE
  34. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='云库存投递延时队列记录表';";
  35. $this->execute($sql);
  36. }catch (\Exception $e){
  37. }
  38. }
  39. /**
  40. * {@inheritdoc}
  41. */
  42. public function safeDown()
  43. {
  44. echo "M230627012405QimallAddonsCloudStockPushDelayLog cannot be reverted.\n";
  45. return false;
  46. }
  47. /*
  48. // Use up()/down() to run migration code without a transaction.
  49. public function up()
  50. {
  51. }
  52. public function down()
  53. {
  54. echo "M230627012405QimallAddonsCloudStockPushDelayLog cannot be reverted.\n";
  55. return false;
  56. }
  57. */
  58. }