fermentrack: Migrations are not properly being applied due to invalid foreign key constraints on gravitylog.device
IntegrityError: The row in table ‘gravity_gravitylog’ with primary key ‘1’ has an invalid foreign key: gravity_gr…
IntegrityError: The row in table 'gravity_gravitylog' with primary key '1' has an invalid foreign key: gravity_gravitylog.device_id contains a value '2' that does not have a corresponding value in gravity_gravitysensor__old.id.
(7 additional frame(s) were not displayed)
...
File "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 "django/db/migrations/executor.py", line 147, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "django/db/migrations/executor.py", line 247, in apply_migration
migration_recorded = True
File "django/db/backends/sqlite3/schema.py", line 35, in __exit__
self.connection.check_constraints()
File "django/db/backends/sqlite3/base.py", line 331, in check_constraints
bad_value, referenced_table_name, referenced_column_name
IntegrityError: The row in table 'gravity_gravitylog' with primary key '1' has an invalid foreign key: gravity_gravitylog.device_id contains a value '2' that does not have a corresponding value in gravity_gravitysensor__old.id.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 19 (20 by maintainers)
Commits related to this issue
- Explicitly find and correct tables with broken foreign key references (Fixes #450) — committed to thorrak/fermentrack by thorrak 4 years ago
- Adjust fix_sqlite_for_django_2 to monkey patch the __exit__ method rather than reimplementing the rebuild (Fixes #450) — committed to thorrak/fermentrack by thorrak 4 years ago
Excellent news! Your database crashes on my end too. Now I can actually get to work fixing this, rather than throwing stuff at the wall and hoping something sticks.
Thank you!
You are a saint amongst men. I’ll download as soon as I get back to my laptop.