Seeding the Databases - govfollower/gf-api GitHub Wiki

The GovFollower API database contains several files in the assets directory that contain default data for the tables in the database. These include:

  1. CSV File with all the States, their abbreviations, and number of voting districts.
  2. JSON File containing basic information for all House Representatives as of May 2017.
  3. JSON File containing basic information for all Senate Representatives as of May 2017.

In order to insert this seed data into the database, you need to run several commands from the rails console.

LAUNCH RAILS CONSOLE

rails c

SEED STATES DATA (in rails console)

CsvImporters::UsStatesImporter.new().perform

SEED DISTRICTS DATA (in rails console)

CsvImporters::DistrictsImporter.new().perform

SEED HOUSE DATA (in rails console)

JsonImporters::HouseImporter.new().perform

SEED SENATE DATA (in rails console)

JsonImporters::SenateImporter.new().perform

EXIT RAILS CONSOLE

exit

That should fill your states, districts, house_reps and senate_reps tables with data.