Filling the Database with Dummy Data - YaleSTC/reservations GitHub Wiki
Reservations now has a script for seeding the database with preload data! To run it, enter rake db:seed in the console. Then you can choose how many User, Category, EquipmentModel, and EquipmentObject records you want to create (as many as you want!).
Script Options
Pass environment variables to the script to affect what kind of information to prompt for.
minimal
: Attempts to prompt as little as possible, using sane defaults.
nopics
: Don't load pictures when creating equipment models. Drastically increases speed of EM generation.
fast
: Cheap shortcut for both minimal
and nopics
semi
: Uses sane defaults for account creation but prompts for quantities of users, reservations, etc.
Some things to keep in mind:
- If you're starting with an empty database, you can just use
rake db:reset
to reset the db and auto-run the seed script. The environment variables described above can also be passed to the seed script. - You can't mass delete the records that the seed script generates. If you want to delete them, you'll either have to delete them individually or drop the database and start over. (seeds are meant to fill databases, not empty them!)
- If you make any changes to these models and/or their validations, the seed script will need to be updated so that it'll still seed valid data. You'll also need to drop your database and re-seed with the updated script, or else Reservations will raise all kinds of validation errors.
- If you do make any changes to these models / validations, comment on Issue #58
Hopefully this'll help make our dev lives easier!
Related to: Issue #58