DbSeed
To Avoid running seeds file multiple times
Installation
Add this line to your application's Gemfile:
gem 'db_seed'
And then execute:
$ bundle
Or install it yourself as:
$ gem install db_seed
Add a
db_seedstable to your database:bundle exec rails generate db_seed:installThis will generate
create_active_record_seeds.rbfile in your applicationPlease run
bundle exec rake db:migrateUsing for existing project
This will create a record in seeds table.
bundle exec rake db:create_md5_checksum
Usage
To Avoid running seeds file multiple times, So that records won't create multiple times.
How it is works
Creating mds checksum based on db/seed.rb content, and creating one record in db_seeds table.
When db:seed task is running, creating md5 checksum and matching with database if its is same md5 checksum, I am not executing the db:seed task.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/jenorish/db_seed.
License
The gem is available as open source under the terms of the MIT License.