Features
Pokotarou is convinient Mysql seeder of Ruby on Rails.
Easy to use!!
Just use yml file.
very very very simple!
You dont' have to write ruby program about seed data!
Fast speed!!
Pokotarou is fast seeder.
Because contains Activerecord-import.
so, always run bulk insert when execute rails db:seed command!
If you use Pokotarou about following table.
Field | Type | NULL |
---|---|---|
id | bigint(20) | NO |
name | varchar(255) | YES |
created_at | datetime | NO |
updated_at | datetime | NO |
Pokotarou can register 10,000 records in 0.41s on average.
Getting started
Add this line to your application's Gemfile:
gem 'pokotarou'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install pokotarou
Basic Usage
Just make yml file.
If you register data to following prefecture data.
prefecture table
Field | Type | NULL |
---|---|---|
id | bigint(20) | NO |
name | varchar(255) | YES |
created_at | datetime | NO |
updated_at | datetime | NO |
prefecture model
Model |
---|
Pref |
First, Please make following yml file your favorite directory of rails project.
The file name can be anything.
In my case, made yml file in db directory and named file pref_data.
Default:
Pref:
loop: 3
and write following ruby code in seeds.rb.
Pokotarou.make("./db/pref_data.yml")
and execute following command!!!!!
$ rails db:seed
prefecture data is registerd your db. Let's check with the following code.
# You have to get 3
Pref.all.count => 3
Documentaion
You can read a lot more about Pokotarou in its official docs
License
The gem is available as open source under the terms of the MIT License.