-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🗃️ [#182] made sure that the reverse datamigration of klantinteractie…
…s works
- Loading branch information
1 parent
4537ab1
commit b9e4b58
Showing
6 changed files
with
68 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/openklant/components/klantinteracties/migrations/0017_auto_20240815_2234.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Generated by Django 4.2.11 on 2024-08-15 22:34 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
def sync_actor_and_actoren(apps, schema_editor): | ||
Internetaak = apps.get_model("klantinteracties", "internetaak") | ||
for internetaak in Internetaak.objects.all(): | ||
internetaak.actoren.add(internetaak.actor) | ||
|
||
def reverse_sync_actor_and_actoren(apps, schema_editor): | ||
Internetaak = apps.get_model("klantinteracties", "internetaak") | ||
for internetaak in Internetaak.objects.all(): | ||
internetaak.actor = internetaak.actoren.first() | ||
internetaak.save() | ||
|
||
dependencies = [ | ||
("klantinteracties", "0016_internetaak_actoren"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
sync_actor_and_actoren, reverse_code=reverse_sync_actor_and_actoren | ||
), | ||
] |
29 changes: 29 additions & 0 deletions
29
src/openklant/components/klantinteracties/migrations/0018_remove_internetaak_actor.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Generated by Django 4.2.11 on 2024-08-15 22:35 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("klantinteracties", "0017_auto_20240815_2234"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="internetaak", | ||
name="actor", | ||
field=models.ForeignKey( | ||
help_text="De actor aan wie de interne taak werd toegewezen.", | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="klantinteracties.actor", | ||
verbose_name="actor", | ||
default=1, | ||
), | ||
), | ||
migrations.RemoveField( | ||
model_name="internetaak", | ||
name="actor", | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters