(Newbie) Need a procedure to handle data migrations

A SQL Server Management Studio add-in to source control your database in Subversion or Team Foundation Server.

Moderators: Chris Auckland, David Atkinson, sherr, PhilScrace

(Newbie) Need a procedure to handle data migrations

Postby chrisherring » Fri Oct 21, 2011 12:55 am

The most common problem I am running into is adding new NOT NULL columns to tables. Before Source Control, this was simply a matter of executing a script against each DB:

1. add the column to the table
2. set initial value in exiting rows
3. alter column to not null

What's the right approach with SQL Source Control?
chrisherring
 
Posts: 4
Joined: Fri Oct 21, 2011 12:49 am

Postby David Atkinson » Fri Oct 21, 2011 5:31 am

Have you tried the latest v3 early access build? This has a feature that lets you add your own custom migration script to override default behavior. What you need to do is to add a migration script to cover the change in which the NOT NULL column was added, and to edit the default script to add the UPDATE statement.

see:
http://www.red-gate.com/MessageBoard/vi ... hp?t=14110

This feature works with TFS, SVN and Vault for the time being. Which do you use?

David Atkinson
Product Manager
Red Gate Software
David Atkinson
 
Posts: 1124
Joined: Mon Dec 05, 2005 4:54 pm
Location: Twitter: @dtabase

Postby chrisherring » Fri Oct 21, 2011 6:11 am

David,

Thanks for the information. The Data Migration feature sounds like exactly what we need. We are using git; I take it that means we cannot use the v3 build yet.

Chris
chrisherring
 
Posts: 4
Joined: Fri Oct 21, 2011 12:49 am

Postby David Atkinson » Fri Oct 21, 2011 10:30 am

That's right, there isn't GIT support yet. Can I ask you to raise a feature request here so we can size the community interest?

http://redgate.uservoice.com/forums/390 ... ce-control

Although there's one for Mercurial, there isn't a migrations feature request for GIT support, so you'll need to create a new one.

Thanks,

David
David Atkinson
 
Posts: 1124
Joined: Mon Dec 05, 2005 4:54 pm
Location: Twitter: @dtabase

Postby chrisherring » Fri Oct 21, 2011 11:01 am

Feature request added.

Thanks

Chris
chrisherring
 
Posts: 4
Joined: Fri Oct 21, 2011 12:49 am

Postby David Atkinson » Fri Oct 21, 2011 11:04 am

Feel free to try out the feature on a 'test' database using the 'just evaluating' option and provide us with feedback on the feature itself.

Thanks.

David
David Atkinson
 
Posts: 1124
Joined: Mon Dec 05, 2005 4:54 pm
Location: Twitter: @dtabase


Return to SQL Source Control 2

Who is online

Users browsing this forum: No registered users and 0 guests