Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Data migration and update to service and sub-service page themes #495

Merged
merged 3 commits into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tbx/services/migrations/0038_data_migration_subservice_theme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from django.db import migrations

def update_theme(apps, schema_editor):
page = apps.get_model('services', 'SubServicePage')
page.objects.filter(theme='dark--transparent').update(theme='light')

class Migration(migrations.Migration):

dependencies = [
('services', '0037_alter_subservicepage_content'),
]

operations = [
migrations.RunPython(update_theme),
]
18 changes: 18 additions & 0 deletions tbx/services/migrations/0039_data_migration_service_theme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.18 on 2023-06-23 10:08

from django.db import migrations

def update_theme(apps, schema_editor):
page = apps.get_model('services', 'ServicePage')
page.objects.filter(theme='dark--transparent').update(theme='light')


class Migration(migrations.Migration):

dependencies = [
('services', '0038_data_migration_subservice_theme'),
]

operations = [
migrations.RunPython(update_theme),
]
23 changes: 23 additions & 0 deletions tbx/services/migrations/0040_update_services_theme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2.18 on 2023-06-23 10:12

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('services', '0039_data_migration_service_theme'),
]

operations = [
migrations.AlterField(
model_name='servicepage',
name='theme',
field=models.CharField(choices=[('light', 'Light'), ('coral', 'Coral'), ('dark', 'Dark')], default='light', max_length=255),
),
migrations.AlterField(
model_name='subservicepage',
name='theme',
field=models.CharField(choices=[('light', 'Light'), ('coral', 'Coral'), ('dark', 'Dark')], default='light', max_length=255),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generated by Django 3.2.18 on 2023-06-27 09:56

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('services', '0038_call_to_action'),
('services', '0040_update_services_theme'),
]

operations = [
]
1 change: 0 additions & 1 deletion tbx/services/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class BaseServicePage(Page):
("light", "Light"),
("coral", "Coral"),
("dark", "Dark"),
("dark--transparent", "Dark with transparent header"),
),
default="light",
)
Expand Down