Skip to content
Oxford Harrison edited this page Nov 19, 2024 · 20 revisions

DOCS


This is the Linked QL CLI documentation.

The Linked QL CLI is a beautiful little utility that comes with your Linked QL installation. It gives you a seamless command-line interface over some of Linked QL's most powerful features: Automatic Schema Savepoints and Rollbacks and Diff-Based Migrations!

The command name is linkedql and its assiciated commands are:

Command Description
linkedql commit Interactively commit local chnages to your database.
linkedql rollback Interactively roll back latest changes on your database.
linkedql rollforward Interactively roll forward from latest rollback.
linkedql restore Alias of linkedql rollback and linkedql rollforward.
linkedql refresh Refresh local schema file to reflect active database structure.
linkedql generate Generate arbitrary schemas into local schema file.
linkedql savepoints Display a table of latest savepoints across databases.
linkedql dump-histories Dump savepoints to a histories file.
linkedql clear-histories Permanently erase savepoint histories.
linkedql replicate Replicate schema histories in a second database.
linkedql config Display existing configs or set new configs.

Usage

The linkedql command operates at the scope of your Linked QL installation, and so, for non-global installation of Linked QL, you'll need the npx prefix to run. E.g.

npx linkedql commit

If you have chosen a different location for your "database" directory (where you have your schema.json and driver.js files defined) other than the default ./database location, you can use the --dir flag along with each command to point Linked QL to this location:

npx linkedql commit --dir="./src/database-stuff"

(Relative paths will resolve against your current working directory (CWD).)

To turn off prompts and get Linked QL to take a predefined sensible-default action, use the flag --yes:

npx linkedql commit --yes

If your driver.js file depends on environmental variables from a .env file, you can tell Linked QL to pre-load them using the flag --with-env:

npx linkedql commit --with-env
Clone this wiki locally