tags:

views:

148

answers:

2

Hello, What is the best way to load seed (initial or test) data into grails application. I'm considering 3 options

  1. Putting everything in *BootStrap.groovy files. This is tedious if the domain classes and test data are many.
  2. Write custom functionality to load it through xml. May not be too difficult with the excellent xml support by groovy, but lot of switch statements for different domain classes.
  3. Use Liquibase LoadData api. I see you can load the data fairly easy from csv files.

Choice 3 seems the easiest. But, I'm not familiar with Liquibase. Is it good in this scenario, or only used for migration, db changes etc. If anyone could provide a better sol, or point to an example with Liquibase, it would be great help..

thanks...

+1  A: 

I'm using the Fixtures plugin to load test/initial data, it works for me.

http://www.grails.org/plugin/fixtures

speshak
thanks for the pointer.. I meanwhile decided to do it my own from xml.. I didn't explore much, but didn't see much example of fixtures usage.. Is it easy to use with one-many, many-many etc scenarios?
bsreekanth