Skip to content
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

Migrate Failed with Django 5.1 #407

Open
wilson-jw opened this issue Aug 16, 2024 · 7 comments
Open

Migrate Failed with Django 5.1 #407

wilson-jw opened this issue Aug 16, 2024 · 7 comments

Comments

@wilson-jw
Copy link

wilson-jw commented Aug 16, 2024

Hi team, I would like to get your help on migration error.

Software versions

  • Django: 5.1
  • mssql-django: 1.5
  • python: 3.12
  • SQL Server: 2022
  • OS: windows server 2019

Problem description and steps to reproduce
Failed to run py manage.py migrate command with below error message.

Error message/stack trace

Running migrations:
  Applying history.0001_initial...Traceback (most recent call last):
  File "E:\wilson\ATS_VM_Solution\vmportal\manage.py", line 22, in <module>
    main()
  File "E:\DjangoProj\manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "E:\DjangoProj\.venv\Lib\site-packages\django\core\management\__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "E:\DjangoProj\.venv\Lib\site-packages\django\core\management\__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "E:\DjangoProj\.venv\Lib\site-packages\django\core\management\base.py", line 413, in run_from_argv
    self.execute(*args, **cmd_options)
  File "E:\DjangoProj\.venv\Lib\site-packages\django\core\management\base.py", line 459, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\DjangoProj\.venv\Lib\site-packages\django\core\management\base.py", line 107, in wrapper
    res = handle_func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\DjangoProj\.venv\Lib\site-packages\django\core\management\commands\migrate.py", line 357, in handle
    post_migrate_state = executor.migrate(
                         ^^^^^^^^^^^^^^^^^
  File "E:\DjangoProj\.venv\Lib\site-packages\django\db\migrations\executor.py", line 135, in migrate
    state = self._migrate_all_forwards(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\DjangoProj\.venv\Lib\site-packages\django\db\migrations\executor.py", line 167, in _migrate_all_forwards
    state = self.apply_migration(
            ^^^^^^^^^^^^^^^^^^^^^
  File "E:\DjangoProj\.venv\Lib\site-packages\django\db\migrations\executor.py", line 255, in apply_migration
    state = migration.apply(state, schema_editor)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\DjangoProj\.venv\Lib\site-packages\django\db\migrations\migration.py", line 132, in apply
    operation.database_forwards(
  File "E:\DjangoProj\.venv\Lib\site-packages\django\db\migrations\operations\models.py", line 97, in database_forwards
    schema_editor.create_model(model)
  File "E:\DjangoProj\.venv\Lib\site-packages\mssql\schema.py", line 1326, in create_model
    self.deferred_sql.extend(self._model_indexes_sql(model))
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\DjangoProj\.venv\Lib\site-packages\mssql\schema.py", line 302, in _model_indexes_sql
    for field_names in model._meta.index_together:
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Options' object has no attribute 'index_together'. Did you mean: 'unique_together'?

Any other details that can be helpful
It seems that the new version of Django has changed the field parameter settings, resulting in the field not being found. Please help to check.

@wilson-jw
Copy link
Author

migrate command works well with Django 5.0.8 version. Only get error when upgrade to 5.1 version.

@MichaelSun90
Copy link

Hi @wilson-jw, the team still working on 5.1 support. Will let you know when that is ready.

@Eric-Simon-Lemon
Copy link

@MichaelSun90 Hello sir, any news about the 5.1 support ?
It's already been 2 months since the end of mainstream support for 5.0.x
Thank you for you answer

@sohamM97
Copy link

sohamM97 commented Oct 29, 2024

Hello @MichaelSun90
Any estimated release date for mssql-django with Django 5.1 support? We are migrating our application from Django 3.2 to Django 5, and would like to use Django 5.1 instead of 5.0, as that's the latest version (we would ideally want to upgrade to Django 5.2 as soon as that's released as well).

@vsds-cbs-nl
Copy link

#418

@OndrejSerek
Copy link

Any updates to this please?

@maclinbc
Copy link

I've found that the changes made in the django51 branch fixed many of the issues I was having
https://github.com/microsoft/mssql-django/tree/django51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants