Skip to content

Conversation

@beaux-riel
Copy link
Owner

Description

This PR implements a complete redesign of the UltraEdge database schema to better support the application's requirements for endurance event crew and supply management. The new schema provides improved tracking of items, dropbags, aid stations, and athlete performance.

Key Improvements

  1. Separated Event-Specific Data: Created EventDropbags to handle event-specific instances of dropbags
  2. Enhanced Item Management: Added UserItems for personal inventory tracking
  3. Better Consumption Tracking: Improved consumption tracking with location and timing
  4. Performance Analytics: Added tables for tracking athlete performance and aid station visits
  5. Deployment Tracking: Added DropbagDeployments to track physical dropbag movements
  6. Enhanced Metadata: Added timestamps, status fields, and better organization
  7. Constraint Handling: Structure now supports the rule that items can't be in multiple dropbags for the same event
  8. Inventory Management: Better tracking of available vs. reserved quantities
  9. Template System: Improved dropbag template functionality
  10. Support System: Added comprehensive pacer, support vehicle, and athlete kit tracking
  11. Mobile Crew Support: Support vehicle location tracking for real-time coordination

Major Table Changes

  • Renamed profiles to users with expanded fields
  • Added athlete_profiles for athlete-specific information
  • Renamed races to events with expanded fields
  • Redesigned aid_stations to be event-independent
  • Added many new tables for improved tracking and relationships

Implementation Details

  • Created a new migration file: 20250811173500_new_schema.sql
  • Updated the main schema.sql file
  • Added documentation in SCHEMA_CHANGES.md
  • Added application instructions in APPLY_SCHEMA.md

Testing

The schema has been validated for SQL syntax and referential integrity. After merging, the schema should be applied to a test environment before being applied to production.

Documentation

  • Added SCHEMA_CHANGES.md to document the changes
  • Added APPLY_SCHEMA.md with instructions for applying the schema to Supabase

Additional Notes

This is a breaking change that will require data migration from the old schema to the new schema. The migration process should:

  1. Back up all existing data
  2. Drop all existing tables
  3. Create the new tables
  4. Migrate data from the backup to the new tables

- Replaced existing schema with new comprehensive design
- Added support for event-specific dropbags, item tracking, and performance monitoring
- Improved inventory management and consumption tracking
- Added support for pacers, support vehicles, and athlete kits
- Added documentation of schema changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants