M221105093726QimallAddonsStoreCommissionCheck.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace addons\Store\console\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M221105093726AddColumVoucherImgToQimallAddonsStoreCommission
  6. */
  7. class M221105093726QimallAddonsStoreCommissionCheck extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $table = 'qimall_addons_store_commission_check';
  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 = "
  20. CREATE TABLE `qimall_addons_store_commission_check` (
  21. `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  22. `mall_id` int(11) NOT NULL DEFAULT '0' COMMENT '商城id',
  23. `store_id` int(11) NOT NULL DEFAULT '0' COMMENT '门店id',
  24. `store_commission_id` int(11) NOT NULL DEFAULT '0' COMMENT '提成明细id',
  25. `order_no` varchar(100) NOT NULL DEFAULT '' COMMENT '订单编号',
  26. `voucher_img` varchar(255) not null default '' comment '凭证图片',
  27. `check_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '审核状态[0:待审核;1:已同意;2:已驳回]',
  28. `created_at` int(11) NOT NULL DEFAULT '0',
  29. `updated_at` int(11) NOT NULL DEFAULT '0',
  30. `status` tinyint(1) DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
  31. PRIMARY KEY (`id`) USING BTREE
  32. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='门店提成明细审核记录表';
  33. ";
  34. $this->execute($sql);
  35. } catch (\Exception $e) {
  36. }
  37. }
  38. /**
  39. * {@inheritdoc}
  40. */
  41. public function safeDown()
  42. {
  43. echo "M221105093726AddColumVoucherImgToQimallAddonsStoreCommission cannot be reverted.\n";
  44. return false;
  45. }
  46. /*
  47. // Use up()/down() to run migration code without a transaction.
  48. public function up()
  49. {
  50. }
  51. public function down()
  52. {
  53. echo "M221105093726AddColumVoucherImgToQimallAddonsStoreCommission cannot be reverted.\n";
  54. return false;
  55. }
  56. */
  57. }