Replace monolithic contacts table with 6 specialized person tables#231
Draft
Replace monolithic contacts table with 6 specialized person tables#231
Conversation
Co-authored-by: credevator <2756303+credevator@users.noreply.github.com>
Co-authored-by: credevator <2756303+credevator@users.noreply.github.com>
Co-authored-by: credevator <2756303+credevator@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Replace Contacts table with Person tables
Replace monolithic contacts table with 6 specialized person tables
Aug 19, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR implements a complete migration from the monolithic
contactstable to 6 specialized, normalized person tables as requested in issue #230.Overview
The existing contacts system stored all person-related data in a single table, making it difficult to manage privacy settings, track complex relationships, and maintain data integrity. This implementation replaces it with a normalized schema that provides better data organization and enhanced functionality.
New Person Tables Architecture
Core Tables
person_profiles- Core profile information (name, gender, visibility, notes)person_contact_info- Email, phone, addresses with individual privacy settingsperson_professional_info- Job history, organizations, work details with reference trackingperson_personal_info- Birthday, family information, emergency contacts, preferencesperson_life_events- Important dates, milestones with reminders and recurring patternsperson_belongings- Items, gifts, possessions, borrowed items with full metadataperson_relationships- Rich bidirectional relationship mapping (replaces contact_relationships)Key Improvements
Privacy & Access Control
Each piece of information now has individual privacy settings (private/friends/public) rather than a single visibility flag for the entire contact.
Enhanced Life Event Tracking
The new system provides comprehensive life event management with reminders and recurring patterns:
Professional History Management
Complete job history tracking with references and skill management:
API Changes
New Endpoints
GET/POST /api/v1/persons/- Person profile managementGET/POST /api/v1/persons/{id}/contact-info- Contact informationGET/POST /api/v1/persons/{id}/professional-info- Professional detailsGET/POST /api/v1/persons/{id}/personal-info- Personal informationGET/POST /api/v1/persons/{id}/life-events- Life eventsGET/POST /api/v1/persons/{id}/belongings- Belongings trackingGET /api/v1/persons/upcoming-events/- Upcoming events across all personsGET /api/v1/persons/emergency-contacts/- Emergency contactsGET /api/v1/persons/borrowed-items/- Borrowed items trackingLegacy Compatibility
Existing
/api/v1/contacts/endpoints remain functional but are marked as DEPRECATED. This ensures zero downtime during migration.Database Migration
The implementation includes two migration files:
Data migration preserves all existing information while enhancing it with the new structure:
person_contact_infowith privacy settingsperson_professional_infowith enhanced trackingperson_personal_infowith family contextperson_life_eventswith reminder systemImplementation Highlights
Backwards Compatibility
The system maintains full backwards compatibility during transition:
Data Integrity
Testing
Created comprehensive validation suite covering:
Next Steps
After this PR is merged, the following steps will complete the migration:
Fixes #230.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.