Persist daily currency rate snapshots
Build and deploy Docker image / build (push) Successful in 58s
Build and deploy Docker image / build (push) Successful in 58s
This commit is contained in:
@@ -69,3 +69,42 @@ model Product {
|
||||
@@index([categoryName, isActive])
|
||||
@@map("exchange_products")
|
||||
}
|
||||
|
||||
model CurrencyRateSnapshot {
|
||||
id Int @id @default(autoincrement())
|
||||
uuid String @unique @default(uuid())
|
||||
baseCurrency String @map("base_currency") @db.VarChar(3)
|
||||
effectiveDate DateTime @map("effective_date") @db.Date
|
||||
quotedAt DateTime @map("quoted_at")
|
||||
nextUpdateAt DateTime? @map("next_update_at")
|
||||
provider String @db.VarChar(255)
|
||||
documentation String @db.VarChar(500)
|
||||
termsOfUse String @map("terms_of_use") @db.VarChar(500)
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
rates CurrencyRate[]
|
||||
|
||||
@@unique([baseCurrency, effectiveDate])
|
||||
@@index([effectiveDate])
|
||||
@@map("exchange_currency_rate_snapshots")
|
||||
}
|
||||
|
||||
model CurrencyRate {
|
||||
id Int @id @default(autoincrement())
|
||||
snapshotId Int @map("snapshot_id")
|
||||
snapshot CurrencyRateSnapshot @relation(fields: [snapshotId], references: [id], onDelete: Cascade)
|
||||
quoteCurrency String @map("quote_currency") @db.VarChar(3)
|
||||
rate Decimal @db.Decimal(24, 10)
|
||||
|
||||
@@unique([snapshotId, quoteCurrency])
|
||||
@@index([quoteCurrency])
|
||||
@@map("exchange_currency_rates")
|
||||
}
|
||||
|
||||
model PricingCurrencyPolicy {
|
||||
countryCode String @id @map("country_code") @db.VarChar(2)
|
||||
currencyCode String @map("currency_code") @db.VarChar(3)
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@index([currencyCode])
|
||||
@@map("exchange_pricing_currency_policies")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user