Схема БД¶
Saga stores product state in PostgreSQL. The canonical schema is defined by migrations in backend/storage/migrations/.
Основные таблицы¶
users: user identity, status, email, balance-related user metadata.wallets: deposit address records and provider metadata.transactions: append-only ledger for financial operations.transaction_requests: withdrawal and transfer request lifecycle.investments: user investment positions and yield tracking.sessions: backend JWT/session lifecycle.fund_transfers: operator fund transfer tracking.vault_snapshots: vault and provider balance snapshots.audit_log: security and operational audit events.analytics_events: product analytics events.
Операционные таблицы¶
schema_migrations: applied migration versions.health_events,health_status,health_daily_stats: service health monitoring.support_conversations,support_message_mappings: support bot conversation state.gift_code_batches,gift_codes,gift_code_funding_orders,gift_code_funding_payments: gift code lifecycle.user_groups,user_group_members,config_timeline: temporal configuration rollout.
Rules¶
transactionsis append-only; operation status and reverse transactions represent state changes.- Financial API values use
SafeDecimalrather than raw floating-point values. - Schema changes go through numbered migrations in
backend/storage/migrations/. - Integration data stays provider-specific; business balances are calculated through canonical backend services.