question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

migrate_schemas not running

See original GitHub issue

Using in requirements.txt

Django==3.1 django-tenant-schemas==1.10.0

In settings.py

image

image

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
maxwellcccommented, Aug 9, 2020

I discovered the reason for the problem. This error occurs in versions of Django greater than 3.0.9. So, I downgraded from version 3.1 to version 3.0.9

4reactions
danh91commented, Aug 9, 2020

Hi guys, I am having the same problem too using Django 3.1 and DTS 1.10.0.

I looked around and realized that it has something to do with the changes in Django related to the skip_checks command option.

That said, here are different solutions/workarounds I found

1 - Add requires_system_checks = [] to migrate_schemas command class

class Command(SyncCommon):
    requires_system_checks = []
    ...

2 - Or customize BaseCommand.create_parser(prog_name, subcommand, **kwargs) to tell arg parser not to raise an exception when an argument is defined twice. (https://docs.python.org/3/library/argparse.html#conflict-handler)

class Command(SyncCommon):
   ...

    def create_parser(self, prog_name, subcommand, **kwargs):
        return super().create_parser(prog_name, subcommand, **{**kwargs, 'conflict_handler': 'resolve'})

    ...

I am more inclined to go with solution 1, I will make a PR with that. Please let me know what you think or if there is an even better way to approach it, I wouldn’t say I have a complete picture this is the first time I am using DTS.

In the meantime, you can locally override the migrate_schemas command to add the fix locally following https://docs.djangoproject.com/en/3.0/howto/custom-management-commands/

from tenant_schemas.management.commands.migrate_schemas import Command as MigrateSchemasCommand


class Command(MigrateSchemasCommand):
    requires_system_checks = []
Read more comments on GitHub >

github_iconTop Results From Across the Web

app.migrateSchema is not a function · Issue #4002 - GitHub
btw: the run migrate iterations I've been through shows the script trying to alter schema for the target mongodb - does this even...
Read more >
Migrate Schemas - Confluent Documentation
Migrate Schemas ¶ · Start the origin cluster. · Verify that schema-registry , kafka , and zookeeper are running. · Verify that no...
Read more >
python - django-tenant-schemas wont apply migration to ...
You are running manage.py migrate_schemas --shared. Which migrates only public schema. You should run manage.py migrate_schemas.
Read more >
Working with Preference File (JSON) for Post-migration
When you want to update the schema and use the feature of preferences, then a migrateSchema.json file would need to be created in...
Read more >
Executor.hpp - Oat++
Execute database query using a query template. ... Should NOT be used directly. ... void, migrateSchema, Run schema migration script. Should NOT be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found