> For the complete documentation index, see [llms.txt](https://jadelab.gitbook.io/jadegit/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jadelab.gitbook.io/jadegit/0.18.0/developers/deployment.md).

# Deployment

JadeGit provides the ability to [build deployments](https://jadelab.gitbook.io/jadegit/console/build), which contain the commands and schema changes needed to incrementally update a database from one version to another. Once built, a deployment is run against the target database to apply those changes.

The fundamental steps for building and running a deployment are:

1. Retrieve the current version info for the database.
2. Build a deployment, supplying the current and target version.
3. Run the deployment against the database.
4. Update the version info, ready for retrieval next time.

```mermaid
sequenceDiagram
    participant O as Orchestrator
    participant D as Database

    O->>D: Retrieve current version info
    D-->>O: Current version
    Note over O: Build deployment
    O->>D: Run deployment
    O->>D: Update version info
```

## Registry

The [registry commands](/jadegit/0.18.0/console/registry.md) provide the ability to store version information in a target database, which can be extracted to and updated from registry data files used during the build and deploy process.

The registry provides:

* **Durability** — backed up and restored with the database by existing procedures.
* **Extensibility** — contents may be expanded to support other deployment features.
* **Safeguards** — updates are validated against current information to prevent deployment issues.

When loaded into a target database, the registry data is stored using a dynamic object (in the `_rootdef` system file), which avoids the need to deploy an associated schema. However, a variant of the JadeGit console must be deployed to target databases (including production), so it can be used during deployments to check and update version information.

{% hint style="info" icon="shuffle" %}
Rather than using the registry, the current commit may be stored separately (e.g. as a simple text file), for which the [build](/jadegit/0.18.0/console/build.md#revision) command supports the use of revision strings. However, this approach does not support tracking version information for multiple repositories and their associated schemas in the target database, nor does it provide a robust foundation for more advanced deployment features in future.
{% endhint %}
