🚨(tests) fix obsolete code warnings

- in docker compose, remove obsolete 'version' field
- in django, replace obsolete CheckConstraints 'check' field by 'condition'
This commit is contained in:
Marie PUPO JEAMMET
2024-09-05 12:13:59 +02:00
committed by Marie
parent ba631fafb9
commit 4b47f80cab
3 changed files with 4 additions and 6 deletions

View File

@@ -1,5 +1,3 @@
version: '3.8'
services: services:
postgresql: postgresql:
image: postgres:16 image: postgres:16

View File

@@ -146,11 +146,11 @@ class Migration(migrations.Migration):
), ),
migrations.AddConstraint( migrations.AddConstraint(
model_name='contact', model_name='contact',
constraint=models.CheckConstraint(check=models.Q(('base__isnull', False), ('owner__isnull', True), _negated=True), name='base_owner_constraint', violation_error_message='A contact overriding a base contact must be owned.'), constraint=models.CheckConstraint(condition=models.Q(('base__isnull', False), ('owner__isnull', True), _negated=True), name='base_owner_constraint', violation_error_message='A contact overriding a base contact must be owned.'),
), ),
migrations.AddConstraint( migrations.AddConstraint(
model_name='contact', model_name='contact',
constraint=models.CheckConstraint(check=models.Q(('base', models.F('id')), _negated=True), name='base_not_self', violation_error_message='A contact cannot be based on itself.'), constraint=models.CheckConstraint(condition=models.Q(('base', models.F('id')), _negated=True), name='base_not_self', violation_error_message='A contact cannot be based on itself.'),
), ),
migrations.AlterUniqueTogether( migrations.AlterUniqueTogether(
name='contact', name='contact',

View File

@@ -124,12 +124,12 @@ class Contact(BaseModel):
unique_together = ("owner", "base") unique_together = ("owner", "base")
constraints = [ constraints = [
models.CheckConstraint( models.CheckConstraint(
check=~models.Q(base__isnull=False, owner__isnull=True), condition=~models.Q(base__isnull=False, owner__isnull=True),
name="base_owner_constraint", name="base_owner_constraint",
violation_error_message="A contact overriding a base contact must be owned.", violation_error_message="A contact overriding a base contact must be owned.",
), ),
models.CheckConstraint( models.CheckConstraint(
check=~models.Q(base=models.F("id")), condition=~models.Q(base=models.F("id")),
name="base_not_self", name="base_not_self",
violation_error_message="A contact cannot be based on itself.", violation_error_message="A contact cannot be based on itself.",
), ),