osb/database/migrations/2022_08_19_133535_fix_siteid.php

53 lines
988 B
PHP
Raw Normal View History

2022-08-19 03:52:16 +00:00
<?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()
{
foreach ([
'checkouts',
'costs',
'domain_registrars',
'product_broadband',
'product_email',
'product_generic',
'product_host',
'product_ssl',
'products',
'provider_oauth',
'supplier_broadband',
'supplier_domain',
'supplier_email',
'supplier_generic',
'supplier_host',
'supplier_host_servers',
'supplier_ssl',
] as $table)
{
Schema::table($table, function (Blueprint $table) {
$table->dropForeign(['site_id']);
$table->foreign(['site_id'])->references(['site_id'])->on('sites');
});
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
abort(500,'cant go back');
}
};