I'd like to publish a solution to a problem which i'm sure some would face in future.
If you are familiar, the error is not very obvious and it explains something implicit.
When you run ./manage.py migrate , you would see a long traceback along with this at the end.
migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table (relation "django_migrations" already exists. This in Django world means issues with db inconsistencies and likely hard to get back. I had faced this issue myself couple of time.
The issue is in your public schema where you store your tenant info. In my case, its tenant_tenant and tenant_domain in public. If you look close there could be some schemas which are created but not showing up in the actual database schema list. This could be because the schema was not created successfully or some other issues.
Just remove the entries which you donot see in the list of db schema from tenant_domain and then the refs from tenant_tenant.
I will not encourage numbers into schema names as well. Then do run the migration again
Feel free to ask in the comments incase of any questions :)
I'd like to publish a solution to a problem which i'm sure some would face in future. If you are familiar, the error is not very obvious and it explains something implicit.
When you run
./manage.py migrate
, you would see a long traceback along with this at the end.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table (relation "django_migrations" already exists
. This in Django world means issues with db inconsistencies and likely hard to get back. I had faced this issue myself couple of time.The issue is in your
public
schema where you store your tenant info. In my case, itstenant_tenant
andtenant_domain
inpublic
. If you look close there could be some schemas which are created but not showing up in the actual database schema list. This could be because the schema was not created successfully or some other issues.Just remove the entries which you donot see in the list of db schema from
tenant_domain
and then the refs fromtenant_tenant
. I will not encourage numbers into schema names as well. Then do run the migration againFeel free to ask in the comments incase of any questions :)