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



Add a comment on Slide 1
If you have a SlideShare account, login to comment; else you can comment as a guest- Favorites & Groups
Showing 1-50 of 0 (more)