M240108084008QiDingDongV3.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. namespace addons\QiDingDong\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M240108084008QiDingDongV3
  6. */
  7. class M240108084008QiDingDongV3 extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. $this->execute("CREATE TABLE `qimall_addons_qi_ding_dong_balance` (
  15. `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  16. `mall_id` INT(11) NOT NULL DEFAULT '0' COMMENT '商城ID',
  17. `created_at` INT(10) NOT NULL DEFAULT '0' COMMENT '创建时间',
  18. `updated_at` INT(10) NOT NULL DEFAULT '0' COMMENT '更新时间',
  19. `status` TINYINT(4) NOT NULL DEFAULT '1' COMMENT '状态',
  20. `balance` BIGINT(20) NOT NULL DEFAULT '0' COMMENT '余额',
  21. `rate` INT(11) NOT NULL DEFAULT '0' COMMENT '加价额度',
  22. PRIMARY KEY (`id`) USING BTREE
  23. )
  24. COMMENT='余额'
  25. COLLATE='utf8mb4_general_ci'
  26. ENGINE=InnoDB;");
  27. $this->execute("CREATE TABLE `qimall_addons_qi_ding_dong_balance_log` (
  28. `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  29. `mall_id` INT(11) NOT NULL DEFAULT '0' COMMENT '商城ID',
  30. `created_at` INT(10) NOT NULL DEFAULT '0' COMMENT '创建时间',
  31. `updated_at` INT(10) NOT NULL DEFAULT '0' COMMENT '更新时间',
  32. `status` TINYINT(4) NOT NULL DEFAULT '1' COMMENT '状态',
  33. `amount` BIGINT(20) NOT NULL DEFAULT '0' COMMENT '异动金额',
  34. `before_amount` BIGINT(20) NOT NULL DEFAULT '0' COMMENT '异动前金额',
  35. `after_amount` BIGINT(20) NOT NULL DEFAULT '0' COMMENT '异动后金额',
  36. `remark` VARCHAR(1000) NOT NULL DEFAULT '' COMMENT '异动备注' COLLATE 'utf8mb4_general_ci',
  37. `type` TINYINT(4) NOT NULL DEFAULT '0' COMMENT '异动类型',
  38. `direction` TINYINT(4) NOT NULL DEFAULT '1' COMMENT '1进2出',
  39. `order_no` CHAR(30) NOT NULL DEFAULT '' COMMENT '订单编号' COLLATE 'utf8mb4_general_ci',
  40. `addons` VARCHAR(50) NOT NULL DEFAULT '' COMMENT '所属插件' COLLATE 'utf8mb4_general_ci',
  41. PRIMARY KEY (`id`) USING BTREE
  42. )
  43. COMMENT='余额异动'
  44. COLLATE='utf8mb4_general_ci'
  45. ENGINE=InnoDB;");
  46. $this->execute("ALTER TABLE `qimall_addons_qi_ding_dong_goods`
  47. ADD COLUMN `can_sale` TINYINT NOT NULL DEFAULT 1 COMMENT '是否可售' AFTER `default_image`;");
  48. }
  49. /**
  50. * {@inheritdoc}
  51. */
  52. public function safeDown()
  53. {
  54. echo "M240108084008QiDingDongV3 cannot be reverted.\n";
  55. return false;
  56. }
  57. /*
  58. // Use up()/down() to run migration code without a transaction.
  59. public function up()
  60. {
  61. }
  62. public function down()
  63. {
  64. echo "M240108084008QiDingDongV3 cannot be reverted.\n";
  65. return false;
  66. }
  67. */
  68. }