-
-
Notifications
You must be signed in to change notification settings - Fork 2
Linked QL migrations are a small addition to Linked QL. And it comes ready-to-use, via the linkedql
command, upon Linked QL's installation. (No extra setup is required.)
The linkedql
command comes as part of your local Linked QL installation and not as a global package, and that means you'll need the npx
prefix to run the commands below. E.g.
npx linkedql migrate
On each command, you can use the --dir
flag to point Linked QL to your "database" directory (where you have your schema.json
and driver.js
files), that's if you have chosen a different location other than ./database
:
npx linkedql migrate --dir="./src/database-stuff"
(Relative paths will resolve against your current working directory (CWD).)
To run a command for a specific database out of your list of databases, use the --db
flag:
npx linkedql migrate --db=database_1
To turn off prompts and get Linked QL to just take the "sensible-default" action, use the flag --auto
:
npx linkedql migrate --auto
Interactively run new migrations. Linked QL looks through your local schema and compares with your active DB structure to see what's new. It works interactively by default and you're able to preview each SQL query to be run.
🐹 Usage:
npx linkedql migrate
npx linkedql migrate --db=database_1
Use the --desc
flag to provide the description for your new changes:
npx linkedql migrate --desc="Initial DB creation"
Use the flag --quiet
to turn off SQL previews:
npx linkedql migrate --quiet
Interactively perform a rollback. Linked QL looks for the next savepoint at each database and initiates a rollback. It works interactively by default and you're able to preview each SQL query to be run.
🐹 Usage:
npx linkedql rollback
npx linkedql rollback --db=database_1
Use the --direction
flag to specify either a "backward" rollback (the default) or a "forward" rollback if already at a certain rollback state:
npx linkedql rollback --direction=forward
Use the flag --quiet
to turn off SQL previews:
npx linkedql migrate --quiet
View the latest savepoint at each database. Linked QL displays details about the next savepoint at each database.
🐹 Usage:
npx linkedql leaderboard
npx linkedql leaderboard --db=database_1
Use the flag --direction
to specify either a "back in time" lookup (the default) or "forward in time" lookup if already at a certain rollback state:
npx linkedql leaderboard --direction=forward
Refresh local schema file. Linked QL regenerates the schema from current DB structure for each database it has managed; refreshes local copy.
🐹 Usage:
npx linkedql refresh
npx linkedql refresh --db=database_1
Permanently erase savepoint histories. Linked QL deletes the savepoint history of all databases, or a specific database from the --db
flag. This is irreversible.
🐹 Usage:
npx linkedql forget
npx linkedql forget --db=database_1