2016-03-12 03:25:46 +05:30
|
|
|
<?php
|
|
|
|
|
|
|
|
use console\db\Migration;
|
|
|
|
|
|
|
|
class m160311_211107_password_change_time extends Migration {
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public function safeUp(): void {
|
2016-03-12 03:25:46 +05:30
|
|
|
$this->addColumn('{{%accounts}}', 'password_changed_at', $this->integer()->notNull());
|
|
|
|
$this->getDb()->createCommand('
|
|
|
|
UPDATE {{%accounts}}
|
|
|
|
SET password_changed_at = created_at
|
|
|
|
')->execute();
|
|
|
|
$this->dropColumn('{{%accounts}}', 'auth_key');
|
|
|
|
}
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public function safeDown(): void {
|
2016-03-12 03:25:46 +05:30
|
|
|
$this->dropColumn('{{%accounts}}', 'password_changed_at');
|
|
|
|
$this->addColumn('{{%accounts}}', 'auth_key', $this->string(32)->notNull() . ' AFTER `status`');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|