what's your best practice for dealing with versions of sprocs with FM?

35 views
Skip to first unread message

Justin Collum

unread,
Apr 7, 2011, 1:47:26 PM4/7/11
to FluentMigrator Google Group
Here's my scenario (in my head):

Database has 3 versions. Version 3 has some FM changes as well as a
change to a sproc. The sproc is in a sql file. I roll forward by
executing the changes in FM which includes running the alter proc
script.

Deploy fails.

How do I get the sproc back to the version it was before? Alternately,
how do I get back to the version 3 versions ago? There's only one
script here and it's the new one, so I can't just run that.

Do you guys keep versions of sprocs in folders that are related to the
database version number? Seems like that would allow me to roll back
to the version of a sproc from x versions ago.

Sean Chambers

unread,
Apr 7, 2011, 1:51:32 PM4/7/11
to Justin Collum, FluentMigrator Google Group
In this case you need separate script files for each version of the
sproc. Something like:

201104011100_MySproc.sql

Then changes would need to be in:

201104051348_MySproc.sql

That's the only way you can maintain versions of the sproc.

Sean

Sent from my Windows Phone From: Justin Collum
Sent: Thursday, April 07, 2011 1:47 PM
To: FluentMigrator Google Group
Subject: what's your best practice for dealing with versions of sprocs
with FM?

Deploy fails.

--
You received this message because you are subscribed to the Google
Groups "FluentMigrator Google Group" group.
To post to this group, send email to
fluentmigrato...@googlegroups.com.
To unsubscribe from this group, send email to
fluentmigrator-goog...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/fluentmigrator-google-group?hl=en.

Justin Collum

unread,
Apr 7, 2011, 1:56:14 PM4/7/11
to FluentMigrator Google Group
That's what I was thinking. Would need to have a dir structure like:

sql
|-procs
|-versions
|-2011040701
|- myBestProc.sql
|-2011040601
|-myBestProc.sql
|-2011010101
|-myBestProc.sql
|-myOtherProc.sql
|-myFaveProc.sql
|-mySuckyProc.sql


Hmmm. Is that clunky? I'm not sold on that yet. But it would allow the
db to gracefully go from 2011040701 to 2011010101 without getting in a
screwy state. Might need to refactor that directory structure to
account for the working directory property.
Reply all
Reply to author
Forward
0 new messages