mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-05-30 06:49:11 +02:00
Fix #18 : Install using MySQL causes exception
This commit is contained in:
parent
b80f7b6b3b
commit
2f728a7980
@ -13,14 +13,14 @@ class AddGroupIdColumnToTwofaccountsTable extends Migration
|
|||||||
*/
|
*/
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::enableForeignKeyConstraints();
|
|
||||||
|
|
||||||
Schema::table('twofaccounts', function (Blueprint $table) {
|
Schema::table('twofaccounts', function (Blueprint $table) {
|
||||||
$table->foreignId('group_id')
|
$table->unsignedInteger('group_id')
|
||||||
->after('id')
|
->after('id')
|
||||||
->nullable()
|
->nullable()
|
||||||
->constrained()
|
->constrained()
|
||||||
->onDelete('set null');
|
->onDelete('set null');
|
||||||
|
|
||||||
|
$table->foreign('group_id')->references('id')->on('groups');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,11 +31,16 @@ class AddGroupIdColumnToTwofaccountsTable extends Migration
|
|||||||
*/
|
*/
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
Schema::disableForeignKeyConstraints();
|
Schema::table('twofaccounts', function (Blueprint $table) {
|
||||||
|
// cannot drop foreign keys in SQLite:
|
||||||
|
if ('sqlite' !== config('database.default')) {
|
||||||
|
$table->dropForeign(['group_id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
Schema::table('twofaccounts', function (Blueprint $table) {
|
Schema::table('twofaccounts', function (Blueprint $table) {
|
||||||
//$table->dropForeign('group_id');
|
|
||||||
$table->dropColumn('group_id');
|
$table->dropColumn('group_id');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user