| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- namespace app\migrations;
- use yii\db\Migration;
- /**
- *
- * Class M220915035028AddOldNameColumnToQimallAttachment
- */
- class M220915035028AddOldNameColumnToQimallAttachment extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $sql = "ALTER TABLE qimall_attachment add `old_name` varchar(255) NOT NULL DEFAULT '' COMMENT '文件原名称' after name";
- $this->execute($sql);
- } catch (\Exception $e) {
- \Yii::error('qimall_attachment表添加字段报错' . $e->getMessage());
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M220915035028AddOldNameColumnToQimallAttachment cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M220915035028AddOldNameColumnToQimallAttachment cannot be reverted.\n";
- return false;
- }
- */
- }
|