diff --git a/database/migrations/2024_06_27_123923_add_control_measure_table.php b/database/migrations/2024_06_27_123923_add_control_measure_table.php index 5372e8ec..a96b8437 100644 --- a/database/migrations/2024_06_27_123923_add_control_measure_table.php +++ b/database/migrations/2024_06_27_123923_add_control_measure_table.php @@ -12,13 +12,6 @@ */ public function up(): void { - Schema::table('controls', function (Blueprint $table) { - $table->dropForeign('controls_domain_id_foreign'); - $table->dropForeign('controls_measure_id_foreign'); - $table->dropColumn('domain_id'); - $table->dropColumn('measure_id'); - }); - Schema::create('control_measure', function (Blueprint $table) { $table->integer('control_id')->unsigned(); $table->foreign('control_id')->references('id')->on('controls'); @@ -31,6 +24,13 @@ public function up(): void if (($control->measure_id !== null)&&($control->measure_id !== 0)) $control->measures()->sync([$control->measure_id]); } + + Schema::table('controls', function (Blueprint $table) { + $table->dropForeign('controls_domain_id_foreign'); + $table->dropForeign('controls_measure_id_foreign'); + $table->dropColumn('domain_id'); + $table->dropColumn('measure_id'); + }); } /**