diff --git a/database/migrations/2026_02_10_212218_update_client_id_foreign_on_accounts_table.php b/database/migrations/2026_02_10_212218_update_client_id_foreign_on_accounts_table.php new file mode 100644 index 0000000..540da83 --- /dev/null +++ b/database/migrations/2026_02_10_212218_update_client_id_foreign_on_accounts_table.php @@ -0,0 +1,36 @@ +dropForeign(['client_id']); + $table->foreign('client_id') + ->references('id') + ->on('clients') + ->cascadeOnDelete(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('accounts', function (Blueprint $table) { + $table->dropForeign(['client_id']); + $table->foreign('client_id') + ->references('id') + ->on('clients') + ->nullOnDelete(); // Since it is nullable + }); + } +}; diff --git a/database/migrations/2026_02_10_212331_update_foreign_keys_on_transmittals_table.php b/database/migrations/2026_02_10_212331_update_foreign_keys_on_transmittals_table.php new file mode 100644 index 0000000..abac2dd --- /dev/null +++ b/database/migrations/2026_02_10_212331_update_foreign_keys_on_transmittals_table.php @@ -0,0 +1,48 @@ +dropForeign(['client_id']); + $table->dropForeign(['branch_id']); + + $table->foreign('client_id') + ->references('id') + ->on('clients') + ->cascadeOnDelete(); + + $table->foreign('branch_id') + ->references('id') + ->on('branches') + ->cascadeOnDelete(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('transmittals', function (Blueprint $table) { + $table->dropForeign(['client_id']); + $table->dropForeign(['branch_id']); + + $table->foreign('client_id') + ->references('id') + ->on('clients'); + + $table->foreign('branch_id') + ->references('id') + ->on('branches'); + }); + } +};