jadpo migrate
On this page
Write and apply migrations.
Keep the database in step with the entities (area 5). new compares the entities with the latest migration's snapshot and writes the next folder in database/migrations/: the whole schema as snapshot.json, the SQL that gets there as postgres.sql, and changes.jadpo when a change needs a decision, such as a value for existing rows; once the decisions are written, new again finishes it. apply runs a database's pending migrations, each in a transaction, and a computed backfill in batches, each in its own, carrying on where a stopped run left off; status lists the migrations and, with --url, which a database has applied. Until configuration gives each connection its URL, --url names the database.
jadpo migrate <action> [purpose]Arguments
action: What to dopurpose(optional): What a new migration does, in lower_snake_case
Flags
--url <url>: The PostgreSQL database to apply to or read--store <name>: Which store that database is
On every command
--json: Print data for tools instead of text--help: Show every flag, with examples--color <when>: Choose when to use colour
jadpo migrate --json writes one JSON document to standard output instead of text, with the same exit code. The document has schemaVersion, command ("migrate"), ok, data (what the command produced, null when it failed) and diagnostics (each error with its rule, reason, next and help). A command that needs a terminal refuses --json and names the flags that do the same job.
Examples
# Write the migration for a new fieldjadpo migrate new add_rating# Finish the latest migration once its decisions are writtenjadpo migrate new# Apply the pending migrations to a databasejadpo migrate apply --url postgresql://localhost/shop# List the migrations and which a database has appliedjadpo migrate status --url postgresql://localhost/shop
Errors
cli.migrate_arguments: Migrate command has invalid argumentsmigration.apply_failed: Migrations could not be appliedmigration.store_diverged: Database does not match the project's migrationstoolchain.artifact_write_failed: Generated file could not be writtentoolchain.not_built_yet: Operation is declared but not built yettoolchain.project_not_found: Project could not be found
Markdown for agents: /docs/jadpo-migrate.md.Built from Jadpo main at a707efb.