You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
800 B

7 years ago
<?php
use yii\db\Migration;
/**
* Class m180107_204200_change_auth_assignments_table
*/
class m180107_204200_change_auth_assignments_table extends Migration
{
public function safeUp()
{
3 years ago
$this->alterColumn('{{%auth_assignments}}', 'user_id', $this->bigInteger()->notNull());
7 years ago
$this->createIndex('{{%idx-auth_assignments-user_id}}', '{{%auth_assignments}}', 'user_id');
$this->addForeignKey('{{%fk-auth_assignments-user_id}}', '{{%auth_assignments}}', 'user_id', '{{%users}}', 'id', 'CASCADE');
}
public function down()
{
$this->dropForeignKey('{{%fk-auth_assignments-user_id}}', '{{%auth_assignments}}');
$this->dropIndex('{{%idx-auth_assignments-user_id}}', '{{%auth_assignments}}');
$this->alterColumn('{{%auth_assignments}}', 'user_id', $this->string(64)->notNull());
}
}