From 925d5f50704a38246480432cc9854d2500788306 Mon Sep 17 00:00:00 2001 From: mpeltriaux Date: Fri, 11 Feb 2022 08:43:21 +0100 Subject: [PATCH] #112 Migration enhance * fixes bug in migration * adds check to migration which raises error before data loss might happen --- compensation/migrations/0004_auto_20220210_1402.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/compensation/migrations/0004_auto_20220210_1402.py b/compensation/migrations/0004_auto_20220210_1402.py index 44d43cbe..7cc8126c 100644 --- a/compensation/migrations/0004_auto_20220210_1402.py +++ b/compensation/migrations/0004_auto_20220210_1402.py @@ -9,9 +9,12 @@ def migrate_actions(apps, schema_editor): for action in actions: action_type = action.action_type or [] - action.action_type_tmp.set(action_type) + action.action_type_tmp.set([action_type]) action.save() + if not action.action_type_tmp.count() > 0: + raise ValueError("Migration of actions did not work! Stoped before data loss!") + class Migration(migrations.Migration):