-
-
Notifications
You must be signed in to change notification settings - Fork 2
LinkedQL Replicate
Replicate schema histories in a second database.
What it does: diffs two database instances by schema histories and replicates any changes in first database in second database; typically used for migration.
For online replication, use the --origin flag. (REQUIRED)
npx linkedql replicate --originUse the --swap flag to have the databases switch roles:
npx linkedql replicate --origin --swapFor offline replication, use the --histories flag. (REQUIRED)
npx linkedql replicate --histories- Target database: the database where changes are to be replicated; typically, your production database.
- Origin database: the database where changes have been made; typically, your development database.
-
Online replication: "target database" replicates "origin database" using "origin database"'s Linked QL client. This is applicable where "origin database" is reachable from "target database"; e.g. where both databases are online databases or where both are local databases.
Here, you export the additional database client (i.e. the "origin database"'s Linked QL client) from your
driver.jsfile asorigin:./database/driver.jsexport default async function() { return // your default Linked QL client (being the "target database") } export async function origin() { return // your origin Linked QL client (being the "origin database") }
-
Offline replication: "target database" replicates "origin database" using "origin database"'s histories dump.
Here, you have your "origin database"'s histories dumped ahead of replication, typically during your application's build process:
./package.json{ "scripts": { "build": "linkedql dump-histories && other things" } }
The actual execution of the linkedql replicate command, typically done as part of your application's deployment process:
./package.json
{
"scripts": {
"deploy": "linkedql replicate --origin && other things"
}
}