CLI
lumbung talks to a Lumbung engine over its REST API.
Connection settings come from flags, then LUMBUNG_URL, LUMBUNG_TOKEN and LUMBUNG_DATABASE, then the profile saved by lumbung login.
Every command takes these flags:
--json print JSON instead of tables --profile string saved profile to use --token string API token (or LUMBUNG_TOKEN) --url string engine URL (or LUMBUNG_URL) -y, --yes don't ask before destructive actionslumbung branch
Section titled “lumbung branch”List, create, delete, reset, promote and diff branches.
lumbung branch create
Section titled “lumbung branch create”Create a branch as a copy of another branch or a snapshot.
lumbung branch create NAME [flags] --db string database name or id (default: the profile's) --expires-in-days int delete the branch automatically after this many days --from string branch to copy (default: the default branch) --from-snapshot string snapshot id to copy instead --protected protect the branch from delete and resetlumbung branch create pr-42 --db app --expires-in-days 7lumbung branch delete
Section titled “lumbung branch delete”Delete a branch.
lumbung branch delete BRANCH [flags] --db string database name or id (default: the profile's)lumbung branch diff
Section titled “lumbung branch diff”Show how a branch’s schema differs from another branch.
lumbung branch diff BRANCH [flags] --against string branch to compare with (default: the default branch) --db string database name or id (default: the profile's)lumbung branch diff pr-42 --db app --against mainlumbung branch list
Section titled “lumbung branch list”List a database’s branches.
lumbung branch list [flags] --db string database name or id (default: the profile's)lumbung branch promote
Section titled “lumbung branch promote”Make a branch the database’s default.
lumbung branch promote BRANCH [flags] --db string database name or id (default: the profile's)lumbung branch reset
Section titled “lumbung branch reset”Reset a branch to a fresh copy of its parent.
lumbung branch reset BRANCH [flags] --db string database name or id (default: the profile's)lumbung db
Section titled “lumbung db”List, create, delete and restore databases.
lumbung db create
Section titled “lumbung db create”Create a database with an empty main branch.
lumbung db create NAMElumbung db delete
Section titled “lumbung db delete”Move a database to the trash.
lumbung db delete NAMElumbung db list
Section titled “lumbung db list”List databases.
lumbung db listlumbung db restore
Section titled “lumbung db restore”Restore a database from the trash.
lumbung db restore NAME_OR_ID [flags] --name string restore under this name instead of the old onelumbung db trash
Section titled “lumbung db trash”List databases in the trash.
lumbung db trashlumbung export
Section titled “lumbung export”Download a branch as a SQLite file or SQL dump.
lumbung export [flags] --branch string branch name or id (default: the database's default branch) --db string database name or id (default: the profile's) --format string db or sql (default "db") -o, --output string write to this file instead of standard outputlumbung export --db app -o app.dblumbung export --db app --format sql > dump.sqllumbung import
Section titled “lumbung import”Import a SQLite file or SQL dump into a branch.
Imports FILE into a branch. A file starting with the SQLite header is imported as a database file, anything else as a SQL dump, unless –format says otherwise. By default the branch must have no tables; –mode replace overwrites it (not allowed on a protected branch).
lumbung import FILE [flags] --branch string branch name or id (default: the database's default branch) --db string database name or id (default: the profile's) --format string db or sql (default: detected from the file) --mode string empty or replace (default "empty")lumbung import app.db --db applumbung import dump.sql --db app --branch staging --mode replacelumbung login
Section titled “lumbung login”Save the engine URL and a token as a profile.
Saves the engine URL and a token (and optionally a default database) to the config file, mode 600, as the profile named by –profile (default “default”), and makes it current. The token is read from –token, LUMBUNG_TOKEN, or one line on standard input.
lumbung login [flags] --db string default database for commands that need onelumbung login --url http://127.0.0.1:4870 --db app < token.txtlumbung login --url https://db.example.com --token lmb_... --profile prodlumbung migrate
Section titled “lumbung migrate”Apply a folder of .sql migrations in order.
lumbung migrate apply
Section titled “lumbung migrate apply”Apply pending migrations.
lumbung migrate apply [flags] --branch string branch name or id (default: the database's default branch) --db string database name or id (default: the profile's) --dir string folder of .sql files (default "migrations")lumbung migrate apply --db app --dir drizzlelumbung migrate apply --db app --branch pr-42 --dir migrationslumbung migrate status
Section titled “lumbung migrate status”Show which migrations are applied.
lumbung migrate status [flags] --branch string branch name or id (default: the database's default branch) --db string database name or id (default: the profile's) --dir string folder of .sql files (default "migrations")lumbung query
Section titled “lumbung query”Run one SQL statement.
Runs one statement with bound parameters in its own transaction. Each –arg binds the next ? placeholder; it is read as JSON (42, 1.5, true, null, “text”) when it parses, otherwise as text.
lumbung query SQL [flags] --arg stringArray a parameter value; repeat for each ? --branch string branch name or id (default: the database's default branch) --db string database name or id (default: the profile's) --read-only run on a read-only connectionlumbung query "SELECT * FROM users WHERE id = ?" --db app --arg 1lumbung query "INSERT INTO users (name) VALUES (?)" --db app --branch dev --arg Analumbung shell
Section titled “lumbung shell”An interactive SQL prompt.
Reads SQL until a statement ends with a semicolon, runs it, and prints the result. Ctrl-C cancels a running statement or clears the line; Ctrl-D or .quit leaves. Commands: .tables, .schema [TABLE], .branch NAME, .help, .quit.
lumbung shell [flags] --branch string branch name or id (default: the database's default branch) --db string database name or id (default: the profile's)lumbung snapshot
Section titled “lumbung snapshot”List, take and restore snapshots.
lumbung snapshot create
Section titled “lumbung snapshot create”Take a snapshot of a branch.
lumbung snapshot create [flags] --branch string branch name or id (default: the database's default branch) --db string database name or id (default: the profile's) --label string a note to find it bylumbung snapshot list
Section titled “lumbung snapshot list”List a branch’s snapshots.
lumbung snapshot list [flags] --branch string branch name or id (default: the database's default branch) --db string database name or id (default: the profile's)lumbung snapshot restore
Section titled “lumbung snapshot restore”Restore a snapshot into a new branch.
lumbung snapshot restore SNAPSHOT_ID [flags] --db string database name or id (default: the profile's) --into string name of the new branchlumbung snapshot restore sn_... --db app --into before-migrationlumbung token
Section titled “lumbung token”List, create and revoke API tokens.
lumbung token create
Section titled “lumbung token create”Create a token; the full token is printed once.
lumbung token create [flags] --access string read, write or admin (default "read") --branch string limit the token to this branch of --db --db string limit the token to this database (default: the whole instance) --expires-in-days int expire after this many days (0: never) --name string what the token is forlumbung token create --name ci --db app --access write --expires-in-days 90lumbung token list
Section titled “lumbung token list”List tokens.
lumbung token listlumbung token revoke
Section titled “lumbung token revoke”Revoke a token.
lumbung token revoke TOKEN_IDlumbung version
Section titled “lumbung version”Print the CLI version.
lumbung version