Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### TL;DR Added a new `payers` table and associated query functionality to track unique payer addresses. I decided to make this table normalized since we are going to reference it from a lot of places and a 42 byte address is a lot more to store than a 32 bit int. ### What changed? - Created a new `payers` table with `id` and `address` columns - Added `FindOrCreatePayer` query to handle upsert operations for payer addresses - Implemented `Payer` model struct with corresponding fields - Added migration files for creating and dropping the payers table ### How to test? 1. Run database migrations 2. Execute the test suite, specifically `TestFindOrCreatePayer` 3. Verify that: - New payer addresses are assigned unique IDs - Duplicate addresses return the existing ID - Different addresses receive different IDs ### Why make this change? To maintain a normalized database structure for payer addresses, ensuring each unique address is stored only once and can be referenced by ID throughout the system. This prevents duplicate storage of addresses and enables efficient querying of payer-related data. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced enhanced management of payer records that automatically creates new entries or updates existing ones, ensuring data integrity. - **Chores** - Added database migration scripts to establish the new payer records table and support rollback processes. - **Tests** - Included comprehensive tests verifying the reliability of the new payer record management functionality. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information