For several years we were running our self-hosted Sentry environment on an EC2 host. We’ve been using (hosted) AWS RDS for the Sentry Postgres database.
For neatness, more recently we switched this environment from EC2 to Fargate, while continuing to use the same Postgres database. This mostly works, but we find that we’re unable add new users, so we realized that we must run the Sentry database migrations to migrate from Sentry 9.11 to the latest-and-greatest.
Unfortunately, in Fargate we don’t have the means to ssh to the Sentry software. So instead on a bastion host which can talk to the hosted Postgres, we’re running a docker-compose stack. I’ll try to fill-in the details in the thread below, but the “sentry upgrade” command fails when trying to create a postgres Table which already exists:
FATAL ERROR - The following SQL query failed: CREATE TABLE “sentry_identityprovider” (“id” bigserial NOT NULL PRIMARY KEY, “type” varchar(64) NOT NULL, “instance” varchar(64) NOT NULL)
The error was: ProgrammingError(‘relation “sentry_identityprovider” already exists\n’,)
SQL: CREATE TABLE “sentry_identityprovider” (“id” bigserial NOT NULL PRIMARY KEY, “type” varchar(64) NOT NULL, “instance” varchar(64) NOT NULL)
Error in migration:
I can see that the table creation error corresponds to this bit of Sentry code
db.create_table(‘sentry_identityprovider’,…
but there are hundreds of tables and I suspect that doing something like adding a try-except block will just yield dozens of more errors to debug. I’m hoping that there’s a better way …
So, if this is happening during an upgrade from 9.1.1 to 9.1.2, looks like south is trying to run a migration that has already been run. Some more logs around which migration it fails may help us devise a solution.
If this happened when trying to upgrade from 9.1.1 to 10.0.0.dev then you need to upgrade to 9.1.2 first for things to work properly as the migration system has changed in v10.