From 52a5c2427cca083507267142571e620269e0afe9 Mon Sep 17 00:00:00 2001 From: cp6 Date: Sat, 5 Mar 2022 11:05:30 +1100 Subject: [PATCH] Updated migrations for primary keys Updated migrations for primary keys --- .../migrations/2021_02_10_122904_create_servers_table.php | 2 +- .../migrations/2022_02_01_233932_create_domains_table.php | 2 +- .../migrations/2022_02_03_040140_create_shareds_table.php | 2 +- .../migrations/2022_02_03_040152_create_resellers_table.php | 2 +- database/migrations/2022_02_05_104355_create_yabs_table.php | 3 ++- .../migrations/2022_02_05_104551_create_disk_speed_table.php | 2 +- .../2022_02_05_104919_create_network_speed_table.php | 1 + .../migrations/2022_02_09_032438_create_settings_table.php | 2 +- database/migrations/2022_02_11_022150_create_miscs_table.php | 2 +- database/migrations/2022_02_21_001233_create_ips_table.php | 4 ++-- 10 files changed, 12 insertions(+), 10 deletions(-) diff --git a/database/migrations/2021_02_10_122904_create_servers_table.php b/database/migrations/2021_02_10_122904_create_servers_table.php index 65b26c4..85f7617 100644 --- a/database/migrations/2021_02_10_122904_create_servers_table.php +++ b/database/migrations/2021_02_10_122904_create_servers_table.php @@ -14,7 +14,7 @@ class CreateServersTable extends Migration public function up() { Schema::create('servers', function (Blueprint $table) { - $table->char('id', 8)->unique()->default(null); + $table->char('id', 8)->primary()->default(null); $table->tinyInteger('active')->default(1); $table->tinyInteger('show_public')->default(0); $table->string('hostname'); diff --git a/database/migrations/2022_02_01_233932_create_domains_table.php b/database/migrations/2022_02_01_233932_create_domains_table.php index 0537779..a0841fe 100644 --- a/database/migrations/2022_02_01_233932_create_domains_table.php +++ b/database/migrations/2022_02_01_233932_create_domains_table.php @@ -14,7 +14,7 @@ class CreateDomainsTable extends Migration public function up() { Schema::create('domains', function (Blueprint $table) { - $table->char('id', 8)->unique()->default(null); + $table->char('id', 8)->primary()->default(null); $table->string('domain'); $table->tinyInteger('active')->default(1); $table->string('extension'); diff --git a/database/migrations/2022_02_03_040140_create_shareds_table.php b/database/migrations/2022_02_03_040140_create_shareds_table.php index c30457b..30dd172 100644 --- a/database/migrations/2022_02_03_040140_create_shareds_table.php +++ b/database/migrations/2022_02_03_040140_create_shareds_table.php @@ -14,7 +14,7 @@ class CreateSharedsTable extends Migration public function up() { Schema::create('shared_hosting', function (Blueprint $table) { - $table->char('id', 8)->unique(); + $table->char('id', 8)->primary(); $table->tinyInteger('active')->default(1); $table->string('main_domain'); $table->string('shared_type')->nullable(); diff --git a/database/migrations/2022_02_03_040152_create_resellers_table.php b/database/migrations/2022_02_03_040152_create_resellers_table.php index bbaec5e..e802712 100644 --- a/database/migrations/2022_02_03_040152_create_resellers_table.php +++ b/database/migrations/2022_02_03_040152_create_resellers_table.php @@ -14,7 +14,7 @@ class CreateResellersTable extends Migration public function up() { Schema::create('reseller_hosting', function (Blueprint $table) { - $table->char('id', 8)->unique(); + $table->char('id', 8)->primary(); $table->tinyInteger('active')->default(1); $table->string('main_domain'); $table->integer('accounts')->default(1); diff --git a/database/migrations/2022_02_05_104355_create_yabs_table.php b/database/migrations/2022_02_05_104355_create_yabs_table.php index e51dc21..9468ea8 100644 --- a/database/migrations/2022_02_05_104355_create_yabs_table.php +++ b/database/migrations/2022_02_05_104355_create_yabs_table.php @@ -13,7 +13,7 @@ class CreateYabsTable extends Migration public function up() { Schema::create('yabs', function (Blueprint $table) { - $table->char('id', 8)->unique(); + $table->char('id', 8)->primary(); $table->char('server_id', 8); $table->boolean('has_ipv6')->default(false); $table->boolean('aes')->default(false); @@ -32,6 +32,7 @@ class CreateYabsTable extends Migration $table->integer('gb5_multi'); $table->integer('gb5_id'); $table->timestamps(); + $table->unique(['id','server_id'], 'uni'); }); } diff --git a/database/migrations/2022_02_05_104551_create_disk_speed_table.php b/database/migrations/2022_02_05_104551_create_disk_speed_table.php index fccaa4b..6c77254 100644 --- a/database/migrations/2022_02_05_104551_create_disk_speed_table.php +++ b/database/migrations/2022_02_05_104551_create_disk_speed_table.php @@ -12,7 +12,7 @@ class CreateDiskSpeedTable extends Migration public function up() { Schema::create('disk_speed', function (Blueprint $table) { - $table->char('id', 8)->unique(); + $table->char('id', 8)->primary(); $table->char('server_id',8); $table->float('d_4k'); $table->char('d_4k_type',4); diff --git a/database/migrations/2022_02_05_104919_create_network_speed_table.php b/database/migrations/2022_02_05_104919_create_network_speed_table.php index 73f2816..c829743 100644 --- a/database/migrations/2022_02_05_104919_create_network_speed_table.php +++ b/database/migrations/2022_02_05_104919_create_network_speed_table.php @@ -22,6 +22,7 @@ class CreateNetworkSpeedTable extends Migration $table->char('receive_type', 4); $table->float('receive_as_mbps'); $table->timestamps(); + $table->unique(['id','server_id'], 'uni'); }); } diff --git a/database/migrations/2022_02_09_032438_create_settings_table.php b/database/migrations/2022_02_09_032438_create_settings_table.php index c9c219d..6d89a24 100644 --- a/database/migrations/2022_02_09_032438_create_settings_table.php +++ b/database/migrations/2022_02_09_032438_create_settings_table.php @@ -14,7 +14,7 @@ class CreateSettingsTable extends Migration public function up() { Schema::create('settings', function (Blueprint $table) { - $table->integer('id')->default(1)->unique(); + $table->integer('id')->default(1)->primary(); $table->boolean('show_versions_footer')->default(true); $table->boolean('show_servers_public')->default(false); $table->boolean('show_server_value_ip')->default(false); diff --git a/database/migrations/2022_02_11_022150_create_miscs_table.php b/database/migrations/2022_02_11_022150_create_miscs_table.php index 094da8e..ecc3a96 100644 --- a/database/migrations/2022_02_11_022150_create_miscs_table.php +++ b/database/migrations/2022_02_11_022150_create_miscs_table.php @@ -14,7 +14,7 @@ class CreateMiscsTable extends Migration public function up() { Schema::create('misc_services', function (Blueprint $table) { - $table->char('id', 8)->unique(); + $table->char('id', 8)->primary(); $table->string('name'); $table->tinyInteger('active')->default(1); $table->date('owned_since')->nullable(); diff --git a/database/migrations/2022_02_21_001233_create_ips_table.php b/database/migrations/2022_02_21_001233_create_ips_table.php index c0599c9..42cc93b 100644 --- a/database/migrations/2022_02_21_001233_create_ips_table.php +++ b/database/migrations/2022_02_21_001233_create_ips_table.php @@ -9,8 +9,8 @@ class CreateIPsTable extends Migration public function up() { Schema::create('ips', function (Blueprint $table) { - $table->char('id', 8)->unique(); - $table->char('service_id', 8)->unique(); + $table->char('id', 8)->primary(); + $table->char('service_id', 8); $table->string('address'); $table->tinyInteger('is_ipv4')->default(1); $table->tinyInteger('active')->default(1);