M240618081503CreateQimallPrintLogTable.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace addons\Printer\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M240618081503CreateQimallPrintLogTable
  6. */
  7. class M240618081503CreateQimallPrintLogTable extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $sql = <<<SQL
  16. CREATE TABLE `qimall_addons_printer_log` (
  17. `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  18. `mch_id` int(11) NOT NULL DEFAULT 0 COMMENT '多商户id,0表示商城订单',
  19. `store_id` int(11) NOT NULL DEFAULT 0 COMMENT '门店id',
  20. `mall_id` int(11) NOT NULL DEFAULT 0 COMMENT '商城id',
  21. `order_id` int(11) NOT NULL DEFAULT 0 COMMENT '订单id',
  22. `type` tinyint(1) NOT NULL DEFAULT 0 COMMENT '打印类型,1: 下单,2: 支付,3: 确认收货,4: 后台',
  23. `created_at` int(11) NOT NULL DEFAULT 0,
  24. `updated_at` int(11) NOT NULL DEFAULT 0,
  25. PRIMARY KEY (`id`) USING BTREE
  26. ) ENGINE=InnoDB AUTO_INCREMENT=1402 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='订单打印日志' ROW_FORMAT=DYNAMIC;
  27. SQL;
  28. $this->execute($sql);
  29. } catch (\Exception $e) {
  30. echo "Error creating table qimall_addons_printer_log: " . $e->getMessage() . "\n";
  31. }
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public function safeDown()
  37. {
  38. echo "M240618081503CreateQimallPrintLogTable cannot be reverted.\n";
  39. return false;
  40. }
  41. }