bernardopires / django-tenant-schemas

Tenant support for Django using PostgreSQL schemas.
https://django-tenant-schemas.readthedocs.org/en/latest/
MIT License
1.46k stars 423 forks source link

Lengthly migrations #409

Closed KarlSayle closed 7 years ago

KarlSayle commented 8 years ago

Evening,

Just wondering if anyone else has had a similar issue. I have a system which has an ever growing migrations list which is caused fresh migrations/new user setups to have to wait around 40 seconds for the database to build which is throwing some timeout errors.

I think I will have to squash the migrations, however i just wanted to get any feedback before hand.

Thanks in advance.

goodtune commented 8 years ago

I think I actually deferred all my tenant setup to a celery task as I didn't want the view blocking at all.

It may be overkill if you don't already use asynchronous workers in your project, though.

On 18 Nov 2016 8:45 am, "KarlSayle" notifications@github.com wrote:

Evening,

Just wondering if anyone else has had a similar issue. I have a system which has an ever growing migrations list which is caused fresh migrations/new user setups to have to wait around 40 seconds for the database to build which is throwing some timeout errors.

I think I will have to squash the migrations, however i just wanted to get any feedback before hand.

Thanks in advance.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bernardopires/django-tenant-schemas/issues/409, or mute the thread https://github.com/notifications/unsubscribe-auth/AARgTj53MVIY5N93eQoy2hkRb0PLFRFeks5q_MsFgaJpZM4K12YA .

ishehata commented 8 years ago

i did the same as @goodtune , i use djang-celery-with-redis, when creating a new tenant, i do that within a celery task that run in the background.

KarlSayle commented 8 years ago

Thanks for the comments. Ill look into Celery.

erichurkman commented 7 years ago

You can also pre-generate X new tenants and only "claim" them when a user signs up.

bernardopires commented 7 years ago

This should be fixed now as we have parallel migrations. Regarding new user creation, as suggested above, the best solution is to use celery. There is an integration available at https://github.com/maciej-gol/tenant-schemas-celery