Updated migrations for primary keys

Updated migrations for primary keys
This commit is contained in:
cp6 2022-03-05 11:05:30 +11:00
parent d4f2b57b02
commit 52a5c2427c
10 changed files with 12 additions and 10 deletions

View File

@ -14,7 +14,7 @@ class CreateServersTable extends Migration
public function up() public function up()
{ {
Schema::create('servers', function (Blueprint $table) { 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('active')->default(1);
$table->tinyInteger('show_public')->default(0); $table->tinyInteger('show_public')->default(0);
$table->string('hostname'); $table->string('hostname');

View File

@ -14,7 +14,7 @@ class CreateDomainsTable extends Migration
public function up() public function up()
{ {
Schema::create('domains', function (Blueprint $table) { Schema::create('domains', function (Blueprint $table) {
$table->char('id', 8)->unique()->default(null); $table->char('id', 8)->primary()->default(null);
$table->string('domain'); $table->string('domain');
$table->tinyInteger('active')->default(1); $table->tinyInteger('active')->default(1);
$table->string('extension'); $table->string('extension');

View File

@ -14,7 +14,7 @@ class CreateSharedsTable extends Migration
public function up() public function up()
{ {
Schema::create('shared_hosting', function (Blueprint $table) { Schema::create('shared_hosting', function (Blueprint $table) {
$table->char('id', 8)->unique(); $table->char('id', 8)->primary();
$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();

View File

@ -14,7 +14,7 @@ class CreateResellersTable extends Migration
public function up() public function up()
{ {
Schema::create('reseller_hosting', function (Blueprint $table) { Schema::create('reseller_hosting', function (Blueprint $table) {
$table->char('id', 8)->unique(); $table->char('id', 8)->primary();
$table->tinyInteger('active')->default(1); $table->tinyInteger('active')->default(1);
$table->string('main_domain'); $table->string('main_domain');
$table->integer('accounts')->default(1); $table->integer('accounts')->default(1);

View File

@ -13,7 +13,7 @@ class CreateYabsTable extends Migration
public function up() public function up()
{ {
Schema::create('yabs', function (Blueprint $table) { Schema::create('yabs', function (Blueprint $table) {
$table->char('id', 8)->unique(); $table->char('id', 8)->primary();
$table->char('server_id', 8); $table->char('server_id', 8);
$table->boolean('has_ipv6')->default(false); $table->boolean('has_ipv6')->default(false);
$table->boolean('aes')->default(false); $table->boolean('aes')->default(false);
@ -32,6 +32,7 @@ class CreateYabsTable extends Migration
$table->integer('gb5_multi'); $table->integer('gb5_multi');
$table->integer('gb5_id'); $table->integer('gb5_id');
$table->timestamps(); $table->timestamps();
$table->unique(['id','server_id'], 'uni');
}); });
} }

View File

@ -12,7 +12,7 @@ class CreateDiskSpeedTable extends Migration
public function up() public function up()
{ {
Schema::create('disk_speed', function (Blueprint $table) { Schema::create('disk_speed', function (Blueprint $table) {
$table->char('id', 8)->unique(); $table->char('id', 8)->primary();
$table->char('server_id',8); $table->char('server_id',8);
$table->float('d_4k'); $table->float('d_4k');
$table->char('d_4k_type',4); $table->char('d_4k_type',4);

View File

@ -22,6 +22,7 @@ class CreateNetworkSpeedTable extends Migration
$table->char('receive_type', 4); $table->char('receive_type', 4);
$table->float('receive_as_mbps'); $table->float('receive_as_mbps');
$table->timestamps(); $table->timestamps();
$table->unique(['id','server_id'], 'uni');
}); });
} }

View File

@ -14,7 +14,7 @@ class CreateSettingsTable extends Migration
public function up() public function up()
{ {
Schema::create('settings', function (Blueprint $table) { 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_versions_footer')->default(true);
$table->boolean('show_servers_public')->default(false); $table->boolean('show_servers_public')->default(false);
$table->boolean('show_server_value_ip')->default(false); $table->boolean('show_server_value_ip')->default(false);

View File

@ -14,7 +14,7 @@ class CreateMiscsTable extends Migration
public function up() public function up()
{ {
Schema::create('misc_services', function (Blueprint $table) { Schema::create('misc_services', function (Blueprint $table) {
$table->char('id', 8)->unique(); $table->char('id', 8)->primary();
$table->string('name'); $table->string('name');
$table->tinyInteger('active')->default(1); $table->tinyInteger('active')->default(1);
$table->date('owned_since')->nullable(); $table->date('owned_since')->nullable();

View File

@ -9,8 +9,8 @@ class CreateIPsTable extends Migration
public function up() public function up()
{ {
Schema::create('ips', function (Blueprint $table) { Schema::create('ips', function (Blueprint $table) {
$table->char('id', 8)->unique(); $table->char('id', 8)->primary();
$table->char('service_id', 8)->unique(); $table->char('service_id', 8);
$table->string('address'); $table->string('address');
$table->tinyInteger('is_ipv4')->default(1); $table->tinyInteger('is_ipv4')->default(1);
$table->tinyInteger('active')->default(1); $table->tinyInteger('active')->default(1);