Skip to content

Commit 7233f51

Browse files
committed
chore(migrations): add registry migrate
1 parent 8f85bc6 commit 7233f51

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

rootfs/api/migrations/0019_migration_config_values_and_typed_values.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
def migration_values(apps, schema_editor):
88
with connection.cursor() as cursor:
9-
cursor.execute("SELECT uuid,values,typed_values FROM api_config")
10-
for uuid, values, typed_values in cursor:
9+
cursor.execute("SELECT uuid,values,typed_values,registry FROM api_config")
10+
for uuid, values, typed_values, registry in cursor:
1111
new_values = []
1212
config = Config.objects.using('default').get(pk=uuid)
1313
for name, value in json.loads(values).items():
@@ -23,7 +23,12 @@ def migration_values(apps, schema_editor):
2323
"ptype": ptype,
2424
"value": value
2525
})
26+
new_registry, data = {}, json.loads(registry)
27+
if data:
28+
for ptype in config.app.structure.keys():
29+
new_registry[ptype] = data
2630
config.values = new_values
31+
config.registry = new_registry
2732
config.save(ignore_update_fields=config.allof_fields)
2833

2934

0 commit comments

Comments
 (0)