Worked example - source-controlling a database using scripts folders
Published 24 February 2022
Redgate also provides a dedicated source control tool for Oracle databases, Source Control for Oracle, available for purchase as a standalone tool or with the Deployment Suite for Oracle.
These examples show how you can use scripts folders to source-control a database.
In the examples, we'll use the Subversion (SVN) source control system and the TortoiseSVN client. The principles are the same with any source control system.
Example 1: source-controlling a scripts folder
In this example, we want to source-control our WidgetStaging database schema.
First, we create a scripts folder from our WidgetStaging schema.
We name the scripts folder WidgetScripts, and create it in our SVN source control repository:
Then we add the scripts folder to SVN:
We type a commit message and commit the change.
The scripts folder representing the WidgetStaging schema is now under source control.
Example 2: committing another version of the schema
In this example, we have made some changes to the WidgetStaging schema and want to commit them to source control.
We deploy the WidgetStaging schema to the WidgetScripts scripts folder:
Then we commit the scripts folder changes to source control:
We type a commit message and commit the change. The scripts folder representing the WidgetStaging schema is now up to date.
Example 3: updating to an earlier version of the database
In this example, we want to update to the first version of the WidgetStaging schema we source-controlled. We can do this by update to the earlier version of the scripts folder in SVN and deploying from it using Schema Compare.
To do this, first we update to the first version of the scripts folder in SVN:
Then we begin a new deployment in Schema Compare. We select the scripts folder as the source and the WidgetStaging schema as the target:
Finally, we deploy to the database using the deployment wizard.
The WidgetStaging schema is updated from the WidgetScripts scripts folder.