Rename account_provider
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('account_provider', function (Blueprint $table) {
|
||||
$table->dropForeign(['account_id', 'site_id']);
|
||||
$table->dropForeign(['provider_oauth_id', 'site_id']);
|
||||
$table->dropIndex('account_provider_account_id_site_id_foreign');
|
||||
$table->dropIndex('account_provider_provider_oauth_id_site_id_foreign');
|
||||
});
|
||||
DB::statement('ALTER TABLE account_provider RENAME TO account__provider');
|
||||
Schema::table('account__provider', function (Blueprint $table) {
|
||||
$table->foreign(['account_id', 'site_id'])->references(['id', 'site_id'])->on('accounts');
|
||||
$table->foreign(['provider_oauth_id', 'site_id'])->references(['id', 'site_id'])->on('provider_oauth');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
abort(500,'cant go back');
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user