Skip to content

Commit

Permalink
Update constraint error message
Browse files Browse the repository at this point in the history
  • Loading branch information
ldeluigi committed Jul 4, 2023
1 parent c7e6fb6 commit 5c98aca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions backend/spellbook/migrations/0010_feature_name_unique_ci.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.1 on 2023-07-04 09:05
# Generated by Django 4.2.1 on 2023-07-04 09:42

from django.db import migrations, models
import django.db.models.functions.text
Expand All @@ -13,6 +13,6 @@ class Migration(migrations.Migration):
operations = [
migrations.AddConstraint(
model_name='feature',
constraint=models.UniqueConstraint(django.db.models.functions.text.Lower('name'), name='name_unique_ci'),
constraint=models.UniqueConstraint(django.db.models.functions.text.Lower('name'), name='name_unique_ci', violation_error_message='Feature name should be unique, ignoring case.'),
),
]
3 changes: 2 additions & 1 deletion backend/spellbook/models/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ class Meta:
constraints = [
models.UniqueConstraint(
Lower('name'),
name='name_unique_ci'
name='name_unique_ci',
violation_error_message='Feature name should be unique, ignoring case.',
),
]

Expand Down

0 comments on commit 5c98aca

Please sign in to comment.