| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- *
- * Class m220830_025931_user_level_upgrade_condition
- */
- class m220830_025931_user_level_upgrade_condition extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $tableName = 'qimall_user_level_upgrade_condition';
- $table = \Yii::$app->db->getTableSchema($tableName, true);
- $column_cate_ids = $table->getColumn('cate_ids');
- $column_buy_cate_type = $table->getColumn('buy_cate_type');
- if(!$column_cate_ids){
- $this->execute("ALTER TABLE qimall_user_level_upgrade_condition add `cate_ids` varchar(3000) NOT NULL DEFAULT '' COMMENT '商品分类id集合'");
- }
- if(!$column_buy_cate_type){
- $this->execute("ALTER TABLE qimall_user_level_upgrade_condition add `buy_cate_type` tinyint(1) NOT NULL DEFAULT '0' COMMENT '订单完成0;支付完成:1';");
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "m220830_025931_user_level_upgrade_condition cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "m220830_025931_user_level_upgrade_condition cannot be reverted.\n";
- return false;
- }
- */
- }
|