- Start - creates the new schema version with views and triggers. Both old and new schemas are available simultaneously.
- Rollout - new application code is deployed and uses the new schema via
search_path. - Complete - the old schema and migration artifacts are removed.
Enabling Reshape
Add areshape block to a postgres definition in specific.hcl:
specific.hcl
migrations/, relative to specific.hcl):
specific.hcl
Writing migrations
Migrations are TOML files composed of actions (create_table, add_column, alter_column, add_index, custom, and more), processed in lexical order (001_first.toml before 002_second.toml):
migrations/001_create_users.toml
Run
specific check every time you create or edit a migration file. It validates both specific.hcl and all migration files, catching errors before they’re applied. Without it, invalid migrations silently fail to apply.specific docs postgres/reshape/actions, and specific docs postgres/reshape/actions/<action> for a specific one.
Automatic management in development
Whenspecific dev starts with Reshape enabled, migrations are managed for you:
- All migrations except the last are completed - these become permanent schema changes.
- The last migration is started but not completed - so you can iterate on it.
- Completed migration files are made read-only - preventing accidental modification.
specific dev is running:
- Modifying the last migration file aborts and restarts that migration. Services keep running - no restart needed, since the schema name doesn’t change.
- Adding a new migration file completes the previous migration (making it permanent) and starts the new one. Services are restarted to use the new schema.
- Write a migration file in the migrations directory.
- Run
specific checkto validate. specific devapplies it automatically.- Iterate on the migration - run
specific checkafter every change. - When ready, add a new migration file to lock in the previous one.
Connection strings
When Reshape is enabled,postgres.<name>.url automatically includes the correct search_path. No service configuration changes needed:
specific.hcl
Manual migration commands
You can also control migrations directly:specific dev isn’t running, the database is started temporarily. check only validates file syntax and runs anytime.
Production
Duringspecific deploy, migrations follow the same 3-phase flow, coordinated with the service rollout: pending migrations are started before the new code rolls out, and completed once the rollout succeeds. If the rollout fails, the migrations are aborted automatically and the database rolls back to the old schema.