| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace addons\Achievement\console\migrations;
- use yii\db\Migration;
- /**
- * Class M230904032353QimallAddonsAchievementFirstOrder
- */
- class M230904032353QimallAddonsAchievementFirstOrder extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $table = 'qimall_addons_achievement_first_order';
- $sql="select * from information_schema.TABLES where TABLE_NAME = '{$table}';";
- $res = $this->db->createCommand($sql)->execute();
- if(!empty($res)) return '';
- $sql="CREATE TABLE `qimall_addons_achievement_first_order` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) NOT NULL DEFAULT '0',
- `user_id` int(11) NOT NULL DEFAULT '0',
- `order_id` int(11) NOT NULL DEFAULT '0' COMMENT '订单id',
- `order_detail_id` int(11) NOT NULL COMMENT '订单详情id',
- `goods_id` int(11) NOT NULL DEFAULT '0' COMMENT '商品id',
- `created_at` int(11) NOT NULL DEFAULT '0',
- `updated_at` int(11) NOT NULL DEFAULT '0',
- `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
- PRIMARY KEY (`id`) USING BTREE,
- KEY `idx_mid_uid_gid` (`mall_id`,`user_id`,`goods_id`) USING BTREE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPACT COMMENT='业绩奖励升级商品首单记录';";
- $this->execute($sql);
- }catch (\Exception $e){
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230904032353QimallAddonsAchievementFirstOrder cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230904032353QimallAddonsAchievementFirstOrder cannot be reverted.\n";
- return false;
- }
- */
- }
|