Grails build-test-data

Is it possible to use the build-test-data plugin to load boot (seed / initial) data for an application. The plugin tutorial is great for http://bitbucket.org/tednaleid/grails-test-data/wiki/Home , but only mentions loading test data. There is a section on TestDataConfig that allows you to set default data. But is this a viable option if the data needs to be stored on a wider scale, with complex relationships. \ thanks.

+4
source share
2 answers

Testing data is the main focus of the plugin, but I use it for all types of data loading situations, including downloading data to a new system.

The only thing you need to know is that the design plugin will fill any holes in the required data that you will not give. This means that you must specify everything that you really want to use certain values ​​(or put them in the TestDataConfig tag that you mentioned). If you don't give build-test-data a value, it will do something, and it may be something you don't want.

The recently added functionality around buildLazy makes it easy to snap to the existing graphics of objects that may be in the BootStrap configuration.

+2
source

It depends on your data. If you need only some things, such as administrator account information, category list, etc., it should work fine. I would use it if you are testing your application with seed source data and everything works fine. For large or complex import data, I would use a gant script to create and save for all domain objects. For example, I am working on a project that requires me to move data from an old database to a grails application. To do this, I run a script that uses JDBC calls to retrieve all the old data from the old database. Then I create and save new domain objects based on this data. An example of using a script that has access to the entire Grails context, including Gorm, see this

+1
source

Source: https://habr.com/ru/post/1309379/


All Articles