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.  [ 8 posts ] 
Author Message
 Post subject: Update Database Schema and Data
PostPosted: Thu Jul 27, 2006 1:48 am 
Beginner
Beginner

Joined: Thu Jul 27, 2006 1:11 am
Posts: 21
Hello

I am currently building an ASP.NET web application using NHibernate. While developing I am using hbm2ddl to generate my schema and then have a pile of code that uses the objects to repopulate the database.

Once I release a beta of my app I am going to need some way to be able to upgrade the database of the installed instances. Because NHibernate supports many databases I would prefer not to create a SQL script to upgrade the database because each database would be different.

I have heard that Hibernate has SchemaUpdate but is this even able to make changes that move the data. For example you have a string property but decide to make it a many-to-one in your next release, would the current implementation of SchemaUpdate in Hibernate be able to do things like that?

Because this isn't consulting work with one client I am unable to use DB Diff'ing tools to update the DB with a staging DB server.

Any suggestions will be very much appreciated.

Regards, Jono


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 27, 2006 5:56 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
NHibernate doesn't support SchemaUpdate and there are no plans to add support for it.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 27, 2006 10:28 am 
Beginner
Beginner

Joined: Thu Jul 27, 2006 1:11 am
Posts: 21
sergey wrote:
NHibernate doesn't support SchemaUpdate and there are no plans to add support for it.


Thanks for your reply however I never said NHibernate supported SchemaUpdate. I said Hibernate does and I was just asking to see if Hibernate's implementation would even work with the example I posted. If it would work with that example and is really good I'd look at trying to port it myself; however I doubt it would be able to work with the example I provided.

Thanks again, Jono


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 27, 2006 1:00 pm 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Try posting in the Hibernate Users forum, there should be more people who would know there. As far as I know, SchemaUpdate is not smart enough to move data around. I believe it can only generate simple ALTER TABLE ... ADD COLUMN or REMOVE COLUMN statements (besides creating new tables).


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jul 27, 2006 1:09 pm 
Beginner
Beginner

Joined: Thu Jul 27, 2006 1:11 am
Posts: 21
That's what I thought. For SchemaUpdate to be smarter it would need both copies of the mapping files so it can compare and even then it would make mistakes.

I guess that I am stuck with creating an SQL Server query file to upgrade the database. Then when customers want to use Access, Oracle or MySql I will have to make scripts for those databases too.

Are you aware of any other way this could be achieved? Or some program I can use to auto-generate the upgrade script with access to the 2 copies of the DB schema.

Jono


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 01, 2006 8:44 am 
Beginner
Beginner

Joined: Thu Jul 27, 2006 1:11 am
Posts: 21
I was hoping for a reply. Is there any software out there that can generate a SQL upgrade type script from 2 databases?

Thanks, Jono


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 01, 2006 9:23 am 
Expert
Expert

Joined: Tue Aug 23, 2005 5:52 am
Posts: 335
Try AdeptSQL Diff.

There are others out there too...

Cheers,

Symon.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 01, 2006 9:31 am 
Beginner
Beginner

Joined: Thu Jul 27, 2006 1:11 am
Posts: 21
merge_s.rottem wrote:
Try AdeptSQL Diff.

There are others out there too...

Cheers,

Symon.


Thanks for that I'll try it out.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.