> ## Documentation Index
> Fetch the complete documentation index at: https://docs.strait.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Migration Strategy

> How Strait manages immutable migrations and baseline bootstraps.

## Current Policy

* Existing numbered migrations are **immutable** once merged.
* Never rewrite or squash already-applied migrations in deployed environments.
* Backward/forward compatibility is maintained by additive migrations.

## Consolidation Plan for New Environments

To speed up fresh installs while preserving safety for existing deployments:

1. Keep historical migrations (`000001..current`) for upgrades.
2. Introduce periodic **baseline snapshot** migrations for fresh databases only.
3. Keep incremental migrations after each baseline for active development.

Example baseline pattern:

* `001000_baseline_schema.up.sql` — complete schema at release cut
* `001001_*.sql` onward — normal incremental migrations

## Operational Rules

* Existing environments:
  * Continue applying incremental migrations in order.
  * Never skip historical migration state.
* New environments:
  * Bootstrap from baseline + subsequent increments.

## Tooling Notes

* Baseline generation should be automated from a fully migrated reference DB.
* CI should test both paths:
  1. empty DB through full historical chain
  2. baseline through latest increments

## Safety Checklist Before Releasing a Baseline

* [ ] Schema diff against reference DB is empty
* [ ] Integration/E2E pass on baseline bootstrap path
* [ ] Integration/E2E pass on historical upgrade path
* [ ] Rollback scripts verified for latest increment set
