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
Nautobot version (Docker tag too if applicable): 2.0.0.beta2
Python version:
Database platform, version:
Middleware(s):
Steps to Reproduce
Create 2 (or more) Notes in single day (same date) on same object with same user
Run extras.0094 migration to remove slug from Notes
Note: the message on these notes can be different, it is not included in the new constraint unique_together={("assigned_object_type", "assigned_object_id", "user_name", "created")}
Expected Behavior
migration passes
Observed Behavior
Applying extras.0094_remove_slugs...Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/usr/local/lib/python3.10/site-packages/django_prometheus/db/common.py", line 71, in execute
return super().execute(*args, **kwargs)
psycopg2.errors.UniqueViolation: could not create unique index "extras_note_assigned_object_type_id__e1504524_uniq"
DETAIL: Key (assigned_object_type_id, assigned_object_id, user_name, created)=(1, 258ccdb0-1b29-44aa-a4ba-6468281de6ad, test_user, 2022-09-02 00:00:00+00) is duplicated.
The text was updated successfully, but these errors were encountered:
I suspect this is because pre-2.0 created was a Date field instead of Datetime.
@Thetacz would it be acceptable to create a random second/microsecond to add to the 00:00:00+00 (since we never had the exact time anyway) to ensure uniqueness?
I suspect this is because pre-2.0 created was a Date field instead of Datetime.
@Thetacz would it be acceptable to create a random second/microsecond to add to the 00:00:00+00 (since we never had the exact time anyway) to ensure uniqueness?
I already fixed the issue in our data, so it should not apply to us. But generally speaking you can either go the easy way of creating random time OR extract the time from ObjectChange which got created with the Note :)
Or do both with the random time as fallback.
Environment
Steps to Reproduce
Note: the message on these notes can be different, it is not included in the new constraint
unique_together={("assigned_object_type", "assigned_object_id", "user_name", "created")}
Expected Behavior
migration passes
Observed Behavior
The text was updated successfully, but these errors were encountered: