Initial upgrade problems

Initial ‘sentry upgrade’ command is needed when setting up sentry for the first time. I’ve noticed a problem:
If the initial upgrade fails for the first time(got stuck on some random update i.e.
or “sentry:0114_auto__add_field_projectkey_roles”,
or “sentry:0185_auto__add_savedsearch__add_unique_savedsearch_project_name”,
or “sentry:0270_auto__add_field_organizationmember_token”,
or "sentry:0299_auto__chg_field_environment_organization_id"
it could be any big update in reality), follow-up retries will pickup from where it failed and continue(after I type ‘sentry upgrade’ again and hit ‘enter’ of course). Eventually(after 2 or 3 retries normally) upgrade was completed successfully. Here is the sample output:


  • Loading initial data for sentry.
    Installed 0 object(s) from 0 fixture(s)
    Running migrations for nodestore:
  • Migrating forwards to 0001_initial.


  • Loading initial data for nodestore.
    Installed 0 object(s) from 0 fixture(s)
    Running migrations for search:
  • Migrating forwards to 0002_auto__del_searchtoken__del_unique_searchtoken_document_field_token__de.


  • Loading initial data for search.
    Installed 0 object(s) from 0 fixture(s)
    Running migrations for social_auth:
  • Migrating forwards to 0004_auto__del_unique_usersocialauth_provider_uid__add_unique_usersocialaut.


  • Loading initial data for social_auth.
    Installed 0 object(s) from 0 fixture(s)
    Running migrations for jira_ac:
  • Migrating forwards to 0001_initial.


  • Loading initial data for jira_ac.
    Installed 0 object(s) from 0 fixture(s)
    Running migrations for hipchat_ac:
  • Migrating forwards to 0002_auto__del_mentionedevent.


  • Loading initial data for hipchat_ac.
    Installed 0 object(s) from 0 fixture(s)
    Creating missing DSNs
    Correcting Group.num_comments counter

Now if you create a user using createuser command, then start web service and try to access it from browser, it might say

"No Organization Access

You don’t have access to any organizations within Sentry. Talk to a Sentry administrator about getting access."

Check the logs of createuser command or run web command, you can see both have this entry “[ERROR] sentry.errors: Internal project (id=1) does not exist” shown multiple times.

At this point, no matter how many times you run ‘sentry upgrade’, it will just not fix that problem. Unless you start from scratch with a fresh database and hope upgrade could be successful at first try. In that case, sentry web will be normal.

Anyone else had this problem? Basically it seems like successful upgrade after retries is missing something comparing to successful upgrade w/o retry.

This is annoying even though sentry admins don’t do initial upgrade very often.