| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace addons\Store\console\migrations;
- use addons\Store\common\models\StoreAdmin;
- use yii\db\Migration;
- /**
- * Class M240705101952AlterQimallAddonsStoreAdmin
- */
- class M240705101952AlterQimallAddonsStoreAdmin extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- $start = 1000001;
- $sql="alter table qimall_addons_store_admin auto_increment = {$start}";
- $this->execute($sql);
- $list = StoreAdmin::lists(['where' => [['>', 'id', 0]]], false);
- foreach ($list as $item) {
- $item->id = $start++;
- $item->save();
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- echo "M240705101952AlterQimallAddonsStoreAdmin cannot be reverted.\n";
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M240705101952AlterQimallAddonsStoreAdmin cannot be reverted.\n";
- return false;
- }
- */
- }
|