mirror of
https://github.com/ae-utbm/sith.git
synced 2025-01-06 15:11:21 +00:00
split migrations
This commit is contained in:
parent
bb210f8d47
commit
6eb860579a
@ -101,29 +101,4 @@ class Migration(migrations.Migration):
|
||||
migrations.RunPython(
|
||||
migrate_meta_groups, reverse_code=migrations.RunPython.noop, elidable=True
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="club",
|
||||
name="board_group",
|
||||
field=models.OneToOneField(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="club_board",
|
||||
to="core.group",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="club",
|
||||
name="members_group",
|
||||
field=models.OneToOneField(
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="club",
|
||||
to="core.group",
|
||||
),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name="membership",
|
||||
constraint=models.CheckConstraint(
|
||||
check=models.Q(("end_date__gte", models.F("start_date"))),
|
||||
name="end_after_start",
|
||||
),
|
||||
),
|
||||
]
|
||||
|
@ -0,0 +1,36 @@
|
||||
# Generated by Django 4.2.17 on 2025-01-04 16:46
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [("club", "0012_club_board_group_club_members_group")]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="club",
|
||||
name="board_group",
|
||||
field=models.OneToOneField(
|
||||
on_delete=django.db.models.deletion.PROTECT,
|
||||
related_name="club_board",
|
||||
to="core.group",
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name="club",
|
||||
name="members_group",
|
||||
field=models.OneToOneField(
|
||||
on_delete=django.db.models.deletion.PROTECT,
|
||||
related_name="club",
|
||||
to="core.group",
|
||||
),
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name="membership",
|
||||
constraint=models.CheckConstraint(
|
||||
check=models.Q(("end_date__gte", models.F("start_date"))),
|
||||
name="end_after_start",
|
||||
),
|
||||
),
|
||||
]
|
@ -1,24 +1,13 @@
|
||||
# Generated by Django 4.2.16 on 2024-11-30 13:16
|
||||
|
||||
from django.db import migrations, models
|
||||
from django.db.migrations.state import StateApps
|
||||
from django.db.models import F
|
||||
|
||||
|
||||
def invert_is_manually_manageable(apps: StateApps, schema_editor):
|
||||
"""Invert `is_manually_manageable`.
|
||||
|
||||
This field is a renaming of `is_meta`.
|
||||
However, the meaning has been inverted : the groups
|
||||
which were meta are not manually manageable and vice versa.
|
||||
Thus, the value must be inverted.
|
||||
"""
|
||||
Group = apps.get_model("core", "Group")
|
||||
Group.objects.all().update(is_manually_manageable=~F("is_manually_manageable"))
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [("core", "0040_alter_user_options_user_user_permissions_and_more")]
|
||||
dependencies = [
|
||||
("core", "0040_alter_user_options_user_user_permissions_and_more"),
|
||||
("club", "0013_alter_club_board_group_alter_club_members_group_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.DeleteModel(
|
||||
@ -45,7 +34,4 @@ class Migration(migrations.Migration):
|
||||
verbose_name="Is manually manageable",
|
||||
),
|
||||
),
|
||||
migrations.RunPython(
|
||||
invert_is_manually_manageable, reverse_code=invert_is_manually_manageable
|
||||
),
|
||||
]
|
||||
|
@ -0,0 +1,27 @@
|
||||
# Generated by Django 4.2.17 on 2025-01-04 16:42
|
||||
|
||||
from django.db import migrations
|
||||
from django.db.migrations.state import StateApps
|
||||
from django.db.models import F
|
||||
|
||||
|
||||
def invert_is_manually_manageable(apps: StateApps, schema_editor):
|
||||
"""Invert `is_manually_manageable`.
|
||||
|
||||
This field is a renaming of `is_meta`.
|
||||
However, the meaning has been inverted : the groups
|
||||
which were meta are not manually manageable and vice versa.
|
||||
Thus, the value must be inverted.
|
||||
"""
|
||||
Group = apps.get_model("core", "Group")
|
||||
Group.objects.all().update(is_manually_manageable=~F("is_manually_manageable"))
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [("core", "0041_delete_metagroup_alter_group_options_and_more")]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
invert_is_manually_manageable, reverse_code=invert_is_manually_manageable
|
||||
),
|
||||
]
|
Loading…
Reference in New Issue
Block a user