| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace addons\SignIn\console\migrations;
- use yii\db\Migration;
- /**
- * Class M230519034030QimallAddonsSignInUserPropertyAward
- */
- class M230519034030QimallAddonsSignInUserPropertyAward extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $table = 'qimall_addons_sign_in_user_property_award';
- $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_sign_in_user_property_award` (
- `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
- `mall_id` int(11) NOT NULL DEFAULT '0',
- `user_id` int(11) NOT NULL DEFAULT '0',
- `give_type` varchar(255) NOT NULL DEFAULT '' COMMENT '奖励类型',
- `total_num` decimal(12,2) NOT NULL DEFAULT '0.00' COMMENT '累计奖励数量',
- `status` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态[-1:删除;0:禁用;1启用]',
- `created_at` int(10) NOT NULL DEFAULT '0' COMMENT '创建时间',
- `updated_at` int(10) NOT NULL DEFAULT '0' COMMENT '更新时间',
- PRIMARY KEY (`id`) USING BTREE,
- KEY `user_mall_id` (`user_id`,`mall_id`) USING BTREE
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户签到资产奖励汇总表';
- ";
- $this->execute($sql);
- }catch (\Exception $e){
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M230519034030QimallAddonsSignInUserPropertyAward cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M230519034030QimallAddonsSignInUserPropertyAward cannot be reverted.\n";
- return false;
- }
- */
- }
|