Data container branch
Published 07 December 2021
Contents
What is a data container branch?
Similar to a source control branch, a data container branch is a lightweight movable reference that points to a particular version of a data container.
This reference pointer can be manipulated (i.e. moved up and down) with the help of the save, load and reset rgclone commands.
In a little more detail
The first time a data container is created from a data image, a new timeline is created by default.
You can think of the default timeline as the default Git branch (main
).
Changes made to your database (aka the data container) can be recorded along this timeline as revisions.
When you load a previous revision, a new timeline is created.
You can think of this as a new branch.
How does this help me?
In practical terms, a branch allows you to keep different working versions of a data container and to switch between them at will during development, giving you more flexibility.
Example
In this example we create a new data container and make 3 revisions to it.
Initial revision
Let's begin by creating an empty SQL Server 2019 data image (with id 3 in the example) and a data container from it (also with an id 3).
Notice in the last line above that the created data container has revision rev.0
.
This effectively creates the "main"
branch of our data container.
Making changes to the data container
You can now make changes to that data container by executing any SQL you like.
Open your favourite SQL editor and make any visible change (e.g. add a new table).
Creating a new revision
Then go back to the command line and save a new revision of the data container.
Notice the data container has now revision rev.1
.
Saving more revisions
If you perform more save operations, revisions will be created as you do so.
After 3 save
operations, this branch now contains rev1
, rev2
and rev3
.
Create new branches by loading revisions
You can now load any revision you like.
In our case we load rev1
. A new branch with a randomly allocated suffix is created.
Further branching
If we connect to that new data container and made more saves, your new branch would now have rev1.xxxx.1
, rev1.xxxx.2
, and rev1.xxxx.3.
The format employed is as follows:
rev1 | xxxx | 3 |
---|---|---|
name of the data container | branch identifier | revision number on this branch |