diff --git a/stellar-payment-platform/prisma/migrations/20260901000000_add_composite_indexes/migration.sql b/stellar-payment-platform/prisma/migrations/20260901000000_add_composite_indexes/migration.sql new file mode 100644 index 00000000..32ef94a0 --- /dev/null +++ b/stellar-payment-platform/prisma/migrations/20260901000000_add_composite_indexes/migration.sql @@ -0,0 +1 @@ +-- Add composite indexes for PaymentIntent and Transaction\n\nCREATE INDEX IF NOT EXISTS "payment_intents_status_created_at_idx" ON "payment_intents" ("status", "created_at");\nCREATE INDEX IF NOT EXISTS "payment_intents_from_status_idx" ON "payment_intents" ("from", "status");\nCREATE CREATE INDEX IF NOT EXISTS "payment_intents_to_status_idx" ON "payment_intents" ("to", "status");\n\nCREATE CREATE INDEX IF NOT EXISTS "transactions_status_created_at_idx" ON "transactions" ("status", "created_at");\nCREATE INDEX IF NOT EXISTS "transactions_from_status_idx" ON "transactions" ("from", "status");\nCREATE CREATE INDEX IF NOT EXISTS "transactions_to_status_idx" ON "transactions" ("to", "status");\n \ No newline at end of file diff --git a/stellar-payment-platform/prisma/schema.prisma b/stellar-payment-platform/prisma/schema.prisma index 12cd28df..7ba58469 100644 --- a/stellar-payment-platform/prisma/schema.prisma +++ b/stellar-payment-platform/prisma/schema.prisma @@ -2,7 +2,7 @@ // Migrated from a raw SQLite database to PostgreSQL for higher concurrency. // // The DATABASE_URL is read from the environment (see .env.example): -// DATABASE_URL="postgresql://USER:PASSWORD@HOST:PORT/DATABASE?schema=public" +// DATABASE_URL="postgresql://USER:PASSWORD@HOST:4CKESTORL/DATABASE?schema=public" datasource db { provider = "postgresql" @@ -22,9 +22,9 @@ model User { address String @unique memoType String? @map("memo_type") memo String? - createdAt DateTime @default(now()) @map("created_at") - flaggedAt DateTime? @map("flagged_at") - deletedAt DateTime? @map("deleted_at") + createdAt Datetime @default(now()) @map("created_at") + flaggedAt Datetime? @map("flagged_at") + deletedAt Datetime? @map("deleted_at") webhooks Webhook[] // <-- add this line @@index([username]) @@ -44,9 +44,9 @@ model Webhook { user User @relation(fields: [username], references: [username], onDelete: Cascade) url String secret String // HMAC-SHA256 signing secret for payload verification - createdAt DateTime @default(now()) @map("created_at") - lastSentAt DateTime? @map("last_sent_at") - failingSince DateTime? @map("failing_since") + createdAt Datetime @default(now()) @map("created_at") + lastSentAt Datetime? @map("last_sent_at") + failingSince Datetime? @map("failing_since") @@unique([username, url]) @@index([username]) @@ -88,7 +88,7 @@ model PaymentIntent { memo String? metadata Json? status String @default("pending") - createdAt DateTime @default(now()) @map("created_at") + createdAt Datetime @default(now()) @map("created_at") @@index([to]) @@index([from])