Gitora enables developers to move changes between databases with a single click.
Gitora can also be used to generate a DDL script from the Git repository which can be used to synchronize the source code between two databases. For example, this feature can be used to generate a script to syncronize a production database to the latest version of the source code in the pre-prod database. This tutorial explains how to use this feature in Gitora.
Assume that we are connected to the preprod database and would like to generate a sync script to upgrade prod to the same state the preprod database is in.
Open the Gitora Application. Select a repo. Next, click theĀ Git –> Utilities –> Get Script button from the menubar. A dialog shows up.
The Starting Commit ID is the Git Commit ID that is currently deployed in prod. Target Commit ID is the Git Commit ID that we would like to upgrade the prod database to.
Enter the Starting Git Commit ID and the Target Git Commit ID. Use the keyword HEAD if you’d like to use the latest commit in the current active branch as the Target Commit ID.
If you’d like the script to include soft objects (i.e. database objects that execute with CREATE OR REPLACE such as packages, views etc…) check the Include Soft Objects checkbox.
If you’d like the script to include hard objects (i.e. database objects that doesn’t execute with CREATE OR REPLACE such as tables) check the Include Hard Objects checkbox.
Click the Download DDL Script button. Gitora will generate a DDL script which, if executed, will syncronize a schema (or a group of schemas) which is currently at the Starting Commit ID, to the Target Commit ID.
As seen in this example, this feature can be used to apply the latest version of the source code to a production database. If the production database is at Git Commit Point A and the new production-ready version of the source code is at Git Commit Point B, a developer can enter A as the Starting Commit ID and B as the Target Commit ID and then execute the generated script in the production database.
Please note that the table generation is master-detail relationhip aware i.e. the generated tables will be in the correct order with master tables coming before detail tables that reference them.