guild/console/migrations/m211115_125911_create_manager_table.php
2021-11-17 14:56:06 +03:00

31 lines
633 B
PHP

<?php
use yii\db\Migration;
/**
* Handles the creation of table `{{%manager}}`.
*/
class m211115_125911_create_manager_table extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('{{%manager}}', [
'id' => $this->primaryKey(),
'user_id' => $this->integer(),
]);
$this->addForeignKey('manager_user', 'manager', 'user_id', 'user', 'id');
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropForeignKey('manager_user', 'manager');
$this->dropTable('{{%manager}}');
}
}