How it works
The CLI uses the same engine as the desktop app. What it adds is a way to carry reviewed connections to another machine safely, and a license check that a modified copy of the CLI can’t skip.
On this page
The three parts
| Part | Role |
|---|---|
| Desktop app | Where you create, test and export connections and profiles. |
| Exported file | An encrypted connection or run file you can copy to any machine. |
| dbHydrate licensing service | At api.dbhydrate.com: checks the license or trial, holds a piece of each file’s key, manages seats, logs run metadata. It never receives database passwords, SQL or data. |
When you export
- The desktop app reads the connection and its safety settings on your computer.
- It asks the licensing service to register the file. The service creates a random key share for it, keeps an encrypted copy, and signs the file’s readable header (file ID, kind, engine, environments, owner and expiry).
- The desktop app encrypts the file with a key made from your passphrase and that key share, writes it, and forgets both.
The service never sees the passphrase or the connection details. The desktop app never keeps the key share.
When you run a command
- The CLI checks each file’s header signature offline. An edited file stops here.
- It asks the licensing service to start a run, naming the action (
compare,dry-runorapply) and the files. - The service checks the CLI version, the files (exist, not revoked, not expired, same account and engine), the license or trial, whether the action is allowed, and, for
apply, the seat’s license key. - It gives the seat’s run lease to this run, and returns a signed run token (valid for five minutes, for this run only) with the files’ key shares.
- The CLI checks the token’s signature, decrypts the files in memory and connects. The source is always read-only.
- While the run lasts, the CLI renews the lease every two minutes.
- At the end it writes the reports, tells the service the outcome (metadata only) and releases the lease.
Seats and run leases
A seat runs one CLI command at a time. The run lease is how the service knows a seat is busy.
| Event | What happens |
|---|---|
| Run starts | The seat’s lease goes to this run, or the run gets exit code 4 (or waits with --wait). |
| Every 2 minutes | The CLI renews the lease, retrying if a renewal fails. |
| Runner crashes | The lease expires about 10 minutes after the last renewal, and the seat is free again. |
| Run ends or is cancelled | The CLI releases the lease straight away. |
If the licensing service is unreachable
- A new run can’t start. It ends with exit code 2 and says the service couldn’t be reached.
- A run in progress keeps going through short interruptions of up to about 10 minutes.
- If the lease expires before
applystarts changing the target, the run stops safely: nothing is changed, temporary databases are removed, exit code 2. - Once
applyhas started changing the target, it finishes. A licensing problem never stops a migration halfway; the run is logged as having lost its lease.
The same engine as the desktop app
Reading schemas, comparing, ordering changes, dry runs and apply all use the dbHydrate engine the desktop app uses. A comparison in your pipeline matches what you review on screen, and fixes reach both at once.