This document contains the help content for the butane command-line program.
Command Overview:
butane↴butane init↴butane backend↴butane backend add↴butane backend remove↴butane backend list↴butane make-migration↴butane detach-migration↴butane migrate↴butane regenerate↴butane describe-migration↴butane list↴butane collapse↴butane embed↴butane unmigrate↴butane clear↴butane clear data↴butane delete↴butane delete table↴butane clean↴
Manages butane database migrations.
Usage: butane [OPTIONS] <COMMAND>
init— Initialize the databasebackend— Backendsmake-migration— Create a new migrationdetach-migration— Detach the latest migrationmigrate— Apply migrationsregenerate— Regenerate migrations in placedescribe-migration—list— List migrationscollapse— Replace all migrations with a single migration representing the current model stateembed— Embed migrations in the source codeunmigrate— Undo migrations. With no arguments, undoes the latest migration. If the name of a migration is specified, rolls back until that migration is the latest applied migrationclear— Cleardelete— Deleteclean— Clean current migration state. Deletes the current migration working state which is generated on each build. This can be used as a workaround to remove stale tables from the schema, as Butane does not currently auto-detect model removals. The next build will recreate with only tables for the extant models
-
-v,--verbose— Increase logging verbosity -
-q,--quiet— Decrease logging verbosity -
-p,--path <PATH>Default value:
<detected project containing .butane directory>
Initialize the database
Usage: butane init [OPTIONS] <BACKEND> <CONNECTION>
<BACKEND>— Database connection string. Format depends on backend<CONNECTION>— Database backend to use. 'sqlite' or 'pg'
-
--no-connect— Do not connect to the databasePossible values:
true,false
Backends
Usage: butane backend <COMMAND>
add— Add a backend to existing migrationsremove— Remove a backend from existing migrationslist— List backends present in existing migrations
Add a backend to existing migrations
Usage: butane backend add <NAME>
<NAME>— Backend name to add
Remove a backend from existing migrations
Usage: butane backend remove <NAME>
<NAME>— Backend name to remove
List backends present in existing migrations
Usage: butane backend list
Create a new migration
Usage: butane make-migration <NAME>
<NAME>— Name to use for the migration
Detach the latest migration
Usage: butane detach-migration
This command removes the latest migration from the list of migrations and sets butane state to before the latest migration was created.
The removed migration is not deleted from file system.
This operation is the first step of the process of rebasing a migration onto other migrations that have the same original migration.
If the migration has not been manually edited, it can be automatically regenerated after being rebased. In this case, deleting the detached migration is often the best approach.
However if the migration has been manually edited, it will need to be manually re-attached to the target migration series after the rebase has been completed.
Apply migrations
Usage: butane migrate [NAME]
<NAME>— Migration to migrate to
Regenerate migrations in place
Usage: butane regenerate
Usage: butane describe-migration <NAME>
<NAME>— Name of migration to be described, orcurrent
List migrations
Usage: butane list
Replace all migrations with a single migration representing the current model state
Usage: butane collapse <NAME>
<NAME>— Name to use for the new migration
Embed migrations in the source code
Usage: butane embed
Undo migrations. With no arguments, undoes the latest migration. If the name of a migration is specified, rolls back until that migration is the latest applied migration
Usage: butane unmigrate [NAME]
<NAME>— Migration to roll back to
Clear
Usage: butane clear <COMMAND>
data— Clear all data from the database. The schema is left intact, but all instances of all models (i.e. all rows of all tables defined by the models) are deleted
Clear all data from the database. The schema is left intact, but all instances of all models (i.e. all rows of all tables defined by the models) are deleted
Usage: butane clear data
Delete
Usage: butane delete <COMMAND>
table— Clear all data from the database. The schema is left intact, but all instances of all models (i.e. all rows of all tables defined by the models) are deleted
Clear all data from the database. The schema is left intact, but all instances of all models (i.e. all rows of all tables defined by the models) are deleted
Usage: butane delete table <NAME>
<NAME>— Table name
Clean current migration state. Deletes the current migration working state which is generated on each build. This can be used as a workaround to remove stale tables from the schema, as Butane does not currently auto-detect model removals. The next build will recreate with only tables for the extant models
Usage: butane clean
This document was generated automatically by
clap-markdown.