Setup production-ready, basic DB

To create empty tables in a new database according to the most recent version of the database schema (found in “db/schema.rb”)
rake db:schema:load
Some tables need to be pre-filled for the system to work properly.
Import these tables in their entirety from the main DB:
  • users
  • roles
  • local_taxonomies
  • ncbi_taxonomies
Data needed for universal lists:
  • list_groups ( complete )
  • lists ( only universal )
  • keywords  ( only those used in universal lists )
  • list_keywords  ( only those used in universal lists )
The tables can be dumped into temporary .sql files with a datestamp.
Dump universal lists for import
mysqldump -u user -psecret ggkbase_production lists --where "type = 'UniversalList'"  > lists_101314.sql
Dump keywords ( only those used in universal lists )
mysql -e "Select lk.* from list_keywords lk inner join lists l on l.id = lk.list_id where l.type = 'UniversalList';" -u user -psecret ggkbase_production  > list_keywords_101314.sql
Dump list_keywords
mysql -e "Select k.* from keywords k inner join list_keywords lk on
lk.keyword_id = k.id inner join lists l on l.id = lk.list_id where l.type = 'UniversalList' group by k.id;" -u user -psecret ggkbase_production  > keywords_101314.sql