Purpose
The Migrations module integrates local Fireway migration files with Firestore migration records. It helps users inspect migration status, source contents, record pending migrations as applied when an external migration runner has already executed them, execute pending migration source against Firebase emulators, and verify environment alignment before any execution workflow is used.
Inputs
- linked local workspace path
- Fireway migration files
- configured migration collection
- selected project/database
- Firestore migration records
Outputs
TABLE: migration status rowsJSON: raw migration records and file metadataLOGS: local file, Firestore, parse, and comparison logs
Actions
Current GUI coverage includes listing status, source file content, a record-only "Record Pending As Applied" workflow, and an emulator-only "Execute Pending (Emulator)" workflow. The record-only action writes migration records for pending local files through the task queue; it does not execute Fireway source code.
GUI source execution is emulator-only. It runs pending Fireway-compatible JavaScript through the task queue, applies emitted Firestore mutations to the selected Firestore emulator, records migration state, refreshes status rows, and keeps rollback notes/logs visible. Production/live execution must not be claimed until approved live verification proves the workflow and guardrails.
Use this module when a release or support session needs to answer four questions before running any migration tooling: which local files exist, which Firestore migration records exist, which files appear unapplied, and which project/database is being inspected. Keeping those details in one view reduces the risk of comparing local development files against the wrong Firebase environment.
The source preview is intentionally part of the workflow. Review the migration body, file name, identifier, and remote record together before recording a pending file as applied or using the emulator execution path. If a record is missing or mismatched, use the logs output to determine whether the issue came from local file discovery, workspace-link configuration, Firestore access, or migration collection setup.
Safety
- Recording migrations as applied is Pro-gated.
- Read-only projects reject record-applied state writes before any task is queued.
- Production record-applied state writes require explicit confirmation.
- Record-applied state writes run through Tasks and surface task logs/progress.
- Migration source execution is GUI-available for emulator projects only.
- Non-emulator source execution rejects before task enqueue.
- Source file content and remote records should be visible before recording state or using the emulator execution path.
Current Verification
MigrationWorkflowCopyTests/testMigrationWorkflowCopyDistinguishesInspectRecordAndExecuteproves the GUI-facing labels distinguish status inspection, record-only state writes, emulator-only source execution, and live execution boundaries.MigrationWorkflowCopyTests/testProductionRecordAppliedGuardUsesRecordOnlyWordingproves production confirmation rejection uses record-applied state-write wording and does not queue logs before confirmation.MigrationWorkflowCopyTests/testProductionRecordAppliedPromptNamesStateWriteNotExecutionproves the production prompt says the action does not execute migration source.MigrationWorkflowCopyTests/testReadOnlyRecordAppliedRejectsBeforeQueueingTaskproves read-only GUI record-applied requests stop before task enqueue.MigrationWorkflowCopyTests/testGUIRecordAppliedWritesPendingMigrationRecordThroughTaskQueueAgainstEmulatorproves the GUI/AppModel record-applied action queues a task against real Firebase emulators, writes the migration record, refreshes applied status, records rollback notes/logs, and reads back the emulator document.MigrationWorkflowCopyTests/testGUIExecutePendingMigrationSourceWritesEmulatorMutationAndRecordproves the GUI/AppModel source-execution action queues a task against real Firebase emulators, runs Fireway-compatible JavaScript, applies the emitted Firestore mutation, records migration state, refreshes applied status, and reads back both the script-written emulator document and migration record.MigrationWorkflowCopyTests/testNonEmulatorMigrationExecuteRejectsBeforeQueueingTaskproves GUI source execution rejects non-emulator projects before task enqueue.FirestructCLIIntegrationTests/testCLICommandsRoundTripAgainstFirebaseEmulatorsproves emulator-backed migration status,record-appliedrecord-only writes, and emulator-only JSapplyexecution with Firestore mutation and migration-record read-back evidence.
Source Anchors
Sources/FirestructApp/Features/Migrations/UI/MigrationExplorerView.swiftSources/FirestructApp/Features/Migrations/Services/AppModel+MigrationActions.swiftSources/FirestructApp/Features/Migrations/Model/MigrationStore.swiftSources/FirestructApp/Features/Migrations/Model/MigrationWorkflowCopy.swiftSources/FirestructCore/FirewayIntegrationService.swiftSources/FirestructCore/ProjectRegistry+Migrations.swift