How do you manage schema upgrades to a production database? How do you manage schema upgrades to a production database? oracle oracle

How do you manage schema upgrades to a production database?


Liquibase

liquibase.org:

  1. it understands hibernate definitions.
  2. it generates better schema update sql than hibernate
  3. it logs which upgrades have been made to a database
  4. it handles two-step changes (i.e. delete a column "foo" and then rename a different column to "foo")
  5. it handles the concept of conditional upgrades
  6. the developer actually listens to the community (with hibernate if you are not in the "in" crowd or a newbie -- you are basically ignored.)

http://www.liquibase.org


opinion

the application should never handle a schema update. This is a disaster waiting to happen. Data outlasts the applications and as soon as multiple applications try to work with the same data ( the production app + a reporting app for example) -- chances are they will both use the same underlying company libraries... and then both programs decide to do their own db upgrade ... have fun with that mess.


I am a big fan of Red Gate products that help creating SQL packages to update database schemas. The database scripts can be added to source control to help with versioning and rollback.