fix: remove FK constraints to non-existent orders/refunds tables
Credit notes can exist independently of orders. Foreign keys will be added when orders and refunds modules are implemented. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
8b0eac7bef
commit
eca97466b8
1 changed files with 4 additions and 3 deletions
|
|
@ -24,8 +24,9 @@ return new class extends Migration
|
||||||
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
|
$table->foreignId('user_id')->constrained('users')->cascadeOnDelete();
|
||||||
|
|
||||||
// Source references (optional - not all credits come from orders/refunds)
|
// Source references (optional - not all credits come from orders/refunds)
|
||||||
$table->foreignId('order_id')->nullable()->constrained('orders')->nullOnDelete();
|
// Foreign keys added when orders/refunds tables exist
|
||||||
$table->foreignId('refund_id')->nullable()->constrained('refunds')->nullOnDelete();
|
$table->unsignedBigInteger('order_id')->nullable();
|
||||||
|
$table->unsignedBigInteger('refund_id')->nullable();
|
||||||
|
|
||||||
// Credit details
|
// Credit details
|
||||||
$table->string('reference_number', 32)->unique();
|
$table->string('reference_number', 32)->unique();
|
||||||
|
|
@ -39,7 +40,7 @@ return new class extends Migration
|
||||||
|
|
||||||
// Tracking
|
// Tracking
|
||||||
$table->decimal('amount_used', 10, 2)->default(0);
|
$table->decimal('amount_used', 10, 2)->default(0);
|
||||||
$table->foreignId('applied_to_order_id')->nullable()->constrained('orders')->nullOnDelete();
|
$table->unsignedBigInteger('applied_to_order_id')->nullable();
|
||||||
$table->timestamp('issued_at')->nullable();
|
$table->timestamp('issued_at')->nullable();
|
||||||
$table->timestamp('applied_at')->nullable();
|
$table->timestamp('applied_at')->nullable();
|
||||||
$table->timestamp('voided_at')->nullable();
|
$table->timestamp('voided_at')->nullable();
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue