import { Icon } from '../shared/Icon'; const MIGRATION_STEPS = [ { phase: 'Pre-migration', steps: [ 'Verify booking_status field exists on Trip schema (additive — no breaking changes)', 'Run validation query to count trips with is_booked: true that lack booking_status', 'Backup: snapshot the trips collection before running backfill', ], }, { phase: 'Backfill Script', steps: [ 'Query all trips where is_booked: true AND booking_status is null', 'For each trip, compute booking_status from current trip_status using TRIP_STATUS_TO_BOOKING_STATUS map', 'Use bulkWrite with ordered: false for parallel processing', 'Set booking_status_history to [{ status: computed_status, timestamp: trip.updatedAt }]', ], }, { phase: 'Validation', steps: [ 'Count trips where is_booked: true AND booking_status is null — should be 0', 'Verify booking_status values are all valid enum values', 'Spot-check 10 random trips: compare trip_status to booking_status for consistency', 'Run the full QA test plan against staging with backfilled data', ], }, ]; const VALIDATION_QUERIES = [ { label: 'Count un-migrated trips', query: 'db.trips.countDocuments({ is_booked: true, booking_status: { $exists: false } })', }, { label: 'Verify valid statuses', query: 'db.trips.distinct("booking_status", { is_booked: true })', }, { label: 'Check for null booking_status', query: 'db.trips.countDocuments({ is_booked: true, booking_status: null })', }, ]; export function DataMigrationSection() { return (
The booking_status field is
additive — it does not replace or modify any existing fields. Existing trips without this field continue to work normally.
Migration is only needed if you want historical trips to show booking status in the UI.
{q.query}