Issue with migrations and update to Release 3.8.0
See original GitHub issueI updated to version 3.8.0 today, but have a problem when deploying (via Heroku). The build runs fine, but when deploying I get the following errors when migrating:
Operations to perform:
Apply all migrations: account, admin, auth, cities_light, contenttypes, profiles, sessions, sites, socialaccount, taggit, users
Running migrations:
Applying auth.0012_alter_user_first_name_max_length... OK
Applying cities_light.0010_auto_20200508_1851...Traceback (most recent call last):
File "manage.py", line 30, in <module>
execute_from_command_line(sys.argv)
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/base.py", line 330, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/base.py", line 85, in wrapped
res = handle_func(*args, **kwargs)
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/management/commands/migrate.py", line 243, in handle
post_migrate_state = executor.migrate(
File "/app/.heroku/python/lib/python3.8/site-packages/django/db/migrations/executor.py", line 117, in migrate
state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/app/.heroku/python/lib/python3.8/site-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/app/.heroku/python/lib/python3.8/site-packages/django/db/migrations/executor.py", line 227, in apply_migration
state = migration.apply(state, schema_editor)
File "/app/.heroku/python/lib/python3.8/site-packages/django/db/migrations/migration.py", line 124, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/app/.heroku/python/lib/python3.8/site-packages/django/db/migrations/operations/models.py", line 508, in database_forwards
alter_together(
File "/app/.heroku/python/lib/python3.8/site-packages/django/db/backends/base/schema.py", line 380, in alter_unique_together
self._delete_composed_index(model, fields, {'unique': True}, self.sql_delete_unique)
File "/app/.heroku/python/lib/python3.8/site-packages/django/db/backends/base/schema.py", line 416, in _delete_composed_index
raise ValueError("Found wrong number (%s) of constraints for %s(%s)" % (
ValueError: Found wrong number (0) of constraints for cities_light_city(region_id, slug)
I am not sure what the source / implications of this error could be, so am raising it here as a possible issue. I’d also appreciate any suggestions on how to work around this.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Issue with migrations and update to Release 3.8.0 #242 - GitHub
I updated to version 3.8.0 today, but have a problem when deploying (via Heroku). The build runs fine, but when deploying I get...
Read more >Instructions | Camunda Platform 8 Docs
These documents guide you through the process of migrating your Optimize from one Optimize minor version to the other. If you want to...
Read more >3.8.0 release notes - django cms 3.11.0 documentation
Fixed an issue in wizards/create.html where the error message did not use the ... your database is up-to-date with migrations python manage.py cms...
Read more >Mule Runtime 3.8.0 Release Notes - MuleSoft Documentation
x Migration to Mule 3.8.0. As a result of the unification of API Gateway Runtime with Mule Runtime 3.8.0 and several usability issues...
Read more >Migrating from 3.8.0 - MonoGame Documentation
WindowsDX, DesktopGL, and UWP. Upgrading from 3.8.0 should be as straightforward as upgrading your TargetFramework and MonoGame version. Edit your csproj file ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@AndyClifton I saw your SQL before you edit the comment, and I can’t see any unique constraint in that SQL. Maybe you omit that part.
The problem is that Django is not able to found the constraints that it needs to drop before applying the new constraints. That means that somehow your table is not exactly what it expects.
Here is the SQL for the cities_light_city table from a fresh install before running the migration 0010_auto_20200508_1851.
To solve this problem, I recommend you check what are the constraints that you have on your SQL database and to fix this you have 2 options:
Solved the problem by accidentally trashing the whole remote database. I can confirm that 3.8.0. works fine from a clean install.
It looks like this issue can be closed now. Thanks for the help!