Added foreign keys
Added foreign keys to some tables
This commit is contained in:
parent
ecc9a61069
commit
06a3d71222
|
@ -21,9 +21,9 @@ class CreateServersTable extends Migration
|
||||||
$table->string('ns1')->nullable()->default(null);
|
$table->string('ns1')->nullable()->default(null);
|
||||||
$table->string('ns2')->nullable()->default(null);
|
$table->string('ns2')->nullable()->default(null);
|
||||||
$table->tinyInteger('server_type')->default(1);
|
$table->tinyInteger('server_type')->default(1);
|
||||||
$table->integer('os_id')->default(0);
|
$table->unsignedBigInteger('os_id')->default(0);
|
||||||
$table->integer('provider_id')->default(9999);
|
$table->unsignedBigInteger('provider_id')->default(9999);
|
||||||
$table->integer('location_id')->default(9999);
|
$table->unsignedBigInteger('location_id')->default(9999);
|
||||||
$table->integer('ssh')->nullable()->default(22);
|
$table->integer('ssh')->nullable()->default(22);
|
||||||
$table->integer('bandwidth')->nullable();
|
$table->integer('bandwidth')->nullable();
|
||||||
$table->integer('ram')->default(1024);
|
$table->integer('ram')->default(1024);
|
||||||
|
|
|
@ -21,7 +21,7 @@ class CreateDomainsTable extends Migration
|
||||||
$table->string('ns1')->nullable();
|
$table->string('ns1')->nullable();
|
||||||
$table->string('ns2')->nullable();
|
$table->string('ns2')->nullable();
|
||||||
$table->string('ns3')->nullable();
|
$table->string('ns3')->nullable();
|
||||||
$table->integer('provider_id')->default(9999);
|
$table->unsignedBigInteger('provider_id')->default(9999);
|
||||||
$table->date('owned_since')->nullable();
|
$table->date('owned_since')->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,8 +18,8 @@ class CreateSharedsTable extends Migration
|
||||||
$table->tinyInteger('active')->default(1);
|
$table->tinyInteger('active')->default(1);
|
||||||
$table->string('main_domain');
|
$table->string('main_domain');
|
||||||
$table->string('shared_type')->nullable();
|
$table->string('shared_type')->nullable();
|
||||||
$table->integer('provider_id')->default(9999);
|
$table->unsignedBigInteger('provider_id')->default(9999);
|
||||||
$table->integer('location_id')->default(9999);
|
$table->unsignedBigInteger('location_id')->default(9999);
|
||||||
$table->integer('bandwidth')->nullable();
|
$table->integer('bandwidth')->nullable();
|
||||||
$table->integer('disk')->default(10);
|
$table->integer('disk')->default(10);
|
||||||
$table->char('disk_type', 2)->default('GB');
|
$table->char('disk_type', 2)->default('GB');
|
||||||
|
|
|
@ -19,8 +19,8 @@ class CreateResellersTable extends Migration
|
||||||
$table->string('main_domain');
|
$table->string('main_domain');
|
||||||
$table->integer('accounts')->default(1);
|
$table->integer('accounts')->default(1);
|
||||||
$table->string('reseller_type')->nullable();
|
$table->string('reseller_type')->nullable();
|
||||||
$table->integer('provider_id')->default(9999);
|
$table->unsignedBigInteger('provider_id')->default(9999);
|
||||||
$table->integer('location_id')->default(9999);
|
$table->unsignedBigInteger('location_id')->default(9999);
|
||||||
$table->integer('bandwidth')->nullable();
|
$table->integer('bandwidth')->nullable();
|
||||||
$table->integer('disk')->default(10);
|
$table->integer('disk')->default(10);
|
||||||
$table->char('disk_type', 2)->default('GB');
|
$table->char('disk_type', 2)->default('GB');
|
||||||
|
|
55
database/migrations/2022_05_09_114227_add_foreign_keys.php
Normal file
55
database/migrations/2022_05_09_114227_add_foreign_keys.php
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddForeignKeys extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('servers', function (Blueprint $table) {
|
||||||
|
$table->foreign('location_id','servers_fk_location')->references('id')->on('locations');
|
||||||
|
$table->foreign('provider_id','servers_fk_provider')->references('id')->on('providers');
|
||||||
|
$table->foreign('os_id','servers_fk_os')->references('id')->on('os');
|
||||||
|
$table->foreign('id', 'servers_fk_pricing')->references('service_id')->on('pricings')->onDelete('cascade');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('shared_hosting', function (Blueprint $table) {
|
||||||
|
$table->foreign('location_id','shared_fk_location')->references('id')->on('locations');
|
||||||
|
$table->foreign('provider_id','shared_fk_provider')->references('id')->on('providers');
|
||||||
|
$table->foreign('id', 'shared_fk_pricing')->references('service_id')->on('pricings')->onDelete('cascade');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('reseller_hosting', function (Blueprint $table) {
|
||||||
|
$table->foreign('location_id','reseller_fk_location')->references('id')->on('locations');
|
||||||
|
$table->foreign('provider_id','reseller_fk_provider')->references('id')->on('providers');
|
||||||
|
$table->foreign('id', 'reseller_fk_pricing')->references('service_id')->on('pricings')->onDelete('cascade');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('domains', function (Blueprint $table) {
|
||||||
|
$table->foreign('provider_id','domains_fk_provider')->references('id')->on('providers');
|
||||||
|
$table->foreign('id', 'domains_fk_pricing')->references('service_id')->on('pricings')->onDelete('cascade');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('misc_services', function (Blueprint $table) {
|
||||||
|
$table->foreign('id', 'misc_fk_pricing')->references('service_id')->on('pricings')->onDelete('cascade');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('yabs', function (Blueprint $table) {
|
||||||
|
$table->foreign('server_id', 'yabs_fk_servers')->references('id')->on('servers');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('disk_speed', function (Blueprint $table) {
|
||||||
|
$table->foreign('id', 'ds_fk_yabs')->references('id')->on('yabs');
|
||||||
|
});
|
||||||
|
|
||||||
|
Schema::table('network_speed', function (Blueprint $table) {
|
||||||
|
$table->foreign('id', 'ns_fk_yabs')->references('id')->on('yabs');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user