Re: Schema Evolution

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Jan 25 2006 - 15:11:31 EST

  • Next message: Steve Lorimer: "SQLTemplate & HSQLDB question"

    Would be nice to integrate this with DbLoader/DbGenerator and of
    course CayenneModeler. With other Cayenne things, I don't think I'll
    ever have the time to do it. But if there are volunteers who need
    such tool badly enough, I'll be happy to collaborate ;-)

    Andrus

    On Jan 25, 2006, at 2:43 PM, Jonathan Carlson wrote:

    > http://db.apache.org/ddlutils/ does schema evolution. The downside is
    > that the XML file formats are different, although you could use
    > ddlutils
    > for your schema maintenance and write an XSLT converter to Cayenne
    > format.
    >
    > DDLUtils looks very cool, although I haven't actually tried it because
    > I haven't had an excuse yet. You can point it at a database and
    > read in
    > your data model (like Cayenne does) but with indexes and foreign keys,
    > etc. Then add/remove columns, indices, foreign keys, constraints, etc
    > and then have it update the schema with alter statements.
    >
    > They are still working towards a 1.0 release so not all DBs work
    > equally well yet, but it looks like an exciting project to me. I
    > expect
    > someone will create a database management web app or Swing UI using it
    > at some point.
    >
    > - Jonathan
    >
    >
    >>>> andru..bjectstyle.org 2006-01-25 10:55:33 AM >>>
    > Bruce,
    >
    > To the best of my knowledge there have been no substantial
    > improvements in this area so far.
    >
    > Andrus
    >
    >
    > On Jan 24, 2006, at 10:51 PM, Bruce Alspaugh wrote:
    >
    >> Have there been any updates to support schema evolution since this
    >> was posted? Is schema generation still all or nothing?
    >>
    >> Bruce
    >>
    >> On Jul 23, 2004, at 5:54 PM, Andrus Adamchik wrote:
    >>
    >> Hi Jonathan,
    >>
    >> As this raises a valid concern, it can't be "too critical" ;-) BTW,
    >
    >> this has been discussed multiple times in the last few months.
    > So....
    >>
    >> 1. You are right - current Cayenne schema generation is all or
    >> nothing.
    >> You can drop and recreate your tables but there is no "merge".
    >>
    >> 2. In the future we will definitely improve that. This is in the
    >> plans.
    >> However there is a huge BUT, which lead us to (3)...
    >>
    >> 3. In a general case "merging" DB schema with the evolved model is
    > not
    >> just add/drop column. Most real life migrations between schema
    >> versions
    >> are incomparably more complex than that. They involve moving data
    >> within and between tables, modifying this data in the process,
    >> intermingling DDL and DML statements, and is generally impossible to
    >> automate.
    >>
    >> In my work as a consultant, I've spent a fair amount of time on
    >> various
    >> projects trying to automate or at least improve tedious database
    >> schema
    >> upgrade process between the code versions. My conclusion is that
    > full
    >> generic (and most importantly - working) automation is impossible.
    > If
    >> you have a production DB with lots of data, expect doing manual SQL
    >> coding. Somebody please prove me wrong on that!
    >>
    >> On a more optimistic note, we can still *greatly* improve this
    >> experience by providing a dumb generated "SQL patch" that compares
    >> current DB state and current Cayenne DataMap, and generates "create
    >> table/add column/drop column" statements without regards to the
    > actual
    >> data migration path... It can be saved and later manually customized
    >> for the actual DB run. That's where we are heading.
    >>
    >> A bit unrelated, I guess I should follow the suggestion made
    > privately
    >> by Michael Gentry and set up a Wiki for Cayenne, so that such
    >> discussions could leave a trail and an actual implementation
    > roadmap.
    >>
    >> Thanks
    >> Andrus
    >>
    >> On Jul 23, 2004, at 5:20 PM, Jonathan Carlson wrote:
    >>> I hope I didn't sound too critical in my note below. Cayenne is a
    >>> very easy to use tool and I'm sure it will only get easier to use
    > as
    >>> time goes on. My thinking that Cayenne might make this really easy
    >>> for me is a testament to how easy it is already.
    >>>
    >>> As I thought about it I realized that adding a column could be a
    >>> difficult thing for Cayenne to manage if the column was mandatory
    >>> because Cayenne does not yet allow a default value specification.
    > I'm
    >>> hoping that specifying a default value will be a new Cayenne
    > feature
    >>> soon since it seems like a useful feature and all databases (I
    > think)
    >>> support it at some level.
    >>>
    >>> Are these features "on the horizon" or "down the road further"?
    >>> (default column specification, and smarter schema evolution)
    >>>
    >>> Thanks,
    >>>
    >>> Jonathan
    >>>
    >>>
    >>>>>> "Jonathan Carlson" <Jonathan.Carlso..atun.com> 2004-07-23
    > 1:37:07
    >>>>>> PM >>>
    >>> I did a quick test to see how Cayenne handled adding a new field
    > when
    >>> there was data already in the table. I was secretly hoping that
    >>> Cayenne would do the right thing and generate an add column
    > statement
    >>> rather than a create table statement, but it didn't.
    >>>
    >>> To top it off, clicking on the "Generate" button resulted in a
    >>> "Schema
    >>> Generation Complete" message as if the db schema now matched what
    > was
    >>> in Cayenne, which it didn't because no column was added.
    >>>
    >>> Is this a bug or just a missing feature? What's the best way for me
    >>> to handle this situation? Add columns manually?
    >>>
    >>> Thanks in advance!
    >>>
    >>> Jonathan
    >>>
    >>>
    >>>
    >>>
    >>
    >
    >
    > ______________________________________________________________________
    > This email has been scanned by the MessageLabs Email Security System.
    > For more information please visit http://www.messagelabs.com/email
    > ______________________________________________________________________
    >
    > ______________________________________________________________________
    > This email and any files transmitted with it are confidential and
    > intended solely for the use of the individual or entity to whom they
    > are addressed. If you have received this email in error please notify
    > the system manager.
    >
    > Katun Corporation -- www.katun.com
    > _____________________________________________________________________
    >



    This archive was generated by hypermail 2.0.0 : Wed Jan 25 2006 - 16:52:35 EST