Show TranscriptHide Transcript
Hello, my name's John Pocknell, Toad for Oracle product manager. Welcome to this multi-part series on enabling agile database development using Toad for Oracle. In step 1, we're going to talk about what Team Coding is and how to set up Team Coding with version control and integration.
So why is this important? Well, Team Coding is a utility in Toad which provides a convenient way to control database objects and scripts within a team environment through a single common interface. You can also optionally link Team Coding to a third-party version control system, such as Subversion or Git, in order to maintain a revision history for database changes to your objects and scripts in a team-based environment.
Team Coding enables developers to work directly on a database object without having to access the files directly in source control.
Team Coding constantly reconciles any object changes that are made with the corresponding file in source control, and keeps them in sync at all times.
There are optional policies which facilitate PL/SQL regression tests and code reviews at check-in. This is important if you have a trigger which initiates an automated build process as developers check code into source control.
So effective version control becomes an essential part of moving traditional development processes to agile. So let's get started with a demo, and I'll walk you through the various steps to get Team Coding set up.
Here's my Toad UI. And the first thing you want to do is to go to the Team Coding menu item and select Configuration. So we're going to install the repository for Team Coding, and this will help reconcile the objects in your database with the files in source control.
When you run this for the first time, you need to be a user with the DBA role granted. And then once you have the repository built, there'll be a role created called a TC Admin role, and then that role can then be assigned to somebody in the dev team to administer Team Coding moving forward.
OK, so the first to do is on this button here, Install Team Coding to Database. And by default, it's going to create the objects in a schema called Toad. This is generally recommended, actually, so that you can have all the Toad-related objects in one place.
It will create a role called TC Admin role. You just need to specify the table spaces in which to create the repository tables and indexes. Click Next.
So here's the script that will create the repository. You can just go ahead and run that. OK, so now we have the repository objects created.
The next thing you want to do is to select your version control provider, because we're going to need to tie Team Coding with the back-end version control system. So these are all the version control providers that we currently support. I'm currently using Subversion, so I'll select Subversion. This button at the end here will enable you to check the settings. It gives you the executable name, any server defaults, any options that you might want to have set.
So once you have your Team Coding Repository created, the next thing to do is to create a project inside of Team Coding that maps to a project inside your version control provider. OK, so go to Team Settings just to make sure you have a VCS provider selected. In my case, Subversion. You can see a list of other providers that we have here.
And then select Team Projects, and click Create a New Team Project. Now, you can call this anything you like. I'm just going to call it dev project.
And then go to your VCS window and just click this button here to look up any projects that you have in your version control provider. So here's my VCS log-in. In my case, Subversion. If you're using a different version control provider, then obviously this will look different. Click OK.
And you can see here, this is my top-level SVN, but I don't have any projects defined in my version control system yet. So I'm going to create one inside of Toad. If you did have projects already existing, then you could just simply select the one that you want to map to your Team Coding project, and then you can start mapping the files back to objects in your database.
So I'm going to click New and type in here the same name, dev project. And click OK. So that's now created a project called dev project in my version control system.
There it is there. I'll select it and click OK. So that's the VCS project mapped to my team project.
I can use subfolders to distinguish different types of objects. So each object, whether it's a table or a view or a function or a stored procedure, will be contained in its own subfolder. I'm not going to use a parent folder, because I don't need one in this particular example.
And then I'm going to add the schema, and the objects in that schema that I want to have relate to that version control project. So I'm going to select quest dev as my schema.
And now I can select which objects I want to include. I can include all of them, or I can just have PL/SQL. Equals So I could unselect anything that's not PL/SQL. I'll go ahead and select them. There are not that many objects in here.
You can also-- so these include filters that you can set, which we click this button at the end here, Edit Object Filters. You can decide whether you've got specific objects that you want to include and specific objects that you want to exclude.
So I'm going to go ahead and click OK. If you want to set a policy whereby you run a code review each time a developer checks their code in, then you can assign that at the project level. Because you might have different projects with different coding standards, and code analysis is our coding standards utility.
So I just show you this. You just simply turn that on. This is available with Toad Professional and higher. And then you can select whatever threshold settings you want to determine whether code gets checked in because it meets the quality requirements, or doesn't get checked in because it failed to meet the quality requirements, by selecting these options. OK, so I'll leave that disabled for now.
At the team settings level, there's another option that says Run Code Test to test before check-in. So if you have a code tester repository set up, then at a point a developer checks a piece of code in, it will run all the tests associated with that piece of code first, to see if they will pass. If they don't, if some of them fail, then the developer gets notified, and that piece of code is prevented from being checked in, because there's a bug in it. So I'll leave that unchecked for now.
And then click OK. So at this point, it says I created a new project in version control. And it's saying, do you want to create a new revision in my version control system based on the objects I just selected in Team Coding? So I'll say yes.
So here's a list of all the objects in the quest dev schema that are going to be basically registered for the first time in my VCS project which is called dev project quest dev and the name of the object. And these are all the objects.
So I'll click OK. And now that's going to create a new instance of all of these files, essentially file representations, of the objects that are in my database schema called quest dev.
So once all of the code has been checked in to your source control for the first time, then you'll get this message, and your revision has been successfully created. So click OK.
And the next thing to do is to look at the Team Coding Manager. Now, Team Coding Manager is a way to view both the objects in Team Coding as well as the objects that are in source control. So there is the Team Coding, Team Coding Manager.
So you get this slide-out panel here. So if we look at team projects first of all, here's our dev project with the schema. You can have different schemas, of course. And then underneath each of these, you'll see the objects that are now registered with Team Coding and their current status. In this particular case, they're all available.
If I go to the VCS tab, you'll look inside of the source control system. Again, I get a log-in. Once it's logged in, it will show me what I have there.
So here we are. SVN. Here's my dev project in Subversion. Underneath that, my schema. And now under that, all of my object types.
Remember the subfolders I selected. These are the subfolders it's created. Look at that function. And now see the code. And again, status is showing that it's available.
All right. So that's it set up. In our next video, we'll talk about how you use Team Coding to check objects in and out of source control. Thank you for listening.