Sep 8, 2017 5:24:00 PM by Mark Kurtz
Working with Toad Edge you can store versions of your database objects in a file system repository. This gives you a way to reference and compare database objects without having to use a Version Control System (VCS). You can always add these objects to a VCS in the future if you need to.
To start the process in Toad Edge, choose a database you want to version:
In this case I am going to use the Sakila database. Right-click on the database and then choose Repository.
If this is the first time you have mapped this database you will only see the ‘Map Database’ option available to you.
Click on that menu item.
A window will open that asks for a path to the file system folder you wish to use. You can use anything, and it can be local or on the network. Using a network location will make it easier to share this repository with other members of your team. I will cover this later.
In my case, I am just using my C: drive and I gave the repository the name sakila1. Again, you can use any naming convention you wish. Once you have provided the path, click OK.
Once you click OK the progress bar window shown below will open. If you have a large database you may want to run this process in the background.
When the repository is built the window above will close and you will see a comparison of what is in the database and what is in the repository.
Now, you will notice that the repository doesn’t show anything on the right-side window.
What’s up with that?
What has happened so far is that we have told Toad Edge that we want to track changes to these objects and we have ‘cataloged’ them, but we have not synchronized the database with the repository yet.
So what do we do? We synchronize the two.
From the comparison window simply click on the dropdown arrow next to the file folder icon and choose ‘Update Objects in Repository’.
You will be prompted with a confirmation window:
Click OK to continue.
You will then see that the comparison window has been updated to show the repository on the right side. Now, you may be wondering why you don’t actually see any objects in either window now. That is because before you ran the sync there were differences between the database and the repository (the repository was empty). Now that they have been synched there are no differences. As you work on the objects in the database the changes will be reflected in the comparison window.
Since we have synched the database to the file system repository you can now go to the file folder and see the objects.
Each object type has it own folder. When you expand a folder you can see the objects therein:
You can see that there are 16 tables in the TABLE folder. These are saved as JSON files so you can access them as needed.
Here you can see the file structure of the actor.json file, opened in Toad Edge:
Now let’s make a change to a table.
In the screen shot below you can see that I added a column to the actor table. I just called it ‘five’.
On the left side you will see that the actor table now has a red key icon highlight. This indicates that there has been a change made to the table (or whatever object you may be working on). You will also see [Found Changes in DB…] next to the table name.
Now we need to resynch the database and the repository. Right-click on the database and choose Repository then choose Synchronize. This will compare the two environments.
Now you see that the Actor table has been flagged as being different between the database and the repository and you can see the differences in the comparison screen.
Now we can resynch the two environments by choosing “Update Objects in Repository”:
Once the sync is done the comparison window will refresh and show nothing is out of sync and the database and repository are the same.
In conclusion, Toad Edge makes it easy to work on your database and store your changes in in a repository, which can also be shared with other team members so everyone can stay in sync.
There is also a video available here on Toad World that shows how you can store these objects in a GIT repository, but the concept is the same for other VCS systems you may be using.
I hope you found this information helpful and stay tuned for more Toad Edge blogs.
Written by Mark Kurtz
Mark Kurtz has been with Quest Software since April 2000 and has held the position of Software Sales Engineer in the PreSales Organization since then. Mark started his career as a programmer/analyst for NASA supporting the Space Shuttle program. He became a DBA after moving into the health care industry and has managed several teams of DBA's in his career. Outside of work, Mark enjoys spending time with his family, playing poker, and working on old cars and woodworking.