Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Setting Up Your Hubstats Database

Emma Sax edited this page Jan 11, 2016 · 3 revisions

Most of the information necessary to set up a database is available online. However, piecing together the right commands to run, and in the right order, can sometimes be more irritating than helpful. Here, I'll give you a list of commands that I usually have to play around with in order to set up a Hubstats database, which would be called hubstats_development and hubstats_test on your local machine.

The README.md gives some commands to start off. But, that's assuming that your databases already exist. To make hubstats_development and hubstats_test exist, run

rake db:create

Then, you must install all of the migrations from Hubstats by using the command

rake hubstats:install:migrations

After that command is when you most likely need to update your octokit.yml, which there is more information about in the README.md. Remember, the org_name section of the octokit.yml is NECESSARY, while the repo_list, team_list, and ignore_users_list are optional. However, if the team_list and/or 'repo_list' are left empty, there will be probably be some pages with useless functionality.

After installing migrations, then run

rake db:migrate

Usually after this, I run

rake hubstats:install:migrations

once more for good measure. Finally, I can run

rake hubstats:setup

to get my databases populated. If any errors come up during this process at all, here are some commands that you can play around with as you try to get things working correctly:

* bundle exec rake db:drop
* bundle exec rake db:setup
* rails generate hubstats:install:migrations
* rake hubstats:setup
* rake db:create

If you're curious, here is a list of the tasks that we have made (defined in lib/tasks/hubstats_tasks.rake):

* rake hubstats:setup
* rake hubstats:reset
* rake hubstats:update
* rake hubstats:seed
* rake hubstats:update_teams_in_pulls
* rake hubstats:update_teams
* rake hubstats:update_teams_from_file
* rake hubstats:make_org_webhook

A more detailed description of each of these tasks are written into the code in the file above.

Hopefully this will give you enough to get your database initially set up with enough data.