M240429132301CreateTableQimallAddonsCloudStockImportLevelLog.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. namespace addons\CloudStock\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M240429132301CreateTableQimallAddonsCloudStockImportLevelLog
  6. */
  7. class M240429132301CreateTableQimallAddonsCloudStockImportLevelLog extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $sql = "CREATE TABLE `qimall_addons_cloud_stock_import_level_log` (
  15. `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  16. `mall_id` int(11) NOT NULL DEFAULT 0 COMMENT '商城ID',
  17. `counts` int(11) NOT NULL DEFAULT 0 COMMENT '导入数量',
  18. `success_counts` int(11) NOT NULL DEFAULT 0 COMMENT '导入成功数量',
  19. `fail_counts` int(11) NOT NULL DEFAULT 0 COMMENT '导入失败数量',
  20. `upload_file` varchar(255) NOT NULL DEFAULT '' COMMENT '上传文件存在路径',
  21. `status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '状态:1:导入成功;2导入失败;3:导入中;4:导入中断',
  22. `updated_at` int(11) NOT NULL DEFAULT 0,
  23. `created_at` int(11) NOT NULL DEFAULT 0,
  24. PRIMARY KEY (`id`) USING BTREE
  25. ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COMMENT = '会员导入日志表' ROW_FORMAT = Dynamic;";
  26. $this->execute($sql);
  27. $sql = "CREATE TABLE `qimall_addons_cloud_stock_import_level_fail_log` (
  28. `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  29. `mall_id` int(11) NOT NULL DEFAULT 0 COMMENT '商城ID',
  30. `log_id` int(11) NOT NULL DEFAULT 0 COMMENT '导入批次id',
  31. `user_id` int(11) NULL DEFAULT NULL,
  32. `level` int(11) NOT NULL COMMENT '导入等级的id',
  33. `reason` varchar(255) NOT NULL DEFAULT '' COMMENT '失败原因',
  34. `extra` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '导入的内容',
  35. `updated_at` int(11) NOT NULL DEFAULT 0,
  36. `created_at` int(11) NOT NULL DEFAULT 0 COMMENT '添加时间',
  37. PRIMARY KEY (`id`) USING BTREE
  38. ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 ROW_FORMAT = Dynamic COMMENT = '代理等级导入失败日志';";
  39. $this->execute($sql);
  40. $sql = "CREATE TABLE `qimall_addons_cloud_stock_import_stock_fail_log` (
  41. `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  42. `mall_id` int(11) NOT NULL DEFAULT 0 COMMENT '商城ID',
  43. `log_id` int(11) NOT NULL DEFAULT 0 COMMENT '导入批次id',
  44. `user_id` int(11) NULL DEFAULT NULL,
  45. `goods_id` int(11) NOT NULL DEFAULT 0 COMMENT '导入的商品的id',
  46. `reason` varchar(255) NOT NULL DEFAULT '' COMMENT '失败原因',
  47. `extra` text NULL COMMENT '导入的内容',
  48. `updated_at` int(11) NOT NULL DEFAULT 0,
  49. `created_at` int(11) NOT NULL DEFAULT 0 COMMENT '添加时间',
  50. `num` int(11) NOT NULL DEFAULT 0 COMMENT '库存数量',
  51. PRIMARY KEY (`id`) USING BTREE
  52. ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COMMENT = '库存导入失败日志' ROW_FORMAT = Dynamic;
  53. ";
  54. $this->execute($sql);
  55. $sql = "CREATE TABLE `qimall_addons_cloud_stock_import_stock_log` (
  56. `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  57. `mall_id` int(11) NOT NULL DEFAULT 0 COMMENT '商城ID',
  58. `counts` int(11) NOT NULL DEFAULT 0 COMMENT '导入数量',
  59. `success_counts` int(11) NOT NULL DEFAULT 0 COMMENT '导入成功数量',
  60. `fail_counts` int(11) NOT NULL DEFAULT 0 COMMENT '导入失败数量',
  61. `upload_file` varchar(255) NOT NULL DEFAULT '' COMMENT '上传文件存在路径',
  62. `status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '状态:1:导入成功;2导入失败;3:导入中;4:导入中断',
  63. `updated_at` int(11) NOT NULL DEFAULT 0,
  64. `created_at` int(11) NOT NULL DEFAULT 0,
  65. PRIMARY KEY (`id`) USING BTREE
  66. ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8 COMMENT = '会员导入日志表' ROW_FORMAT = Dynamic;
  67. ";
  68. $this->execute($sql);
  69. }
  70. /**
  71. * {@inheritdoc}
  72. */
  73. public function safeDown()
  74. {
  75. echo "M240429132301CreateTableQimallAddonsCloudStockImportLevelLog cannot be reverted.\n";
  76. return false;
  77. }
  78. /*
  79. // Use up()/down() to run migration code without a transaction.
  80. public function up()
  81. {
  82. }
  83. public function down()
  84. {
  85. echo "M240417082535CreateTableAgentApply cannot be reverted.\n";
  86. return false;
  87. }
  88. */
  89. }