Skip to content

Filling the Database

Sven Gehring edited this page Oct 18, 2016 · 13 revisions

Get data into your development server

If you set up your development environment for the first time, bin/setup will offer you to do all of this automatically for you.
If you already have an environment set up, you can also use bin/seed to execute all of the steps described below.

bin/seed download              # Step 1
bin/seed import db             # Step 2
bin/seed reset                 # Step 3
bin/seed import posters 200    # Step 4
bin/seed import posters 200    # Step 5
bin/seed import clean          # Remove the downloaded db dump

  1. Download our media database dump

  2. Import the dump to your database:

    gzcat anime.sql.gz | bin/psql hummingbird_development
    
  3. Set up Elasticsearch:

    bin/rake chewy:reset
    
  4. Import Poster Images:

    bin/rake "importers:hummingbird:posters[200]"
    
  5. Import Cover Images:

    bin/rake "importers:hummingbird:covers[200]"
    

Starting with a blank database

Creating the database

Run the following to create the database and load structure.sql into it to get started:

$ bundle exec rake db:create db:structure:load

Gaining administrator access

Create an account with one of the staff emails. The confirmation email should be automatically opened in your default browser; if this fails, you can find it in tmp/letter_opener.

Filling the database

Go to /kotodama and enter id numbers from MyAnimeList into the "MAL Import" section to have them created automatically. Some of the ones with lots of characters and voice actors may time out: if this happens, you can use bundle exec rails console and run the following:

require 'mal_import'

Anime.create_or_update_from_hash MALImport.new(:anime, 123456).metadata

If you want to import Manga, replace all the "anime" with "manga" in that line.

Editing the database

Go to /kotodama/rails_admin. This will let you edit the database directly.

Clone this wiki locally