You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using this package for quite some time. We encountered a use case in which we have to introduce a new database. Adding a new schema won't suffice so we added another DB with multi-tenancy. Therefore, having two databases operating on a semi-isolated approach. Now, I'm facing an issue regarding the migration of a particular schema in the non-default database.
Initially, I ran this command: python manage.py migrate_schemas --database=non_default. It creates necessary tables in the public schema
Now, when I'm trying to do: python manage.py migrate_schemas --database=non_default --schema=nds. Django is unable to find the schema nds. Also,
I created the tenant via ORM as suggested in the docs but it didn't create the tenant schema. Creating schema manually through create schema nds from psql didn't work either.
Company.objects.using("non_default") shows the tenant model but no relations.
Any help would be highly appreciated.
Thanks!
The text was updated successfully, but these errors were encountered:
khixer
changed the title
Migrations are not creating table in specific schema with multiple databases
New tenant model is not creating relations in non-public schema with multiple databases
May 17, 2021
Hi,
Use Case:
I'm using this package for quite some time. We encountered a use case in which we have to introduce a new database. Adding a new schema won't suffice so we added another DB with multi-tenancy. Therefore, having two databases operating on a semi-isolated approach. Now, I'm facing an issue regarding the migration of a particular schema in the non-default database.
Code
Two DB's are as follows:
Initially, I ran this command:
python manage.py migrate_schemas --database=non_default
. It creates necessary tables in thepublic
schemaNow, when I'm trying to do:
python manage.py migrate_schemas --database=non_default --schema=nds
. Django is unable to find the schemands
. Also,I created the tenant via ORM as suggested in the docs but it didn't create the tenant schema. Creating schema manually through
create schema nds
from psql didn't work either.ORM code
Didn't run any migration
Company.objects.using("non_default")
shows the tenant model but no relations.Any help would be highly appreciated.
Thanks!
The text was updated successfully, but these errors were encountered: