diff --git a/backend/migrations/0001_init.sql b/backend/migrations/0001_init.sql index 8fca259..7d78943 100644 --- a/backend/migrations/0001_init.sql +++ b/backend/migrations/0001_init.sql @@ -42,7 +42,6 @@ CREATE TABLE IF NOT EXISTS relay ( blossom_enabled INTEGER NOT NULL DEFAULT 0, livekit_enabled INTEGER NOT NULL DEFAULT 0, push_enabled INTEGER NOT NULL DEFAULT 1, - created_at INTEGER NOT NULL, FOREIGN KEY (tenant_pubkey) REFERENCES tenant(pubkey) ); @@ -115,8 +114,6 @@ CREATE INDEX IF NOT EXISTS idx_activity_unbilled ON activity (tenant_pubkey, cre CREATE INDEX IF NOT EXISTS idx_relay_tenant_pubkey ON relay (tenant_pubkey); -CREATE INDEX IF NOT EXISTS idx_relay_created ON relay (created_at); - CREATE INDEX IF NOT EXISTS idx_invoice_tenant_created ON invoice (tenant_pubkey, created_at); -- Dunning scans a tenant's still-open invoices oldest-first to retry payment. diff --git a/backend/migrations/0002_created_at.sql b/backend/migrations/0002_created_at.sql new file mode 100644 index 0000000..5f99fa1 --- /dev/null +++ b/backend/migrations/0002_created_at.sql @@ -0,0 +1,3 @@ +ALTER TABLE relay ADD COLUMN created_at INTEGER NOT NULL DEFAULT 0; + +CREATE INDEX IF NOT EXISTS idx_relay_created ON relay (created_at);