-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

Are you using NHibernate in .NET 2.0?
Poll ended at Thu Aug 18, 2005 9:52 am
No 42%  42%  [ 5 ]
Yes, but without using Generics 17%  17%  [ 2 ]
Yes, and I use generics 42%  42%  [ 5 ]
Total votes : 12
Author Message
 Post subject: Best practices for migrating db schema changes to production
PostPosted: Tue Jul 19, 2005 9:52 am 
Regular
Regular

Joined: Fri May 13, 2005 4:08 pm
Posts: 64
Are there recommended procedures for migrating database schema upgrades from development to production database servers?

I'm almost done writing a web app that uses NHibernate through a class library I've written. I know that shortly after release of the first version, I'll be changing the db schema some more to add features and such. The changes will likely include added, moved and removed columns, changed column datatypes, and new tables.

So far in development, when I change a mapping file, I just have NHibernate tear down and rebuild the whole database, and I have code to fill the db with some initial data I use for development. But how can I safely merge these schema changes into production to minimize lost data and time?

I'm hoping that there's a best practices list or something. The two ways that strike me are:
    1. Write a routine that loads every single object from the database into memory (using NHibernate), then rebuild the database, then persist every object back again.
    2. Go through the database structure myself (using SQL Enterprise Manager in my case) and actually add the tables, change the datatypes, etc. that were done automatically for me in the dev db. The problem I see with this is NHibernate seems to have finer control over datatypes than what SQL Enterprise Manager lets me see. For example, the varbinary datatype may appear to have one length, but if I reproduce it in another db, NHibernate somehow recognizes that it is not the original, and crashes until I let NHibernate rebuild it.


Can anyone with experience or good ideas share them?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 19, 2005 10:19 am 
Regular
Regular

Joined: Mon May 16, 2005 2:15 pm
Posts: 59
We use a tool called Db Ghost to handle our SQL change management. It can generate change scripts to move the schema from one version to another.

Of course if you make data destructive changes such as move a column from one table to another you will have to create some manual scripts in there too.

Red Gate also makes a tool called SQL Compare that I hear is pretty good. But, we use Db Ghost to source control the DB scripts and source also. We also use it during our build scripts to update the schema from one dev build to another via NAnt.

hth,
BOb


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 19, 2005 12:51 pm 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
Hum, I should really try out Db Ghost :)

ATM, I'm applying changes by hand (using SQL Server generated change scripts)

Another nice solution would be to port Hibernate's SchemaUpdate :)

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 22, 2005 7:38 pm 
Senior
Senior

Joined: Wed Jun 15, 2005 4:17 am
Posts: 156
I'm using Sql Compare from Red Gate. Basically works by scripting out the schema of the databases being compared and using a FileDiff like approach in showing the differences between them. Then it generates the script needed to synchronize the objects. I found it very productive and easy to use. I have no experience with DB Ghost though.

Cheers,
Radu


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 23, 2005 5:30 pm 
Regular
Regular

Joined: Fri May 13, 2005 4:08 pm
Posts: 64
KPixel wrote:
ATM, I'm applying changes by hand (using SQL Server generated change scripts)

I'm familiar with SQL Enterprise Manager, and generating SQL scripts using it. But change scripts? How do you generate those?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jul 24, 2005 10:37 am 
Contributor
Contributor

Joined: Thu May 12, 2005 9:45 am
Posts: 593
Location: nhibernate.org
aarnott wrote:
KPixel wrote:
ATM, I'm applying changes by hand (using SQL Server generated change scripts)

I'm familiar with SQL Enterprise Manager, and generating SQL scripts using it. But change scripts? How do you generate those?


In fact, I use VS.NET to modify SQL Server databases (editing columns/keys/...)
When I save, it generates the change script and ask me if I want to save it (it is possible to disable this option).

_________________
Pierre Henri Kuaté.
Get NHibernate in Action Now!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 26, 2005 7:16 am 
We are testing Apex Sql Diff which seems rather good. Give it a try...

http://www.apexsql.com/sql_tools_diff.asp

cheers

Thibaut

[blog] http://www.dotnetguru2.org/tbarrere


Top
  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.