Adopting an existing collection
If you already have a collection that matches an early migration, stamp lets
revector take over without re-creating it:
# Tell revector the DB is already at 0002 (no operations run)
revector stamp 0002_index_and_quantize
# Now apply everything after it normally
revector up
stamp accepts a revision id, the literal head (latest revision in the
chain), or base (clear all tracking, mark nothing applied). It records every
revision up to and including the target as applied, and removes any recorded
revisions above it.
Use --dry-run to preview the change to the tracking collection without
writing.
Recommended bootstrap
- Write the migrations that would have produced your current schema, in order. Don't apply them.
- Run
revector validateto make sure the chain parses and resolves. - Run
revector stamp head --dry-runand confirm what would be written. - Run
revector stamp headfor real. - From now on, new schema changes go through
revector new+revector up.