A Sequel extension to make seeds/fixtures manageable like migrations
Create a seed file (eg.
Sequel.seed(:development, :test) do # Applies only to "development" and "test" environments def run [ ['USD', 'United States dollar'], ['BRL', 'Brazilian real'] ].each do |abbr, name| Currency.create abbr: abbr, name: name end end end
Set the environment
Load the extension
require 'sequel' require 'sequel/extensions/seed' Sequel.extension :seed
Apply the seeds/fixtures
DB = Sequel.connect(...) Sequel::Seeder.apply(DB, "/path/to/seeds")
For more information, please check the project website.
- JSON and YAML files don't work with associations
- Only timestamped seed/fixture files
Work with Model's associations inside JSON & YAML files
If you need any help (or have found any bug
MIT License © Ewerton Assis