-->
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.  [ 6 posts ] 
Author Message
 Post subject: Schema evolution best practices?
PostPosted: Mon Apr 07, 2008 1:18 pm 
Newbie

Joined: Thu Jan 24, 2008 5:17 pm
Posts: 6
A more general question, for which I hope the answer is "read this document"; I just haven't found it yet.

I'm getting ready for the first alpha of my product; from that point forward, I would like to keep my DB pretty much live, without wiping it and starting again. However, I expect to be modifying the product frequently -- indeed, constantly -- for at least the next year, and those modifications are often going to hit the DB schema.

So the question is, within the Hibernate framework, what's the best way to manage my schema evolution? My system is Hibernate-centric at this point: I actually started with the HBM files, because I'm very comfortable working in that sort of metadata and going outward in both directions from there. But the documentation I've found so far says little about schema evolution, except to imply that it's dangerous to use Hibernate's automated schema-modification mechanisms in a live production DB.

How do people deal with this? Do I need to simply keep track of my schema changes, and write manual ALTER TABLE commands to apply them as I roll out subsequent iterations? Use the automated tools, but manually vet its suggestions for changing the DB? Obviously no automated tool can possibly cope with major structural changes, but it would be nice if Hibernate can make life easier for easy changes like adding new columns.

I'm hoping that there are at least established best practices for how to manage this, since I expect to be doing quite a bit of it, rolling out revs every month or two. Thanks for any suggestions...


Top
 Profile  
 
 Post subject: I have the same concern
PostPosted: Mon Apr 07, 2008 4:24 pm 
Beginner
Beginner

Joined: Mon Apr 07, 2008 12:49 pm
Posts: 33
Hey,

I decide to generate alter script by using TOAD compare schema's.
TOAD can show you the diff and generate the alter.

if you found another solution i will be happy to read about it.


Top
 Profile  
 
 Post subject: ALTER TABLE scripts
PostPosted: Tue Apr 08, 2008 10:33 am 
Beginner
Beginner

Joined: Mon Aug 15, 2005 10:20 am
Posts: 32
Location: Brazil
I rely on manually-generated ALTER TABLE scripts. I'm currently evaluating using Liquibase for this.

_________________
Don't forget to rate!


Top
 Profile  
 
 Post subject: Re: ALTER TABLE scripts
PostPosted: Tue Apr 08, 2008 10:26 pm 
Newbie

Joined: Sat Jan 05, 2008 2:19 am
Posts: 3
You may also be interested in the Hibernate functionality that has recently been added to LiquiBase. See http://www.liquibase.org/manal/hibernate.

The new feature allows a combination of hbm2ddl-like functionality along with the control you get over manual alter scripts.

Basically, there is now a LiquiBase command that will compare a hibernate mapping config and an existing database and automatically append the required changes (add table, add column, drop column etc). You can then simiply run the changelog file as it is or modify it as needed.

And since it is a standard LiquiBase change log file, you get all the other LiquiBase functionality such as the ability to tag and rollback changes, generate change documentation, and more.


Top
 Profile  
 
 Post subject: Do you know if i can do it for annotation classes?
PostPosted: Wed Apr 09, 2008 1:45 am 
Beginner
Beginner

Joined: Mon Apr 07, 2008 12:49 pm
Posts: 33
i am working with JPA (hibernate is the implementor).


Top
 Profile  
 
 Post subject: Re: Do you know if i can do it for annotation classes?
PostPosted: Wed Apr 09, 2008 9:25 am 
Newbie

Joined: Sat Jan 05, 2008 2:19 am
Posts: 3
avimar wrote:
i am working with JPA (hibernate is the implementor).


It should work fine. The LiquiBase diff engine uses hbm2ddl as a base which I think supports JPA annotations.


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