Merge pull request #171 from tsdogs/mssql

fix migration to work with SQL Server
This commit is contained in:
Antonio Ramirez
2018-05-02 17:37:40 +02:00
committed by GitHub
2 changed files with 4 additions and 2 deletions

View File

@ -21,7 +21,7 @@ class m000000_000002_create_profile_table extends Migration
$this->createTable(
'{{%profile}}',
[
'user_id' => $this->primaryKey(),
'user_id' => $this->integer()->notNull(),
'name' => $this->string(255),
'public_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)
);
$this->addPrimaryKey('{{%profile_pk}}','{{%profile}}','user_id');
$restrict = MigrationHelper::isMicrosoftSQLServer($this->db->driverName) ? 'NO ACTION' : 'RESTRICT';
$this->addForeignKey('fk_profile_user', '{{%profile}}', 'user_id', '{{%user}}', 'id', 'CASCADE', $restrict);

View File

@ -18,7 +18,7 @@ class m000000_000006_add_two_factor_fields extends Migration
public function safeUp()
{
$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()