Skip to content

Commit 502913e

Browse files
committed
Add back manual modifications for osf 0040_maintenancemode
1 parent 530fb37 commit 502913e

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

osf/migrations/0040_maintenancemode.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
11
# Generated by Django 4.2.26 on 2026-05-22 14:57
2+
# Manually added `create_initial_record()`
23

34
from django.db import migrations, models
45

56

7+
def create_initial_record(apps, schema_editor):
8+
MaintenanceMode = apps.get_model('osf', 'MaintenanceMode')
9+
MaintenanceMode.objects.get_or_create(
10+
pk=1,
11+
defaults={'maintenance_mode': False}
12+
)
13+
14+
15+
def reverse_initial_record(apps, schema_editor):
16+
# the reverse 'reverse_initial_record' does nothing
17+
# because the table will be removed
18+
pass
19+
20+
621
class Migration(migrations.Migration):
722

823
dependencies = [
@@ -17,4 +32,8 @@ class Migration(migrations.Migration):
1732
('maintenance_mode', models.BooleanField(default=False)),
1833
],
1934
),
35+
migrations.RunPython(
36+
create_initial_record,
37+
reverse_code=reverse_initial_record
38+
),
2039
]

0 commit comments

Comments
 (0)