File indexing completed on 2026-06-26 08:40:25
0001 from django.db import migrations
0002
0003
0004 def drop_background_param_defs(apps, schema_editor):
0005 """Drop the seeded background (k) tag param-defs so they re-seed from the
0006 updated schema. The earlier placeholder field set (source_sample, …) was
0007 replaced by bg_source/bg_mechanism/bg_generator; the param-defs are seeded
0008 once into PersistentState and would otherwise keep the stale fields."""
0009 PersistentState = apps.get_model('monitor_app', 'PersistentState')
0010 ps = PersistentState.objects.filter(id=1).first()
0011 if ps and isinstance(ps.state_data, dict) and 'pcs_param_defs_k' in ps.state_data:
0012 del ps.state_data['pcs_param_defs_k']
0013 ps.save(update_fields=['state_data'])
0014
0015
0016 class Migration(migrations.Migration):
0017
0018 dependencies = [
0019 ('pcs', '0010_add_background_tag'),
0020 ('monitor_app', '0015_persistentstate_and_more'),
0021 ]
0022
0023 operations = [
0024 migrations.RunPython(drop_background_param_defs, migrations.RunPython.noop),
0025 ]