Topic: Prepopulate DB before running the application
I have the application which should have some data prepopulated before it runs. There are a few options:
- Use normal SQL execution to populate the DB
- Use something in Rails (e.g. migrations - if possible) to do this
- Use special Rake tasks for this
- Create the missing data in the application when necessary (lazily).
For example, one of the things is the set of roles for authorization. I need a table 'roles' with rows for 'admin', 'user' and 'guest'. What would be the best way to do this? If you had a similar problem, what did you do? The greatest problem obviously is making everything work so automated systems (e.g. Capistrano) can deploy it in a correct state - this is not necessary for the last of the above options, of course. If you have a link to some explanations about this, this is also welcome.
Merry Christmas to all of you celebrating it!