From 7be2dcaacf17372ecfb5aed82a14aa6d0d8afe97 Mon Sep 17 00:00:00 2001 From: Fady Mondy Date: Mon, 15 Jul 2024 14:48:31 +0300 Subject: [PATCH] chnage locations table order --- ...21_04_14_141222_create_locations_table.php | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/database/migrations/2021_04_14_141222_create_locations_table.php b/database/migrations/2021_04_14_141222_create_locations_table.php index de8ea3c..4c1d1d0 100644 --- a/database/migrations/2021_04_14_141222_create_locations_table.php +++ b/database/migrations/2021_04_14_141222_create_locations_table.php @@ -11,30 +11,32 @@ */ public function up(): void { - Schema::create('locations', function (Blueprint $table) { - $table->id(); + if(!Schema::hasTable('locations')){ + Schema::create('locations', function (Blueprint $table) { + $table->id(); - //Link To Table - $table->string('model_type')->nullable(); - $table->unsignedInteger('model_id')->nullable(); + //Link To Table + $table->string('model_type')->nullable(); + $table->unsignedInteger('model_id')->nullable(); - $table->string('street'); - $table->foreignId('area_id')->nullable()->constrained('areas')->onDelete('cascade'); - $table->foreignId('city_id')->nullable()->constrained('cities')->onDelete('cascade'); - $table->foreignId('country_id')->nullable()->constrained('countries')->onDelete('cascade'); - $table->unsignedInteger('home_number')->nullable(); - $table->unsignedInteger('flat_number')->nullable(); - $table->unsignedInteger('floor_number')->nullable(); - $table->string('mark')->nullable(); - $table->text('map_url')->nullable(); - $table->string('note')->nullable(); - $table->string('lat')->nullable(); - $table->string('lng')->nullable(); - $table->string('zip')->nullable(); - $table->boolean('is_main')->default(0)->nullable(); - $table->timestamps(); - }); + $table->string('street'); + $table->foreignId('area_id')->nullable()->constrained('areas')->onDelete('cascade'); + $table->foreignId('city_id')->nullable()->constrained('cities')->onDelete('cascade'); + $table->foreignId('country_id')->nullable()->constrained('countries')->onDelete('cascade'); + $table->unsignedInteger('home_number')->nullable(); + $table->unsignedInteger('flat_number')->nullable(); + $table->unsignedInteger('floor_number')->nullable(); + $table->string('mark')->nullable(); + $table->text('map_url')->nullable(); + $table->string('note')->nullable(); + $table->string('lat')->nullable(); + $table->string('lng')->nullable(); + $table->string('zip')->nullable(); + $table->boolean('is_main')->default(0)->nullable(); + $table->timestamps(); + }); + } } /** @@ -42,6 +44,6 @@ public function up(): void */ public function down(): void { - Schema::dropIfExists('addresses'); + Schema::dropIfExists('locations'); } };