Spaces:
Runtime error
Runtime error
Commit History
-
refactor(database): consolidate shared database base and fix foreign key schema references
- Create centralized `app/core/database.py` with shared SQLAlchemy Base instance - Update all model files to use shared Base instead of individual instances - Fix foreign key references to include schema prefix (`trans.`) across all models: * Trade sales: order_id, shipment_id, po_item_id references * Inventory stock: ledger_id, adjustment_id references * Purchase orders: po_id references * Purchase receipts: po_id, grn_id, po_item_id, grn_item_id references - Update `app/sql.py` to import shared Base and register all models - Add comprehensive documentation for foreign key fixes and schema migration - Add migration scripts for pricing levels column and catalogue reference table - Add test suite for pricing levels sync and complete pricing flow validation - Reorganize documentation structure with implementation summaries and security guides - Resolves foreign key resolution errors caused by multiple Base instances and missing schema prefixescd357c6