You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lets say you have the following model and want to add history tracking to each FooModel object:
from simple_history.models import HistoricalRecords
class FooModel(models.Model):
id = TimeflakePrimaryKeyBinary()
history = HistoricalRecords(
history_id_field=models.UUIDField(default=uuid.uuid4)
)
It generates the following error during makemigrations: venv/lib/python3.9/site-packages/timeflake/extensions/django/__init__.py", line 97, in deconstruct del kwargs["primary_key"] KeyError: 'primary_key'
However, I tried adding the following try/except around this code and the migration would generate without an issue:
Downside is that leads to this error when trying to execute the migration: django.db.utils.ProgrammingError: multiple primary keys for table "requisition_data_historicalrequisitionmodel" are not allowed LINE 1: ...me" varchar(200) NULL, "history_id" uuid NOT NULL PRIMARY KE...
I can manually adjust the migration after the fact to "work" (i.e. be a charfied or uuid field etc with primary_key = False) but django will not honor the change and all subsequent makemigrations commands will try to undo the changes.
Can this issue be investigated? Thanks!
The text was updated successfully, but these errors were encountered:
Lets say you have the following model and want to add history tracking to each FooModel object:
It generates the following error during
makemigrations
:venv/lib/python3.9/site-packages/timeflake/extensions/django/__init__.py", line 97, in deconstruct del kwargs["primary_key"] KeyError: 'primary_key'
However, I tried adding the following try/except around this code and the migration would generate without an issue:
Downside is that leads to this error when trying to execute the migration:
django.db.utils.ProgrammingError: multiple primary keys for table "requisition_data_historicalrequisitionmodel" are not allowed LINE 1: ...me" varchar(200) NULL, "history_id" uuid NOT NULL PRIMARY KE...
So at the end of the day any model that uses TimeflakePrimaryKeyBinary for a primary ky
id
field is unable to track object history using https://django-simple-history.readthedocs.io/en/latest/ which is a deficit.I can manually adjust the migration after the fact to "work" (i.e. be a charfied or uuid field etc with primary_key = False) but django will not honor the change and all subsequent
makemigrations
commands will try to undo the changes.Can this issue be investigated? Thanks!
The text was updated successfully, but these errors were encountered: