Fix 43 add table options
This commit is contained in:
@ -11,6 +11,7 @@
|
||||
|
||||
namespace Da\User\Migration;
|
||||
|
||||
use Da\User\Helper\MigrationHelper;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m000000_000001_create_user_table extends Migration
|
||||
@ -32,7 +33,8 @@ class m000000_000001_create_user_table extends Migration
|
||||
'blocked_at' => $this->integer(),
|
||||
'updated_at' => $this->integer()->notNull(),
|
||||
'created_at' => $this->integer()->notNull(),
|
||||
]
|
||||
],
|
||||
MigrationHelper::resolveTableOptions($this->db->driverName)
|
||||
);
|
||||
|
||||
$this->createIndex('idx_user_username', '{{%user}}', 'username', true);
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
|
||||
namespace Da\User\Migration;
|
||||
|
||||
use Da\User\Helper\MigrationHelper;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m000000_000002_create_profile_table extends Migration
|
||||
@ -29,10 +30,13 @@ class m000000_000002_create_profile_table extends Migration
|
||||
'website' => $this->string(255),
|
||||
'timezone' => $this->string(40),
|
||||
'bio' => $this->text(),
|
||||
]
|
||||
],
|
||||
MigrationHelper::resolveTableOptions($this->db->driverName)
|
||||
);
|
||||
|
||||
$this->addForeignKey('fk_profile_user', '{{%profile}}', 'user_id', '{{%user}}', 'id', 'CASCADE', 'RESTRICT');
|
||||
$restrict = MigrationHelper::isMicrosoftSQLServer($this->db->driverName) ? 'NO ACTION' : 'RESTRICT';
|
||||
|
||||
$this->addForeignKey('fk_profile_user', '{{%profile}}', 'user_id', '{{%user}}', 'id', 'CASCADE', $restrict);
|
||||
}
|
||||
|
||||
public function down()
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
|
||||
namespace Da\User\Migration;
|
||||
|
||||
use Da\User\Helper\MigrationHelper;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m000000_000003_create_social_account_table extends Migration
|
||||
@ -29,7 +30,8 @@ class m000000_000003_create_social_account_table extends Migration
|
||||
'username' => $this->string(255),
|
||||
'data' => $this->text(),
|
||||
'created_at' => $this->integer(),
|
||||
]
|
||||
],
|
||||
MigrationHelper::resolveTableOptions($this->db->driverName)
|
||||
);
|
||||
|
||||
$this->createIndex(
|
||||
@ -48,7 +50,7 @@ class m000000_000003_create_social_account_table extends Migration
|
||||
'{{%user}}',
|
||||
'id',
|
||||
'CASCADE',
|
||||
'RESTRICT'
|
||||
(MigrationHelper::isMicrosoftSQLServer($this->db->driverName) ? 'NO ACTION' : 'RESTRICT')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
|
||||
namespace Da\User\Migration;
|
||||
|
||||
use Da\User\Helper\MigrationHelper;
|
||||
use yii\db\Migration;
|
||||
|
||||
class m000000_000004_create_token_table extends Migration
|
||||
@ -24,12 +25,15 @@ class m000000_000004_create_token_table extends Migration
|
||||
'code' => $this->string(32)->notNull(),
|
||||
'type' => $this->smallInteger(6)->notNull(),
|
||||
'created_at' => $this->integer()->notNull(),
|
||||
]
|
||||
],
|
||||
MigrationHelper::resolveTableOptions($this->db->driverName)
|
||||
);
|
||||
|
||||
$this->createIndex('idx_token_user_id_code_type', '{{%token}}', ['user_id', 'code', 'type'], true);
|
||||
|
||||
$this->addForeignKey('fk_token_user', '{{%token}}', 'user_id', '{{%user}}', 'id', 'CASCADE', 'RESTRICT');
|
||||
$restrict = MigrationHelper::isMicrosoftSQLServer($this->db->driverName) ? 'NO ACTION' : 'RESTRICT';
|
||||
|
||||
$this->addForeignKey('fk_token_user', '{{%token}}', 'user_id', '{{%user}}', 'id', 'CASCADE', $restrict);
|
||||
}
|
||||
|
||||
public function down()
|
||||
|
||||
Reference in New Issue
Block a user