Migration 000090 creates customer_wallets, wallet_transactions, wallet_lots and wallet_lot_allocations as specified in docs/prd-point-coin.md §8 (PC-101). The CHECK constraints enforce K5 at the database: every ledger row names its source or destination, PAYMENT and the other point-only types cannot carry COIN, transfers need a counterparty, reversals need the row they reverse, adjustments need an admin and a reason, and EXPIRE must point at a lot. Balances and lot remainders cannot go negative, and a lot cannot hold more than it was created with. Beyond §8, adds idx_wallet_lot_allocations_lot_id: the primary key cannot serve lookups by lot, which the reconciliation job needs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 lines
160 B
SQL
5 lines
160 B
SQL
DROP TABLE IF EXISTS wallet_lot_allocations;
|
|
DROP TABLE IF EXISTS wallet_lots;
|
|
DROP TABLE IF EXISTS wallet_transactions;
|
|
DROP TABLE IF EXISTS customer_wallets;
|