fix migration to work with SQL Server
This commit is contained in:
@ -21,7 +21,7 @@ class m000000_000002_create_profile_table extends Migration
|
|||||||
$this->createTable(
|
$this->createTable(
|
||||||
'{{%profile}}',
|
'{{%profile}}',
|
||||||
[
|
[
|
||||||
'user_id' => $this->primaryKey(),
|
'user_id' => $this->integer()->notNull(),
|
||||||
'name' => $this->string(255),
|
'name' => $this->string(255),
|
||||||
'public_email' => $this->string(255),
|
'public_email' => $this->string(255),
|
||||||
'gravatar_email' => $this->string(255),
|
'gravatar_email' => $this->string(255),
|
||||||
@ -34,6 +34,8 @@ class m000000_000002_create_profile_table extends Migration
|
|||||||
MigrationHelper::resolveTableOptions($this->db->driverName)
|
MigrationHelper::resolveTableOptions($this->db->driverName)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->addPrimaryKey('{{%profile_pk}}','{{%profile}}','user_id');
|
||||||
|
|
||||||
$restrict = MigrationHelper::isMicrosoftSQLServer($this->db->driverName) ? 'NO ACTION' : 'RESTRICT';
|
$restrict = MigrationHelper::isMicrosoftSQLServer($this->db->driverName) ? 'NO ACTION' : 'RESTRICT';
|
||||||
|
|
||||||
$this->addForeignKey('fk_profile_user', '{{%profile}}', 'user_id', '{{%user}}', 'id', 'CASCADE', $restrict);
|
$this->addForeignKey('fk_profile_user', '{{%profile}}', 'user_id', '{{%user}}', 'id', 'CASCADE', $restrict);
|
||||||
|
|||||||
@ -18,7 +18,7 @@ class m000000_000006_add_two_factor_fields extends Migration
|
|||||||
public function safeUp()
|
public function safeUp()
|
||||||
{
|
{
|
||||||
$this->addColumn('{{%user}}', 'auth_tf_key', $this->string(16));
|
$this->addColumn('{{%user}}', 'auth_tf_key', $this->string(16));
|
||||||
$this->addColumn('{{%user}}', 'auth_tf_enabled', $this->boolean()->defaultValue(false));
|
$this->addColumn('{{%user}}', 'auth_tf_enabled', $this->boolean()->defaultValue(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function safeDown()
|
public function safeDown()
|
||||||
|
|||||||
Reference in New Issue
Block a user