Compare commits

...
Sign in to create a new pull request.

1 commit
dev ... main

Author SHA1 Message Date
Snider
301fdb152a fix(migration): remove FK constraints on non-existent orders/subscriptions tables
Some checks are pending
CI / PHP 8.2 (push) Waiting to run
CI / PHP 8.3 (push) Waiting to run
CI / PHP 8.4 (push) Waiting to run
CI / Assets (push) Waiting to run
webhook_events referenced orders and subscriptions tables that don't
exist yet (billing module). Switched to plain unsignedBigInteger columns
with indexes — FKs can be added when the billing tables are created.

Co-Authored-By: Virgil <virgil@lethean.io>
2026-02-08 18:08:20 +00:00

View file

@ -36,8 +36,9 @@ return new class extends Migration
$table->unsignedSmallInteger('http_status_code')->nullable();
// Related entities (for linking/audit)
$table->foreignId('order_id')->nullable()->constrained('orders')->nullOnDelete();
$table->foreignId('subscription_id')->nullable()->constrained('subscriptions')->nullOnDelete();
// No FK constraint — orders/subscriptions tables are created by the billing module
$table->unsignedBigInteger('order_id')->nullable()->index();
$table->unsignedBigInteger('subscription_id')->nullable()->index();
// Timestamps
$table->timestamp('received_at');
@ -51,8 +52,6 @@ return new class extends Migration
// Query indexes
$table->index(['gateway', 'status', 'received_at']);
$table->index(['gateway', 'event_type']);
$table->index(['order_id']);
$table->index(['subscription_id']);
$table->index(['status', 'received_at']);
});
}