-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add UUID fields to reservation models for future "keyless entry"
- Rename recurring reservation `uuid` -> `ext_uuid` - Add `ext_uuid` field to reservation - Add `reservation_uuid` field to statistics - Add `ext_uuid` fields to graphql schema
- Loading branch information
1 parent
563e472
commit 9594185
Showing
16 changed files
with
132 additions
and
4 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,6 +116,7 @@ class Meta: | |
fields = [ | ||
# | ||
"pk", | ||
"ext_uuid", | ||
"name", | ||
"description", | ||
"num_persons", | ||
|
18 changes: 18 additions & 0 deletions
18
tilavarauspalvelu/migrations/0041_rename_recurring_reservation_uuid_to_ext_uuid.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,18 @@ | ||
# Generated by Django 5.1.3 on 2024-11-28 07:23 | ||
from __future__ import annotations | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("tilavarauspalvelu", "0040_alter_reservationstatisticsreservationunit_unit_tprek_id"), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameField( | ||
model_name="recurringreservation", | ||
old_name="uuid", | ||
new_name="ext_uuid", | ||
), | ||
] |
20 changes: 20 additions & 0 deletions
20
tilavarauspalvelu/migrations/0042_add_reservation_uuids.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,20 @@ | ||
# Generated by Django 5.1.3 on 2024-11-28 07:23 | ||
from __future__ import annotations | ||
|
||
import uuid | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("tilavarauspalvelu", "0041_rename_recurring_reservation_uuid_to_ext_uuid"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="reservation", | ||
name="ext_uuid", | ||
field=models.UUIDField(default=uuid.uuid4, null=True), | ||
), | ||
] |
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,22 @@ | ||
# Generated by Django 5.1.3 on 2024-11-28 07:30 | ||
from __future__ import annotations | ||
|
||
import uuid | ||
|
||
from django.db import migrations | ||
|
||
|
||
def gen_uuid(apps, schema_editor) -> None: | ||
Reservation = apps.get_model("tilavarauspalvelu", "Reservation") | ||
rows = list(Reservation.objects.all()) | ||
for row in rows: | ||
row.ext_uuid = uuid.uuid4() | ||
Reservation.objects.bulk_update(rows, ["ext_uuid"]) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("tilavarauspalvelu", "0042_add_reservation_uuids"), | ||
] | ||
|
||
operations = [migrations.RunPython(gen_uuid, migrations.RunPython.noop)] |
20 changes: 20 additions & 0 deletions
20
tilavarauspalvelu/migrations/0044_change_uuid_to_unique.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,20 @@ | ||
# Generated by Django 5.1.3 on 2024-11-28 07:31 | ||
from __future__ import annotations | ||
|
||
import uuid | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("tilavarauspalvelu", "0043_populate_uuid_values"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="reservation", | ||
name="ext_uuid", | ||
field=models.UUIDField(default=uuid.uuid4, editable=False, unique=True), | ||
), | ||
] |
18 changes: 18 additions & 0 deletions
18
tilavarauspalvelu/migrations/0045_reservationstatistic_reservation_uuid.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,18 @@ | ||
# Generated by Django 5.1.3 on 2024-11-28 07:48 | ||
from __future__ import annotations | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("tilavarauspalvelu", "0044_change_uuid_to_unique"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="reservationstatistic", | ||
name="reservation_uuid", | ||
field=models.CharField(blank=True, default="", max_length=255), | ||
), | ||
] |
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