Creating a Migration Plan
Define your migration steps in aMigrationPlan. Migrations are identified by unique string identifiers (e.g. "v1_initial_schema", "v2_add_avatar_url").
1
Define Version 1 Initial Schema
Create initial tables when the app is first launched.
Migrations.swift
2
Add Version 2 Migration Step
When adding new features in a app update, append a new migration step to the end of the array.
Migrations.swift
3
Pass Migration Plan to Database Initialization
Pass the plan into
BoutiqueDB.open:AppStore.swift
Migration Safety & Transactions
Transactional Execution
All steps within a single
Migration run inside a dedicated SQLite transaction. If a statement fails, changes are completely rolled back.Internal Bookkeeping
BoutiqueDB tracks executed migration IDs in a system table (
_boutiquedb_migrations). Executed migrations are never re-run.
