| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- * Class M241231092053CreateUserOrderRelations
- */
- class M241231092053CreateUserOrderRelations extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $sql = <<<SQL
- CREATE TABLE `qimall_user_order_relations` (
- `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `mall_id` int(10) unsigned NOT NULL DEFAULT '0',
- `order_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '订单id',
- `user_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
- `parents` json NOT NULL COMMENT '下单时的上级关系链,包含等级',
- `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态 -1删除 0禁用 1正常',
- `created_at` int(10) unsigned NOT NULL DEFAULT '0',
- `updated_at` int(10) unsigned NOT NULL DEFAULT '0',
- PRIMARY KEY (`id`),
- KEY `order_id` (`order_id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='记录订单支付时,下单人关系链的等级';
- SQL;
- $this->execute($sql);
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M241231092053CreateUserOrderRelations cannot be reverted.\n";
- return false;
- }
- */
- }
|