fix(referral): drop FKs to nonexistent 'orders' + 'invoices' tables
The referral_commissions migration FK-referenced 'orders' and 'invoices' tables, but neither is ever created by any migration in the codebase. MariaDB silently accepted the FKs (checks disabled during migration), Postgres rejects strictly. Changed both columns to plain nullable unsignedBigInteger — same column shape, no FK constraint. Data still references orders/invoices by id via application logic. Proper FKs can be added in a follow-up migration once orders/invoices migrations land. Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
b51084b8db
commit
6d83c32114
1 changed files with 9 additions and 9 deletions
|
|
@ -136,15 +136,15 @@ return new class extends Migration
|
|||
->constrained('users')
|
||||
->cascadeOnDelete();
|
||||
|
||||
$table->foreignId('order_id')
|
||||
->nullable()
|
||||
->constrained('orders')
|
||||
->nullOnDelete();
|
||||
|
||||
$table->foreignId('invoice_id')
|
||||
->nullable()
|
||||
->constrained('invoices')
|
||||
->nullOnDelete();
|
||||
// NOTE: `orders` and `invoices` tables are not created by any
|
||||
// migration in the current codebase. MariaDB silently accepted
|
||||
// FKs to nonexistent tables (FK checks disabled during the
|
||||
// migration), but Postgres rejects them. Keeping the columns
|
||||
// as plain nullable bigint so the schema deploys on both DBs;
|
||||
// FK constraints can be added in a follow-up migration once
|
||||
// the orders/invoices tables actually exist.
|
||||
$table->unsignedBigInteger('order_id')->nullable();
|
||||
$table->unsignedBigInteger('invoice_id')->nullable();
|
||||
|
||||
// Commission calculation
|
||||
$table->decimal('order_amount', 10, 2); // Net order amount (after tax/discounts)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue