2016-08-21 04:51:39 +05:30
|
|
|
<?php
|
|
|
|
|
|
|
|
use console\db\Migration;
|
|
|
|
|
|
|
|
class m160819_211139_minecraft_access_tokens extends Migration {
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public function safeUp(): void {
|
2016-08-21 04:51:39 +05:30
|
|
|
$this->createTable('{{%minecraft_access_keys}}', [
|
|
|
|
'access_token' => $this->string(36)->notNull(),
|
|
|
|
'client_token' => $this->string(36)->notNull(),
|
2018-04-18 02:17:25 +05:30
|
|
|
'account_id' => $this->db->getTableSchema('{{%accounts}}')->getColumn('id')->dbType . ' NOT NULL',
|
|
|
|
'created_at' => $this->integer()->unsigned()->notNull(),
|
|
|
|
'updated_at' => $this->integer()->unsigned()->notNull(),
|
2016-08-21 04:51:39 +05:30
|
|
|
]);
|
|
|
|
|
|
|
|
$this->addPrimaryKey('access_token', '{{%minecraft_access_keys}}', 'access_token');
|
|
|
|
$this->addForeignKey('FK_minecraft_access_token_to_account', '{{%minecraft_access_keys}}', 'account_id', '{{%accounts}}', 'id', 'CASCADE', 'CASCADE');
|
|
|
|
$this->createIndex('client_token', '{{%minecraft_access_keys}}', 'client_token', true);
|
|
|
|
}
|
|
|
|
|
2024-12-02 15:40:55 +05:30
|
|
|
public function safeDown(): void {
|
2016-08-21 04:51:39 +05:30
|
|
|
$this->dropTable('{{%minecraft_access_keys}}');
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|