]> git.ipfire.org Git - thirdparty/patchwork.git/commit
migrations: Correct 'unique_together' order in '0015'
authorStephen Finucane <stephen@that.guru>
Sat, 8 Jun 2019 15:44:13 +0000 (16:44 +0100)
committerStephen Finucane <stephen@that.guru>
Sat, 31 Aug 2019 11:17:09 +0000 (12:17 +0100)
commit10f4b88b5aa0c12a0e20031b8fbd3c6935cd6595
tree7f891741229e552054b9f823dcdfa06e6247368e
parent8c3ed2b0c3d7f39a66e58a06bba5517b3cbdb4d6
migrations: Correct 'unique_together' order in '0015'

This was resulting in exceptions like the following when used with MySQL
8.0:

  Traceback (most recent call last):
    File "../patchwork/manage.py", line 11, in <module>
      execute_from_command_line(sys.argv)
    ...
    File "../.tox/py27-django111/lib/python2.7/site-packages/django/db/backends/mysql/schema.py", line 88, in _delete_composed_index
      return super(DatabaseSchemaEditor, self)._delete_composed_index(model, fields, *args)
    File "../.tox/py27-django111/lib/python2.7/site-packages/django/db/backends/base/schema.py", line 394, in _delete_composed_index
      ", ".join(columns),
  ValueError: Found wrong number (0) of constraints for patchwork_seriespatch(series_id, number)

This error was being raised by the following lines in the 0033
migration:

  migrations.AlterUniqueTogether(
      name='seriespatch',
      unique_together=set([]),
  )

It appears that this is because of a mismatch between the order of
fields in a 'unique_together' constraint [1]. Correct the order in the
original migration and see the issue disappear.

Signed-off-by: Stephen Finucane <stephen@that.guru>
Fixes: d67d859f40f ("models: Add 'Series' model")
patchwork/migrations/0015_add_series_models.py