New to SQL Source Control - how to get initial source commit

shiftbitshiftbit Posts: 12
Have SVN and a repository structure like so:
Tags
Branches
Trunk

How do I get a scripted copy of my database(s) into trunk?

Typically, trunk is reserved for merging changes INTO from other branches.

So in a typical scenario, I would branch code off to one of the branches, then make changes there. Ive been going through some of the examples on the red gate site, but am still a bit confused with "linking".
ie, http://www.red-gate.com/supportcenter/C ... Setting_up

Say I have a local instance and I have also made a branch of the code from trunk to work on.
1st,
How do I get this initial copy into trunk
2nd,
How do I point my local db at my branched code?

I created a test branch, and managed to link my local instance to this path. I made a simple procedure change, committed the change, then checked the branch. Nothing there?


This is the work flow I am hoping I can achieve:
- create an initial copy of several databases in trunk (how?)
- branch this code to make changes within the branch
- the branch will be checked out locally and used against a local instance of the given database
- merge changes back into trunk
- apply changes from trunk to target database on a different server

Comments

  • Ok, now that just posted all of the above, I think my problem was the subversion repository browser. I closed it down and re-opened, and my test branch had a scripted copy of my database.

    So, now I think I see the path I need to take to get my database(s) into source.

    Make a backup copy of each of my database(s)
    restore them locally
    link each to a path in Trunk in subversion, each in their own folder
    this should create the scripted versions in trunk
    THEN I can branch from there to make changes in the branch...err I think

    So lets say I create a branch to work on, and I have a local instance, how can I point this local instance at my branched code?
  • If you create a branch, you simply link your database to that branch in the same way you did when linking the trunk.

    Let us know how you get on.

    David Atkinson
    Red Gate
    David Atkinson
    Product Manager
    Redgate Software
  • David,

    Thanks for the reply. That is what i am about to do this morning. Putting our sql objects under source control is a top priority of mine, so I can keep track of changes. I will report back when Im finished.
  • Ok, I managed to finish earlier today getting several databases scripted and placed into our subversion repository. Using a combination of SQL Compare and SQL Source Control, I did the following:

    - created empty local databases
    - use sql compare to basically re-recreate the database that I want to version and use as a starting point (the production db server).
    - once I had local instance copies of the databases I wanted to version, I linked each one in turn with a path in the main branch of svn (trunk).
    - since this was new, all the changes were "add", so i committed the changes and now I had these db's scripted and in subversion! success, a starting point for further development.
    - now I branched trunk to create a development branch.
    - checked out this development branch, made a small update, and committed the changes.
    - re-linked the database that was associated with the change, then did a "get latest" from within SSMS and the source control tab. A conflict was detected and I took the version in SVN.
    - now my local instance had the update.

    im cooking now!
Sign In or Register to comment.