-
-
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 commitOn 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 commit --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 commit --db=database_1To turn off prompts and get Linked QL to just take the "sensible-default" action, use the flag --yes (formally --auto, before v0.12.0):
npx linkedql commit --yesNote that as of
@linked-db/linked-ql@0.11.0, the following commandsforget,leaderboard,migr atehave been depreciated in favour ofclear-histories,state,commitrespectively, and a new commandgenerateintroduced.
Interactively commit your schema changes against your DB. 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 commitnpx linkedql commit --db=database_1Use the --desc flag to provide the description for your new changes:
npx linkedql commit --desc="Initial DB creation"Use the flag --quiet to turn off SQL previews:
npx linkedql commit --quietInteractively 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 rollbacknpx linkedql rollback --db=database_1Use 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=forwardUse the flag --quiet to turn off SQL previews:
npx linkedql migrate --quietView the state of each database. Linked QL displays details about the latest savepoint at each database.
🐹 Usage:
npx linkedql statenpx linkedql state --db=database_1Use 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 state --direction=forwardRefresh local schema file. Linked QL regenerates the schema from current DB structure for each database it has managed; refreshes local copy.
🐹 Usage:
npx linkedql refreshnpx linkedql refresh --db=database_1Same as linkedql generate, except that it will also eagerly generate the schema for an explicitly-named DB that has not been managed by Linked QL.
🐹 Usage:
npx linkedql generatenpx linkedql generate --db=database_1Permanently 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 clear-historiesnpx linkedql clear-histories --db=database_1