Possible YABs foreign keys migrations error fix
Possible YABs foreign keys migrations error fix
This commit is contained in:
parent
20058cb9c9
commit
59b3138dfb
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration
|
||||||
|
@ -9,13 +10,17 @@ return new class extends Migration
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::table('disk_speed', function (Blueprint $table) {
|
Schema::table('disk_speed', function (Blueprint $table) {
|
||||||
|
if (env('DB_CONNECTION') !== 'sqlite') {
|
||||||
$table->dropForeign('ds_fk_yabs');
|
$table->dropForeign('ds_fk_yabs');
|
||||||
|
}
|
||||||
|
|
||||||
$table->foreign('id', 'ds_fk_yabs')->references('id')->on('yabs')->onDelete('cascade');
|
$table->foreign('id', 'ds_fk_yabs')->references('id')->on('yabs')->onDelete('cascade');
|
||||||
});
|
});
|
||||||
|
|
||||||
Schema::table('network_speed', function (Blueprint $table) {
|
Schema::table('network_speed', function (Blueprint $table) {
|
||||||
|
if (env('DB_CONNECTION') !== 'sqlite') {
|
||||||
$table->dropForeign('ns_fk_yabs');
|
$table->dropForeign('ns_fk_yabs');
|
||||||
|
}
|
||||||
|
|
||||||
$table->foreign('id', 'ns_fk_yabs')->references('id')->on('yabs')->onDelete('cascade');
|
$table->foreign('id', 'ns_fk_yabs')->references('id')->on('yabs')->onDelete('cascade');
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,12 +4,13 @@ use Illuminate\Database\Migrations\Migration;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class extends Migration
|
return new class extends Migration {
|
||||||
{
|
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
Schema::table('yabs', function (Blueprint $table) {
|
Schema::table('yabs', function (Blueprint $table) {
|
||||||
|
if (env('DB_CONNECTION') !== 'sqlite') {
|
||||||
$table->dropForeign('yabs_fk_servers');
|
$table->dropForeign('yabs_fk_servers');
|
||||||
|
}
|
||||||
|
|
||||||
$table->foreign('server_id', 'yabs_fk_servers')->references('id')->on('servers')->onDelete('cascade');
|
$table->foreign('server_id', 'yabs_fk_servers')->references('id')->on('servers')->onDelete('cascade');
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user