-
Notifications
You must be signed in to change notification settings - Fork 13
OSIDB-4920: Fix JiraProjectFields unique constraint dupliate names #1248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Generated by Django 5.2.12 on 2026-04-16 13:02 | ||
|
|
||
| from django.db import migrations | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('trackers', '0002_jirabugissuetype'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterUniqueTogether( | ||
| name='jiraprojectfields', | ||
| unique_together={('project_key', 'field_id')}, | ||
| ), | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,7 +12,7 @@ class JiraProjectFields(models.Model): | |
| allowed_values = models.JSONField(default=list) | ||
|
|
||
| class Meta: | ||
| unique_together = ("project_key", "field_name") | ||
| unique_together = ("project_key", "field_id") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Constraint change makes existing Line 15 allows duplicate Please add disambiguation (for example, include issue-type scope in storage/lookups) or fail fast when multiple rows match a 🤖 Prompt for AI Agents |
||
|
|
||
| def __str__(self): | ||
| return self.field_name | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: RedHatProductSecurity/osidb
Length of output: 115
🏁 Script executed:
Repository: RedHatProductSecurity/osidb
Length of output: 522
🏁 Script executed:
Repository: RedHatProductSecurity/osidb
Length of output: 363
🏁 Script executed:
Repository: RedHatProductSecurity/osidb
Length of output: 562
🏁 Script executed:
Repository: RedHatProductSecurity/osidb
Length of output: 1289
🏁 Script executed:
Repository: RedHatProductSecurity/osidb
Length of output: 760
🏁 Script executed:
Repository: RedHatProductSecurity/osidb
Length of output: 1066
Add a pre-migration check or cleanup step for the constraint change.
Migration 0003 changes the unique constraint from
(project_key, field_name)to(project_key, field_id)without safeguards. Since the initial schema did not enforce uniqueness on field_id alone, existing duplicate pairs could cause deployment failure. Either add aRunPythonstep in this migration to validate/clean duplicates, or provide an explicit pre-deployment verification command for operators:🤖 Prompt for AI Agents