@@ -25,24 +25,33 @@ public function up(): void
2525 $ control ->measures ()->sync ([$ control ->measure_id ]);
2626 }
2727
28- if (DB ::getDriverName () !== 'pgsql ' )
29- Schema::table ('controls ' , function (Blueprint $ table ) {
30- $ table ->dropForeign (['controls_domain_id_foreign ' ]);
31- $ table ->dropForeign (['controls_measure_id_foreign ' ]);
32- });
28+ if (DB ::getDriverName () !== 'pgsql ' ) {
29+ if (DB ::getDriverName () == 'mysql ' )
30+ Schema::table ('controls ' , function (Blueprint $ table ) {
31+ $ table ->dropForeign (['domain_id ' ]);
32+ $ table ->dropForeign (['measure_id ' ]);
33+ });
34+ else
35+ Schema::table ('controls ' , function (Blueprint $ table ) {
36+ $ table ->dropForeign (['controls_domain_id_foreign ' ]);
37+ $ table ->dropForeign (['controls_measure_id_foreign ' ]);
38+ });
39+ }
3340
34- if (DB ::getDriverName () === 'sqlite ' )
41+ if (DB ::getDriverName () === 'sqlite ' ) {
3542 // Could not drop column with sqlite
3643 Schema::table ('controls ' , function (Blueprint $ table ) {
3744 $ table ->integer ('domain_id ' )->nullable ()->change ();
3845 $ table ->integer ('measure_id ' )->nullable ()->change ();
39- });
46+ });
47+ }
4048 else
4149 // Drop columns
4250 Schema::table ('controls ' , function (Blueprint $ table ) {
4351 $ table ->dropColumn (['domain_id ' ]);
4452 $ table ->dropColumn (['measure_id ' ]);
45- });
53+ });
54+
4655 }
4756
4857 /**
0 commit comments