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.
 
 
 
 
 

27 lines
797 B

<?php
use yii\db\Migration;
/**
* Class m180107_204200_change_auth_assignments_table
*/
class m180107_204200_change_auth_assignments_table extends Migration
{
public function safeUp()
{
$this->alterColumn('{{%auth_assignments}}', 'user_id', $this->integer()->notNull());
$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());
}
}