M240119160319CreateTableDiyTemplateOrder.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace app\migrations;
  3. use yii\db\Migration;
  4. /**
  5. * Class M240119160319CreateTableDiyTemplateOrder
  6. */
  7. class M240119160319CreateTableDiyTemplateOrder extends Migration
  8. {
  9. /**
  10. * {@inheritdoc}
  11. */
  12. public function safeUp()
  13. {
  14. try {
  15. $sql="CREATE TABLE `qimall_diy_template_order` (
  16. `id` int(10) NOT NULL AUTO_INCREMENT,
  17. `mall_id` int(10) NOT NULL COMMENT 'Mall id',
  18. `template_id` int(10) NOT NULL COMMENT '模板ID',
  19. `order_no` varchar(32) NOT NULL COMMENT '订单号',
  20. `out_trade_no` varchar(32) DEFAULT NULL COMMENT '外部订单号',
  21. `unit` tinyint(1) NOT NULL COMMENT '周期单位[0=永久,1=月,2=年]',
  22. `duration` int(10) NOT NULL COMMENT '周期时长',
  23. `pay_money` decimal(10,2) NOT NULL COMMENT '支付金额',
  24. `order_price` decimal(10,2) NOT NULL COMMENT '订单金额',
  25. `payment_type` tinyint(1) DEFAULT '0' COMMENT '支付方式[1=微信,2=支付宝]',
  26. `pay_status` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '支付状态 0 未支付 1 已支付',
  27. `pay_time` int(10) DEFAULT NULL COMMENT '支付时间',
  28. `extra_info` longtext,
  29. `expire_time` int(10) DEFAULT NULL COMMENT '过期时间',
  30. `created_at` int(10) DEFAULT NULL,
  31. `updated_at` int(10) DEFAULT NULL,
  32. PRIMARY KEY (`id`),
  33. KEY `mall_id` (`mall_id`),
  34. KEY `order_no` (`order_no`)
  35. ) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=utf8mb4;";
  36. $this->execute($sql);
  37. } catch (\Exception $e) {
  38. }
  39. }
  40. /**
  41. * {@inheritdoc}
  42. */
  43. public function safeDown()
  44. {
  45. echo "M240119160319CreateTableDiyTemplateOrder cannot be reverted.\n";
  46. return false;
  47. }
  48. /*
  49. // Use up()/down() to run migration code without a transaction.
  50. public function up()
  51. {
  52. }
  53. public function down()
  54. {
  55. echo "M240119160319CreateTableDiyTemplateOrder cannot be reverted.\n";
  56. return false;
  57. }
  58. */
  59. }