| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- * Class M231127033948AchievementColumnUpdate
- */
- class M231127033948AchievementColumnUpdate extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- return '';
- try{
- $tableName = 'qimall_addons_achievement_award_log';
- $table = \Yii::$app->db->getTableSchema($tableName, true);
- if(empty($table)) return true;
- $column = $table->getColumn('equal_info');
- if(empty($column)) return true;
- $sql = "ALTER TABLE `qimall_addons_achievement_award_log` MODIFY COLUMN `equal_info` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '首次平级奖励内容';";
- $this->execute($sql);
- }catch (\Exception $e){
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M231127033948AchievementColumnUpdate cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M231127033948AchievementColumnUpdate cannot be reverted.\n";
- return false;
- }
- */
- }
|