fix(prisma): sync schema with DB
Add missing models: statements, transactions, expense_metadata, rule_apply_runs. Fixes pre-existing type errors on split_payments and my_share_percent which were caused by a stale generated client (regenerate with npx prisma generate).
This commit is contained in:
@@ -105,3 +105,91 @@ model budgets {
|
||||
|
||||
@@unique([owner_id, category, month])
|
||||
}
|
||||
|
||||
model statements {
|
||||
id Int @id @default(autoincrement())
|
||||
filename String
|
||||
bank_name String?
|
||||
card_name String?
|
||||
account_type String?
|
||||
account_number String
|
||||
billing_start_date DateTime? @db.Date
|
||||
billing_end_date DateTime? @db.Date
|
||||
total_amount_due Decimal? @db.Decimal(12, 2)
|
||||
minimum_amount_due Decimal? @db.Decimal(12, 2)
|
||||
payment_due_date DateTime? @db.Date
|
||||
event_created Boolean? @default(false)
|
||||
tier_used String?
|
||||
created_at DateTime? @default(now())
|
||||
statement_type String @default("credit_card")
|
||||
currency String? @default("AUD")
|
||||
opening_balance Decimal? @db.Decimal(12, 2)
|
||||
closing_balance Decimal? @db.Decimal(12, 2)
|
||||
total_credits Decimal? @db.Decimal(12, 2)
|
||||
total_debits Decimal? @db.Decimal(12, 2)
|
||||
interest_charged Decimal? @db.Decimal(12, 2)
|
||||
fees_charged Decimal? @db.Decimal(12, 2)
|
||||
credit_limit Decimal? @db.Decimal(12, 2)
|
||||
available_credit Decimal? @db.Decimal(12, 2)
|
||||
owner_id Int @default(1)
|
||||
account_holder_name String?
|
||||
exchange_rate_to_aud Decimal? @db.Decimal(10, 6)
|
||||
paperless_doc_id Int? @unique
|
||||
transactions transactions[]
|
||||
}
|
||||
|
||||
model transactions {
|
||||
id Int @id @default(autoincrement())
|
||||
statement_id Int?
|
||||
transaction_date DateTime @db.Date
|
||||
description String?
|
||||
amount Decimal @db.Decimal(12, 2)
|
||||
created_at DateTime? @default(now())
|
||||
transaction_type String? @default("debit")
|
||||
merchant_name String?
|
||||
location String?
|
||||
foreign_currency_amount Decimal? @db.Decimal(12, 2)
|
||||
foreign_currency_code String?
|
||||
category String?
|
||||
row_index Int?
|
||||
merchant_normalized String?
|
||||
amount_aud Decimal? @db.Decimal(12, 2)
|
||||
owner_id Int?
|
||||
reconciled_with_id Int?
|
||||
statement statements? @relation(fields: [statement_id], references: [id], onDelete: Cascade)
|
||||
reconciled_with transactions? @relation("reconciled", fields: [reconciled_with_id], references: [id], onDelete: SetNull)
|
||||
reconciled_by transactions[] @relation("reconciled")
|
||||
expense_metadata expense_metadata?
|
||||
}
|
||||
|
||||
model expense_metadata {
|
||||
id Int @id @default(autoincrement())
|
||||
transaction_id Int? @unique
|
||||
source String @default("email")
|
||||
paperless_doc_id Int? @unique
|
||||
source_email_subject String?
|
||||
source_email_from String?
|
||||
payment_method String?
|
||||
payment_method_detail String?
|
||||
order_reference String?
|
||||
line_items Json @default("[]")
|
||||
tax_amount Decimal? @db.Decimal(12, 2)
|
||||
subtotal Decimal? @db.Decimal(12, 2)
|
||||
merchant_normalized String?
|
||||
amount Decimal? @db.Decimal(12, 2)
|
||||
transaction_date DateTime? @db.Date
|
||||
extraction_model String? @default("gemini-2.5-flash")
|
||||
created_at DateTime? @default(now())
|
||||
transaction transactions? @relation(fields: [transaction_id], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model rule_apply_runs {
|
||||
id Int @id @default(autoincrement())
|
||||
owner_id Int
|
||||
applied_at DateTime @default(now())
|
||||
split_from DateTime? @db.Date
|
||||
matched Int @default(0)
|
||||
transactions_affected Int @default(0)
|
||||
reverted_at DateTime?
|
||||
snapshot Json @default("[]")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user