Evolving Agile Databases

1,044 views
978 views

Published on

Rohit\'s and Umar\'s Evolving Agile Database Presentation at Agile Mumbai 2008 Conference

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,044
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
36
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Evolving Agile Databases

  1. 1. Evolving Databases in Agile Umar Akhter & Rohith Rajagopal
  2. 2. Good DB Management Principles <ul><li>Provide each developer with his/her own DB instance </li></ul><ul><ul><li>This allows developers to try things out without affecting other developers </li></ul></ul><ul><ul><li>Sometimes a developer might want 2 instances - one for testing and another for development </li></ul></ul>
  3. 3. Good DB Management Principles <ul><li>Don't use binary db dumps </li></ul><ul><ul><li>Because they are hard to version control/merge </li></ul></ul><ul><li>Use scripts to create the DB schema </li></ul><ul><ul><li>So a new dev can easily recreate the schema </li></ul></ul>
  4. 4. Good DB Management Principles <ul><li>Version control the scripts used to create/change the DB schema </li></ul><ul><ul><li>To keep the DB schema in sync with the code which uses it </li></ul></ul><ul><li>Automate running the scripts which create the schema </li></ul><ul><ul><li>Because you will need to create the schema multiple times and you should automate repetitive tasks. </li></ul></ul><ul><ul><li>Use bat file or ant file </li></ul></ul>
  5. 5. Good DB Management Principles <ul><li>Use alter scripts rather than drop table and recreate (or hbm2ddl) </li></ul><ul><ul><li>both drop table/recreate and hbm2ddl will delete existing data </li></ul></ul><ul><li>Don't hardcode the paths while automating </li></ul><ul><ul><li>It's easier to move across machines if the paths are in one place (property file, environment variables) </li></ul></ul>
  6. 6. Good DB Management Principles <ul><li>Make sure your tests are easily repeatable </li></ul><ul><ul><li>You should be able to run your tests any number of times without manual intervention in between </li></ul></ul><ul><ul><li>Make your tests clean up after each run </li></ul></ul><ul><li>Make sure your scripts are repeatable </li></ul><ul><ul><li>You shouldn't need any manual steps to figure out which script to run to get your DB schema right </li></ul></ul><ul><ul><li>You should be able to invoke the same command which (irrespective of the current state of the DB) will upgrade you to the correct version of the schema </li></ul></ul>
  7. 7. Good DB Management Principles <ul><li>Use a tool like DB Deploy which </li></ul><ul><ul><li>Keeps track of applied alter version in the DB </li></ul></ul><ul><ul><li>figures out from the schema + the alter files which alters to apply </li></ul></ul><ul><ul><li>Upgrading production databases becomes very easy </li></ul></ul><ul><ul><li>Reduced testing overhead for upgrade scripts </li></ul></ul><ul><ul><li>Deployment becomes easy and fast!! </li></ul></ul>
  8. 8. Further Reading <ul><li>http://martinfowler.com/articles/evodb.html </li></ul><ul><li>http://databaserefactoring.com/ </li></ul><ul><li>http://goforthandcode.blogspot.com/2007/12/brief-history-of-database.html </li></ul><ul><li>http://goforthandcode.blogspot.com/2008/01/schema-to-survive-winds-of-change.html </li></ul>

×