Skip to content

Commit

Permalink
also translate foreign keys to uuid's
Browse files Browse the repository at this point in the history
  • Loading branch information
Dieterbe committed Nov 1, 2024
1 parent 4ef534e commit 9514316
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions wger/nutrition/migrations/0026_create_ivm_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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;'
);
"""
)
Expand All @@ -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;'
);
"""
Expand All @@ -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;'
);
"""
)
Expand Down

0 comments on commit 9514316

Please sign in to comment.