From 95143160046b5ed02ba8a7f05debf060b6900c21 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Thu, 31 Oct 2024 22:36:57 +0200 Subject: [PATCH] also translate foreign keys to uuid's --- .../migrations/0026_create_ivm_entries.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/wger/nutrition/migrations/0026_create_ivm_entries.py b/wger/nutrition/migrations/0026_create_ivm_entries.py index c4087ce97..e04339146 100644 --- a/wger/nutrition/migrations/0026_create_ivm_entries.py +++ b/wger/nutrition/migrations/0026_create_ivm_entries.py @@ -47,11 +47,11 @@ def add_ivm_views(apps, schema_editor): m.id AS remote_id, "order", time, - plan_id, + p.uuid AS plan_id, name, p.user_id FROM (SELECT * FROM nutrition_meal) AS m - JOIN (SELECT id, user_id FROM nutrition_nutritionplan) AS p ON m.plan_id = p.id;' + JOIN (SELECT id, uuid, user_id FROM nutrition_nutritionplan) AS p ON m.plan_id = p.id;' ); """ ) @@ -66,11 +66,11 @@ def add_ivm_views(apps, schema_editor): "order", amount, ingredient_id, - meal_id, + m.uuid AS meal_id, weight_unit_id, p.user_id FROM (SELECT * FROM nutrition_mealitem) AS mi - JOIN (SELECT id, plan_id FROM nutrition_meal) AS m ON mi.meal_id = m.id + JOIN (SELECT id, uuid, plan_id FROM nutrition_meal) AS m ON mi.meal_id = m.id JOIN (SELECT id, user_id FROM nutrition_nutritionplan) AS p ON m.plan_id = p.id;' ); """ @@ -87,12 +87,13 @@ def add_ivm_views(apps, schema_editor): comment, amount, ingredient_id, - plan_id, + p.uuid AS plan_id, weight_unit_id, - meal_id, + m.uuid AS meal_id, p.user_id FROM (SELECT * FROM nutrition_logitem) AS li - JOIN (SELECT id, user_id FROM nutrition_nutritionplan) AS p ON li.plan_id = p.id;' + JOIN (SELECT id, uuid FROM nutrition_meal) AS m ON li.meal_id = m.id + JOIN (SELECT id, uuid, user_id FROM nutrition_nutritionplan) AS p ON li.plan_id = p.id;' ); """ )