-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clone_tenant #322
Comments
I had to bypass the django-tenants clone_tenant function because it kept coming back with errors and I need to move fast I have clients waiting to purchase accounts. This code is very raw just for testing but it works, obviously, it needs error catching try: except: ... etc but here is the working code to clone a tenant. Cloning takes seconds Vs Provisioning through the tenant.auto_create_schema = True (default) which can take a long time because it has to apply all of the migrations which can take minutes. *** Don't forget you need to create the function "clone_tenant" on your Server, I used the version by denishpatel , make sure you are using the right version for your server version. Many thanks to denishpatel. His versions work with django-tenants many others do not.
|
This was the code that kept giving errors in clone_tenant.py within django-tenants: The error was on the line "clone_schema = CloneSchema(cursor)" and read CloneSchema does not accept arguments. So this will need fixing and maybe add an example to the documentation along with a note about the clone_schema function required for the server.
|
Is this issue perhaps related to: #246? |
I have read the docs and while some management commands are documented clone_tenant is not, no matter what I throw at it, I get errors, but I know it is because I do not know the commands...
python manage,py clone_tenant --clone_from=abc_123456 --clone_to=xyz_12345 --user=145
Above does not work and countless other variations fail, the only valid option I can see in the code is: --clone_from
Also is there a way to call this from within the code?
eg:
from django_tenants.management.commands import clone_tenant
clone_tenant(clone_from, clone_to, user)
This also does not work.... any hints clues or examples would be greatly appreciated.
The text was updated successfully, but these errors were encountered: