Overview
The Data Management page provides enterprise-grade tools for database backup, restore, and migration operations critical for production deployments and disaster recovery.
Key Features
Database Overview
Real-time statistics showing record counts across all tables:
- 5,179 total records in production database
- 52 States: US state reference data
- 3,222 Counties: Complete county boundaries
- 9 Brokers: Active real estate partnerships
- 5 Agents: Registered real estate agents
- 1,882 Coverage: Broker-to-county assignments
- 8 Leads: Customer inquiries
- 1 Assignment: Lead routing history
Export Capabilities
Full Database Export
- One-Click Backup: Export entire database as single JSON file
- Automatic Timestamping: Files named
hure-full-export-YYYY-MM-DD.json - Metadata Included: Schema version, export timestamp, record counts
- Foreign Key Safe: Export respects table dependencies
Individual Table Export
Export specific tables independently:
- States
- Counties
- Brokers
- Agents
- Coverage (broker_counties)
- Leads
Use Cases:
- Selective backups for specific data types
- Sharing county data with external systems
- Creating test datasets
- Auditing specific table changes
Import Capabilities
Smart Import Features
- Duplicate Detection: Automatically skips existing records by ID and unique constraints
- Full/Partial Support: Accepts complete exports or single table files
- Validation: Schema validation before import to catch errors
- Transaction Safety: All-or-nothing import for data integrity
- Progress Feedback: Real-time import statistics and error reporting
Import Workflow
- Click “Import from File” button
- Select JSON export file (full or single table)
- Optionally enable “Clear Before Import” mode
- System validates file format and schema version
- Import executes with duplicate skipping
- Success notification with statistics:
- Records imported
- Records skipped (duplicates)
- Errors encountered
Import Order
The system respects foreign key dependencies:
- States (no dependencies)
- Counties (depends on states)
- Brokers (no dependencies)
- Agents (depends on brokers)
- Coverage (depends on brokers + counties)
- Leads (depends on counties)
- Assignments (depends on leads + agents)
Clear Data Operations
Full Database Clear
Destructive Operation - Removes all records from all tables
- Confirmation dialog required
- Respects foreign key order (reverse of import)
- Use for fresh starts or testing scenarios
Individual Table Clear
Clear specific tables while preserving others:
- Useful for resetting test data
- Clearing outdated leads
- Removing inactive brokers
Safety Features:
- Multiple confirmation prompts
- Admin-only access
- Audit logging of clear operations
Production Deployment Workflow
Initial Deployment
This feature was used to populate the production database:
- Local Export: Exported dev database with test data
- Upload to Production: Accessed
/admin/dataon production server - Import Operation: Clicked “Import from File”
- Selected Export: Chose
hure-full-export-2025-12-23.json - Import Success: 5,179 records imported successfully
- Verification: Map loaded all 3,222 counties correctly
Ongoing Operations
Daily Backups:
- Export full database to secure storage
- Version control for disaster recovery
- Retain 30-day backup history
Data Migration:
- Export from old system
- Transform data format if needed
- Import into new system
- Verify data integrity
Testing:
- Export production data
- Import to staging environment
- Test new features with real data
- Clear staging data when done
Testing Results
- ✅ Database overview shows accurate record counts
- ✅ Full database export downloads complete JSON file
- ✅ Individual table exports work for all tables
- ✅ Import successfully loaded 5,179 records
- ✅ Duplicate detection skipped existing records
- ✅ Import statistics displayed correctly
- ✅ Refresh button updates statistics
- ✅ All action buttons are functional
- ✅ Icons and visual indicators clear
- ✅ No data corruption after import/export cycle
- ✅ Foreign key constraints maintained