| 1 | -- ---------------------------------------------------------------------
|
|---|
| 2 | -- Првобитни queries
|
|---|
| 3 | -- ---------------------------------------------------------------------
|
|---|
| 4 |
|
|---|
| 5 | BEGIN;
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 | TRUNCATE "user", ingredient, nutrient, restriction, recipe, post, comment,
|
|---|
| 9 | grocery_list, intake_planner, biometrics,
|
|---|
| 10 | recipe_contains_ingredient, ingredient_contains_nutrient,
|
|---|
| 11 | recipe_contains_restriction, grocery_list_bulk_add_ingredient,
|
|---|
| 12 | grocery_list_single_add_ingredient, intake_planner_save_to_list_post
|
|---|
| 13 | RESTART IDENTITY CASCADE;
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 | INSERT INTO "user" (email, username, password, role) VALUES
|
|---|
| 17 | ('admin@nutritioneer.mk', 'admin_nutri', '$2a$10$3fQ9kZ1vJ8sT2xLmN0oPqeRuVwXyZaBcDeFgHiJkLmNoPqRsTuVwX', 'administrator'),
|
|---|
| 18 | ('viktor.ilievski@nutritioneer.mk', 'coach_viktor', '$2a$10$3fQ9kZ1vJ8sT2xLmN0oPqeRuVwXyZaBcDeFgHiJkLmNoPqRsTuVwX', 'trainer'),
|
|---|
| 19 | ('teodora.mihajlova@nutritioneer.mk','coach_teodora', '$2a$10$3fQ9kZ1vJ8sT2xLmN0oPqeRuVwXyZaBcDeFgHiJkLmNoPqRsTuVwX', 'trainer'),
|
|---|
| 20 | ('marija.trajkovska@gmail.com', 'marija_t', '$2a$10$3fQ9kZ1vJ8sT2xLmN0oPqeRuVwXyZaBcDeFgHiJkLmNoPqRsTuVwX', 'user'),
|
|---|
| 21 | ('stefan.petrov@gmail.com', 'stefan_p', '$2a$10$3fQ9kZ1vJ8sT2xLmN0oPqeRuVwXyZaBcDeFgHiJkLmNoPqRsTuVwX', 'user'),
|
|---|
| 22 | ('ana.jovanovska@yahoo.com', 'ana_j', '$2a$10$3fQ9kZ1vJ8sT2xLmN0oPqeRuVwXyZaBcDeFgHiJkLmNoPqRsTuVwX', 'user'),
|
|---|
| 23 | ('nikola.stojanov@gmail.com', 'nikola_s', '$2a$10$3fQ9kZ1vJ8sT2xLmN0oPqeRuVwXyZaBcDeFgHiJkLmNoPqRsTuVwX', 'user'),
|
|---|
| 24 | ('elena.dimitrova@hotmail.com', 'elena_d', '$2a$10$3fQ9kZ1vJ8sT2xLmN0oPqeRuVwXyZaBcDeFgHiJkLmNoPqRsTuVwX', 'user'),
|
|---|
| 25 | ('bojan.kostov@gmail.com', 'bojan_k', '$2a$10$3fQ9kZ1vJ8sT2xLmN0oPqeRuVwXyZaBcDeFgHiJkLmNoPqRsTuVwX', 'user'),
|
|---|
| 26 | ('filip.angelov@gmail.com', 'filip_a', '$2a$10$3fQ9kZ1vJ8sT2xLmN0oPqeRuVwXyZaBcDeFgHiJkLmNoPqRsTuVwX', 'user');
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 | INSERT INTO ingredient (name, description, energy, kcal, type) VALUES
|
|---|
| 30 | ('Chicken breast', 'Skinless boneless chicken breast, raw', 690, 165, 'meat'),
|
|---|
| 31 | ('Beef mince', 'Ground beef, 20 percent fat, raw', 1046, 250, 'meat'),
|
|---|
| 32 | ('Pork shoulder', 'Pork shoulder cut, raw', 1013, 242, 'meat'),
|
|---|
| 33 | ('Trout fillet', 'Freshwater trout fillet, raw', 619, 148, 'fish'),
|
|---|
| 34 | ('Mackerel', 'Atlantic mackerel, raw', 858, 205, 'fish'),
|
|---|
| 35 | ('Egg', 'Whole chicken egg, raw', 598, 143, 'other'),
|
|---|
| 36 | ('Cow milk', 'Pasteurised cow milk, 3.2 percent fat', 255, 61, 'dairy'),
|
|---|
| 37 | ('Yogurt', 'Plain yogurt, 3.5 percent fat', 264, 63, 'dairy'),
|
|---|
| 38 | ('White brine cheese', 'Traditional white brine cheese (sirenje)', 1105, 264, 'dairy'),
|
|---|
| 39 | ('Kashkaval', 'Semi-hard yellow cheese (kashkaval)', 1490, 356, 'dairy'),
|
|---|
| 40 | ('Butter', 'Unsalted cow butter, 82 percent fat', 3000, 717, 'dairy'),
|
|---|
| 41 | ('Sunflower oil', 'Refined sunflower oil', 3699, 884, 'oil'),
|
|---|
| 42 | ('Olive oil', 'Extra virgin olive oil', 3699, 884, 'oil'),
|
|---|
| 43 | ('White rice', 'Long grain white rice, uncooked', 1527, 365, 'carb'),
|
|---|
| 44 | ('Bulgur', 'Coarse bulgur wheat, uncooked', 1431, 342, 'carb'),
|
|---|
| 45 | ('White flour', 'Wheat flour type 500, all purpose', 1523, 364, 'carb'),
|
|---|
| 46 | ('Spaghetti', 'Durum wheat spaghetti, dry', 1552, 371, 'carb'),
|
|---|
| 47 | ('White bread', 'White wheat bread, baked', 1109, 265, 'carb'),
|
|---|
| 48 | ('Oats', 'Rolled oat flakes', 1628, 389, 'carb'),
|
|---|
| 49 | ('Potato', 'White potato, raw, peeled', 322, 77, 'vegetable'),
|
|---|
| 50 | ('Dry white beans', 'Dry white beans (tetovec variety)', 1393, 333, 'legume'),
|
|---|
| 51 | ('Lentils', 'Dry brown lentils', 1473, 352, 'legume'),
|
|---|
| 52 | ('Chickpeas', 'Dry chickpeas', 1523, 364, 'legume'),
|
|---|
| 53 | ('Tomato', 'Fresh ripe tomato', 75, 18, 'vegetable'),
|
|---|
| 54 | ('Red bell pepper', 'Fresh red bell pepper (kapija)', 130, 31, 'vegetable'),
|
|---|
| 55 | ('Onion', 'Yellow onion, raw', 167, 40, 'vegetable'),
|
|---|
| 56 | ('Garlic', 'Fresh garlic cloves', 623, 149, 'vegetable'),
|
|---|
| 57 | ('Cucumber', 'Fresh cucumber with skin', 63, 15, 'vegetable'),
|
|---|
| 58 | ('Aubergine', 'Fresh aubergine (eggplant)', 105, 25, 'vegetable'),
|
|---|
| 59 | ('Zucchini', 'Fresh green zucchini', 71, 17, 'vegetable'),
|
|---|
| 60 | ('Carrot', 'Fresh carrot, raw', 172, 41, 'vegetable'),
|
|---|
| 61 | ('Spinach', 'Fresh spinach leaves', 96, 23, 'vegetable'),
|
|---|
| 62 | ('Cabbage', 'White cabbage, raw', 105, 25, 'vegetable'),
|
|---|
| 63 | ('Leek', 'Fresh leek, raw', 255, 61, 'vegetable'),
|
|---|
| 64 | ('Apple', 'Fresh apple with skin', 218, 52, 'fruit'),
|
|---|
| 65 | ('Banana', 'Fresh banana, peeled', 372, 89, 'fruit'),
|
|---|
| 66 | ('Strawberry', 'Fresh strawberries', 134, 32, 'fruit'),
|
|---|
| 67 | ('Grapes', 'Fresh table grapes', 288, 69, 'fruit'),
|
|---|
| 68 | ('Lemon', 'Fresh lemon, peeled', 121, 29, 'fruit'),
|
|---|
| 69 | ('Walnut', 'Shelled walnut kernels', 2736, 654, 'nut'),
|
|---|
| 70 | ('Almond', 'Raw almonds', 2423, 579, 'nut'),
|
|---|
| 71 | ('Sunflower seed', 'Hulled sunflower seeds', 2444, 584, 'seed'),
|
|---|
| 72 | ('Chia seed', 'Whole chia seeds', 2033, 486, 'seed'),
|
|---|
| 73 | ('Parsley', 'Fresh flat leaf parsley', 151, 36, 'herb'),
|
|---|
| 74 | ('Dill', 'Fresh dill weed', 180, 43, 'herb'),
|
|---|
| 75 | ('Salt', 'Refined table salt, iodised', 0, 0, 'spice'),
|
|---|
| 76 | ('Black pepper', 'Ground black pepper', 1050, 251, 'spice'),
|
|---|
| 77 | ('Paprika powder', 'Sweet red paprika powder', 1180, 282, 'spice'),
|
|---|
| 78 | ('Honey', 'Raw flower honey', 1272, 304, 'other'),
|
|---|
| 79 | ('Water', 'Drinking water', 0, 0, 'beverage');
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|
| 82 | INSERT INTO nutrient (description, quantity, unit, type) VALUES
|
|---|
| 83 | ('Protein', 50, 'gram', 'macro'),
|
|---|
| 84 | ('Total carbohydrate', 260, 'gram', 'macro'),
|
|---|
| 85 | ('Total fat', 70, 'gram', 'macro'),
|
|---|
| 86 | ('Saturated fat', 20, 'gram', 'macro'),
|
|---|
| 87 | ('Dietary fibre', 30, 'gram', 'macro'),
|
|---|
| 88 | ('Sugars', 90, 'gram', 'macro'),
|
|---|
| 89 | ('Vitamin C', 80, 'milligram', 'micro'),
|
|---|
| 90 | ('Vitamin A', 800, 'microgram', 'micro'),
|
|---|
| 91 | ('Vitamin D', 5, 'microgram', 'micro'),
|
|---|
| 92 | ('Vitamin E', 12, 'milligram', 'micro'),
|
|---|
| 93 | ('Vitamin K', 75, 'microgram', 'micro'),
|
|---|
| 94 | ('Vitamin B12', 2.5, 'microgram', 'micro'),
|
|---|
| 95 | ('Folate', 200, 'microgram', 'micro'),
|
|---|
| 96 | ('Calcium', 800, 'milligram', 'micro'),
|
|---|
| 97 | ('Iron', 14, 'milligram', 'micro'),
|
|---|
| 98 | ('Magnesium', 375, 'milligram', 'micro'),
|
|---|
| 99 | ('Potassium', 2000, 'milligram', 'micro'),
|
|---|
| 100 | ('Zinc', 10, 'milligram', 'micro'),
|
|---|
| 101 | ('Sodium', 2000, 'milligram', 'micro'),
|
|---|
| 102 | ('Phosphorus', 700, 'milligram', 'micro'),
|
|---|
| 103 | ('Selenium', 55, 'microgram', 'micro'),
|
|---|
| 104 | ('Iodine', 150, 'microgram', 'micro');
|
|---|
| 105 |
|
|---|
| 106 |
|
|---|
| 107 | INSERT INTO restriction (description, type) VALUES
|
|---|
| 108 | ('Contains no ingredient of animal origin', 'vegan'),
|
|---|
| 109 | ('Contains no meat and no fish', 'vegetarian'),
|
|---|
| 110 | ('Prepared according to Islamic dietary law', 'halal'),
|
|---|
| 111 | ('Prepared according to Jewish dietary law', 'kosher'),
|
|---|
| 112 | ('Fish and seafood allowed, no other meat', 'pescatarian'),
|
|---|
| 113 | ('Contains gluten from wheat, barley or rye', 'allergen'),
|
|---|
| 114 | ('Contains milk protein and lactose', 'allergen'),
|
|---|
| 115 | ('Contains tree nuts', 'allergen'),
|
|---|
| 116 | ('Contains egg', 'allergen'),
|
|---|
| 117 | ('Contains fish', 'allergen'),
|
|---|
| 118 | ('Low carbohydrate and high fat, ketogenic', 'keto'),
|
|---|
| 119 | ('No grains, legumes or processed food', 'paleo'),
|
|---|
| 120 | ('Free of gluten containing cereals', 'gluten_free'),
|
|---|
| 121 | ('Free of lactose', 'lactose_free'),
|
|---|
| 122 | ('Suitable for a diabetic meal plan, low glycaemic load', 'diabetic'),
|
|---|
| 123 | ('Reduced sodium content, under 120 mg per 100 g', 'low_sodium');
|
|---|
| 124 |
|
|---|
| 125 |
|
|---|
| 126 | INSERT INTO ingredient_contains_nutrient (ingredient_name, nutrient_id, quantity)
|
|---|
| 127 | SELECT m.ing, n.id, v.qty
|
|---|
| 128 | FROM (VALUES
|
|---|
| 129 | ('Chicken breast', 31.0, 0.0, 3.6, 0.0),
|
|---|
| 130 | ('Beef mince', 26.0, 0.0, 15.0, 0.0),
|
|---|
| 131 | ('Pork shoulder', 20.0, 0.0, 18.0, 0.0),
|
|---|
| 132 | ('Trout fillet', 20.5, 0.0, 6.6, 0.0),
|
|---|
| 133 | ('Mackerel', 19.0, 0.0, 13.9, 0.0),
|
|---|
| 134 | ('Egg', 12.6, 0.7, 9.5, 0.0),
|
|---|
| 135 | ('Cow milk', 3.3, 4.8, 3.2, 0.0),
|
|---|
| 136 | ('Yogurt', 3.5, 4.7, 3.5, 0.0),
|
|---|
| 137 | ('White brine cheese', 14.0, 2.0, 21.0, 0.0),
|
|---|
| 138 | ('Kashkaval', 25.0, 1.5, 28.0, 0.0),
|
|---|
| 139 | ('Butter', 0.9, 0.1, 81.0, 0.0),
|
|---|
| 140 | ('Sunflower oil', 0.0, 0.0, 100.0, 0.0),
|
|---|
| 141 | ('Olive oil', 0.0, 0.0, 100.0, 0.0),
|
|---|
| 142 | ('White rice', 7.0, 80.0, 0.7, 1.3),
|
|---|
| 143 | ('Bulgur', 12.0, 76.0, 1.3, 18.0),
|
|---|
| 144 | ('White flour', 10.0, 76.0, 1.0, 2.7),
|
|---|
| 145 | ('Spaghetti', 13.0, 75.0, 1.5, 3.2),
|
|---|
| 146 | ('White bread', 9.0, 49.0, 3.2, 2.7),
|
|---|
| 147 | ('Oats', 17.0, 66.0, 7.0, 11.0),
|
|---|
| 148 | ('Potato', 2.0, 17.0, 0.1, 2.2),
|
|---|
| 149 | ('Dry white beans', 21.0, 60.0, 1.2, 15.0),
|
|---|
| 150 | ('Lentils', 25.0, 60.0, 1.1, 30.0),
|
|---|
| 151 | ('Chickpeas', 19.0, 61.0, 6.0, 17.0),
|
|---|
| 152 | ('Tomato', 0.9, 3.9, 0.2, 1.2),
|
|---|
| 153 | ('Red bell pepper', 1.0, 6.0, 0.3, 2.1),
|
|---|
| 154 | ('Onion', 1.1, 9.3, 0.1, 1.7),
|
|---|
| 155 | ('Garlic', 6.4, 33.0, 0.5, 2.1),
|
|---|
| 156 | ('Cucumber', 0.7, 3.6, 0.1, 0.5),
|
|---|
| 157 | ('Aubergine', 1.0, 5.9, 0.2, 3.0),
|
|---|
| 158 | ('Zucchini', 1.2, 3.1, 0.3, 1.0),
|
|---|
| 159 | ('Carrot', 0.9, 9.6, 0.2, 2.8),
|
|---|
| 160 | ('Spinach', 2.9, 3.6, 0.4, 2.2),
|
|---|
| 161 | ('Cabbage', 1.3, 5.8, 0.1, 2.5),
|
|---|
| 162 | ('Leek', 1.5, 14.0, 0.3, 1.8),
|
|---|
| 163 | ('Apple', 0.3, 14.0, 0.2, 2.4),
|
|---|
| 164 | ('Banana', 1.1, 23.0, 0.3, 2.6),
|
|---|
| 165 | ('Strawberry', 0.7, 7.7, 0.3, 2.0),
|
|---|
| 166 | ('Grapes', 0.7, 18.0, 0.2, 0.9),
|
|---|
| 167 | ('Lemon', 1.1, 9.3, 0.3, 2.8),
|
|---|
| 168 | ('Walnut', 15.0, 14.0, 65.0, 6.7),
|
|---|
| 169 | ('Almond', 21.0, 22.0, 50.0, 12.5),
|
|---|
| 170 | ('Sunflower seed', 21.0, 20.0, 51.0, 8.6),
|
|---|
| 171 | ('Chia seed', 17.0, 42.0, 31.0, 34.0),
|
|---|
| 172 | ('Parsley', 3.0, 6.3, 0.8, 3.3),
|
|---|
| 173 | ('Dill', 3.5, 7.0, 1.1, 2.1),
|
|---|
| 174 | ('Paprika powder', 14.0, 54.0, 13.0, 35.0),
|
|---|
| 175 | ('Black pepper', 10.0, 64.0, 3.3, 25.0),
|
|---|
| 176 | ('Honey', 0.3, 82.0, 0.0, 0.2)
|
|---|
| 177 | ) AS m(ing, protein, carbohydrate, fat, fibre)
|
|---|
| 178 | CROSS JOIN LATERAL (VALUES
|
|---|
| 179 | ('Protein', m.protein),
|
|---|
| 180 | ('Total carbohydrate', m.carbohydrate),
|
|---|
| 181 | ('Total fat', m.fat),
|
|---|
| 182 | ('Dietary fibre', m.fibre)
|
|---|
| 183 | ) AS v(nut, qty)
|
|---|
| 184 | JOIN nutrient n ON n.description = v.nut;
|
|---|
| 185 |
|
|---|
| 186 | INSERT INTO ingredient_contains_nutrient (ingredient_name, nutrient_id, quantity)
|
|---|
| 187 | SELECT v.ing, n.id, v.qty
|
|---|
| 188 | FROM (VALUES
|
|---|
| 189 | ('Red bell pepper', 'Vitamin C', 128.0),
|
|---|
| 190 | ('Parsley', 'Vitamin C', 133.0),
|
|---|
| 191 | ('Spinach', 'Vitamin C', 28.0),
|
|---|
| 192 | ('Tomato', 'Vitamin C', 14.0),
|
|---|
| 193 | ('Cabbage', 'Vitamin C', 36.0),
|
|---|
| 194 | ('Strawberry', 'Vitamin C', 59.0),
|
|---|
| 195 | ('Potato', 'Vitamin C', 20.0),
|
|---|
| 196 | ('Lemon', 'Vitamin C', 53.0),
|
|---|
| 197 | ('Carrot', 'Vitamin A', 835.0),
|
|---|
| 198 | ('Spinach', 'Vitamin A', 469.0),
|
|---|
| 199 | ('Red bell pepper', 'Vitamin A', 157.0),
|
|---|
| 200 | ('Butter', 'Vitamin A', 684.0),
|
|---|
| 201 | ('Trout fillet', 'Vitamin D', 6.5),
|
|---|
| 202 | ('Mackerel', 'Vitamin D', 16.0),
|
|---|
| 203 | ('Egg', 'Vitamin D', 2.0),
|
|---|
| 204 | ('Beef mince', 'Vitamin B12', 2.6),
|
|---|
| 205 | ('Trout fillet', 'Vitamin B12', 4.5),
|
|---|
| 206 | ('Mackerel', 'Vitamin B12', 8.7),
|
|---|
| 207 | ('Egg', 'Vitamin B12', 1.1),
|
|---|
| 208 | ('Cow milk', 'Vitamin B12', 0.5),
|
|---|
| 209 | ('Spinach', 'Folate', 194.0),
|
|---|
| 210 | ('Lentils', 'Folate', 479.0),
|
|---|
| 211 | ('Dry white beans', 'Folate', 388.0),
|
|---|
| 212 | ('Parsley', 'Folate', 152.0),
|
|---|
| 213 | ('Cow milk', 'Calcium', 120.0),
|
|---|
| 214 | ('Yogurt', 'Calcium', 121.0),
|
|---|
| 215 | ('White brine cheese','Calcium', 493.0),
|
|---|
| 216 | ('Kashkaval', 'Calcium', 700.0),
|
|---|
| 217 | ('Spinach', 'Calcium', 99.0),
|
|---|
| 218 | ('Almond', 'Calcium', 269.0),
|
|---|
| 219 | ('Chia seed', 'Calcium', 631.0),
|
|---|
| 220 | ('Spinach', 'Iron', 2.7),
|
|---|
| 221 | ('Lentils', 'Iron', 7.5),
|
|---|
| 222 | ('Dry white beans', 'Iron', 5.5),
|
|---|
| 223 | ('Beef mince', 'Iron', 2.6),
|
|---|
| 224 | ('Oats', 'Iron', 4.7),
|
|---|
| 225 | ('Chia seed', 'Iron', 7.7),
|
|---|
| 226 | ('Almond', 'Magnesium', 270.0),
|
|---|
| 227 | ('Oats', 'Magnesium', 177.0),
|
|---|
| 228 | ('Spinach', 'Magnesium', 79.0),
|
|---|
| 229 | ('Walnut', 'Magnesium', 158.0),
|
|---|
| 230 | ('Potato', 'Potassium', 425.0),
|
|---|
| 231 | ('Banana', 'Potassium', 358.0),
|
|---|
| 232 | ('Spinach', 'Potassium', 558.0),
|
|---|
| 233 | ('Tomato', 'Potassium', 237.0),
|
|---|
| 234 | ('Dry white beans', 'Potassium', 1795.0),
|
|---|
| 235 | ('Beef mince', 'Zinc', 4.8),
|
|---|
| 236 | ('Lentils', 'Zinc', 3.3),
|
|---|
| 237 | ('Oats', 'Zinc', 4.0),
|
|---|
| 238 | ('Salt', 'Sodium', 38758.0),
|
|---|
| 239 | ('White brine cheese','Sodium', 1200.0),
|
|---|
| 240 | ('White bread', 'Sodium', 490.0),
|
|---|
| 241 | ('Kashkaval', 'Sodium', 800.0),
|
|---|
| 242 | ('Salt', 'Iodine', 2500.0),
|
|---|
| 243 | ('Trout fillet', 'Selenium', 12.6),
|
|---|
| 244 | ('Mackerel', 'Selenium', 44.1),
|
|---|
| 245 | ('Chicken breast', 'Selenium', 22.8),
|
|---|
| 246 | ('Chicken breast', 'Phosphorus', 210.0),
|
|---|
| 247 | ('Cow milk', 'Phosphorus', 92.0),
|
|---|
| 248 | ('Almond', 'Vitamin E', 25.6),
|
|---|
| 249 | ('Sunflower oil', 'Vitamin E', 41.1),
|
|---|
| 250 | ('Olive oil', 'Vitamin E', 14.4),
|
|---|
| 251 | ('Spinach', 'Vitamin K', 483.0),
|
|---|
| 252 | ('Parsley', 'Vitamin K', 1640.0)
|
|---|
| 253 | ) AS v(ing, nut, qty)
|
|---|
| 254 | JOIN nutrient n ON n.description = v.nut;
|
|---|
| 255 |
|
|---|
| 256 |
|
|---|
| 257 |
|
|---|
| 258 | INSERT INTO recipe (name, guide, kcal_sum, servings, user_email) VALUES
|
|---|
| 259 | ('Tavce Gravce',
|
|---|
| 260 | E'1. Soak the beans overnight, then boil until soft.\n2. Fry the chopped onion in oil, add paprika off the heat.\n3. Combine everything in a clay pan, season and bake at 200 C for 40 minutes.\n4. Serve hot with fresh bread.',
|
|---|
| 261 | 0, 6, 'marija.trajkovska@gmail.com'),
|
|---|
| 262 |
|
|---|
| 263 | ('Shopska Salad',
|
|---|
| 264 | E'1. Dice the tomatoes and cucumbers, slice the onion thinly.\n2. Season with salt and olive oil and toss.\n3. Grate the white brine cheese generously over the top and serve immediately.',
|
|---|
| 265 | 0, 4, 'stefan.petrov@gmail.com'),
|
|---|
| 266 |
|
|---|
| 267 | ('Turli Tava',
|
|---|
| 268 | E'1. Brown the beef mince with the onion.\n2. Cut all vegetables into large chunks and layer them in a deep tray.\n3. Add the meat, oil, spices and a cup of water.\n4. Bake covered at 190 C for 60 minutes, then 15 minutes uncovered.',
|
|---|
| 269 | 0, 6, 'ana.jovanovska@yahoo.com'),
|
|---|
| 270 |
|
|---|
| 271 | ('Homemade Ajvar',
|
|---|
| 272 | E'1. Roast the peppers and aubergine until the skins blister, then peel them.\n2. Mince the flesh and cook it slowly in oil, stirring constantly for about two hours.\n3. Add garlic and salt near the end and jar while hot.',
|
|---|
| 273 | 0, 20, 'elena.dimitrova@hotmail.com'),
|
|---|
| 274 |
|
|---|
| 275 | ('Grilled Trout with Parsley',
|
|---|
| 276 | E'1. Clean the fillets and pat them dry.\n2. Rub with olive oil, crushed garlic, salt and pepper.\n3. Grill 4 minutes per side and finish with chopped parsley and lemon.',
|
|---|
| 277 | 0, 2, 'nikola.stojanov@gmail.com'),
|
|---|
| 278 |
|
|---|
| 279 | ('Chicken Bulgur Bowl',
|
|---|
| 280 | E'1. Boil the bulgur in twice its volume of water for 12 minutes.\n2. Grill the seasoned chicken breast and slice it.\n3. Assemble with diced tomato and cucumber, finish with olive oil.',
|
|---|
| 281 | 0, 3, 'viktor.ilievski@nutritioneer.mk'),
|
|---|
| 282 |
|
|---|
| 283 | ('Oat Porridge with Banana and Walnuts',
|
|---|
| 284 | E'1. Simmer the oats in milk for 5 minutes, stirring.\n2. Pour into a bowl and top with sliced banana and crushed walnuts.\n3. Drizzle honey over the top.',
|
|---|
| 285 | 0, 2, 'marija.trajkovska@gmail.com'),
|
|---|
| 286 |
|
|---|
| 287 | ('Lentil Soup',
|
|---|
| 288 | E'1. Saute the diced onion, carrot and garlic in olive oil.\n2. Add the rinsed lentils and 1.5 litres of water.\n3. Simmer for 35 minutes, season and blend half of the soup for a thicker texture.',
|
|---|
| 289 | 0, 5, 'bojan.kostov@gmail.com'),
|
|---|
| 290 |
|
|---|
| 291 | ('Zelnik Spinach and Cheese Filling',
|
|---|
| 292 | E'1. Wilt the washed spinach and squeeze out all excess water.\n2. Crumble in the white brine cheese and mix with beaten egg and oil.\n3. Season lightly - the cheese is already salty. Use as filling for zelnik.',
|
|---|
| 293 | 0, 8, 'elena.dimitrova@hotmail.com'),
|
|---|
| 294 |
|
|---|
| 295 | ('Tarator',
|
|---|
| 296 | E'1. Grate the cucumber and drain it briefly.\n2. Whisk the yogurt with crushed garlic, chopped dill, salt and olive oil.\n3. Fold in the cucumber and crushed walnuts, chill for one hour before serving.',
|
|---|
| 297 | 0, 4, 'ana.jovanovska@yahoo.com'),
|
|---|
| 298 |
|
|---|
| 299 | ('Baked Mackerel with Vegetables',
|
|---|
| 300 | E'1. Slice the potatoes, carrots and onion and spread them on a tray with oil and salt.\n2. Bake at 200 C for 25 minutes.\n3. Place the cleaned mackerel on top and bake for another 20 minutes.',
|
|---|
| 301 | 0, 3, 'nikola.stojanov@gmail.com'),
|
|---|
| 302 |
|
|---|
| 303 | ('Protein Pancakes',
|
|---|
| 304 | E'1. Blend the oats, eggs, milk and banana into a smooth batter.\n2. Rest the batter for 10 minutes.\n3. Fry small pancakes in a little butter over medium heat, about 2 minutes per side.',
|
|---|
| 305 | 0, 3, 'teodora.mihajlova@nutritioneer.mk'),
|
|---|
| 306 |
|
|---|
| 307 | ('Grilled Chicken Salad',
|
|---|
| 308 | E'1. Grill the seasoned chicken breast and let it rest, then slice.\n2. Toss the spinach, tomato and cucumber with olive oil and salt.\n3. Arrange the chicken on top and serve at room temperature.',
|
|---|
| 309 | 0, 2, 'stefan.petrov@gmail.com'),
|
|---|
| 310 |
|
|---|
| 311 | ('Stuffed Peppers with Rice',
|
|---|
| 312 | E'1. Core the peppers carefully without splitting them.\n2. Mix the rice, browned mince, onion, oil and spices.\n3. Fill the peppers, stand them upright in a pot with water and simmer for 50 minutes.',
|
|---|
| 313 | 0, 4, 'filip.angelov@gmail.com');
|
|---|
| 314 |
|
|---|
| 315 |
|
|---|
| 316 | INSERT INTO recipe_contains_ingredient (recipe_id, ingredient_name, ingredient_quantity)
|
|---|
| 317 | SELECT r.id, v.ing, v.qty
|
|---|
| 318 | FROM (VALUES
|
|---|
| 319 | -- Tavce Gravce
|
|---|
| 320 | ('Tavce Gravce','Dry white beans',500), ('Tavce Gravce','Onion',200),
|
|---|
| 321 | ('Tavce Gravce','Red bell pepper',100), ('Tavce Gravce','Sunflower oil',60),
|
|---|
| 322 | ('Tavce Gravce','Paprika powder',10), ('Tavce Gravce','Salt',8),
|
|---|
| 323 | ('Tavce Gravce','Black pepper',2), ('Tavce Gravce','Parsley',15),
|
|---|
| 324 | -- Shopska Salad
|
|---|
| 325 | ('Shopska Salad','Tomato',400), ('Shopska Salad','Cucumber',300),
|
|---|
| 326 | ('Shopska Salad','Onion',80), ('Shopska Salad','White brine cheese',150),
|
|---|
| 327 | ('Shopska Salad','Olive oil',30), ('Shopska Salad','Salt',5),
|
|---|
| 328 | -- Turli Tava
|
|---|
| 329 | ('Turli Tava','Beef mince',300), ('Turli Tava','Potato',400),
|
|---|
| 330 | ('Turli Tava','Aubergine',300), ('Turli Tava','Zucchini',250),
|
|---|
| 331 | ('Turli Tava','Red bell pepper',200), ('Turli Tava','Tomato',250),
|
|---|
| 332 | ('Turli Tava','Onion',150), ('Turli Tava','Sunflower oil',50),
|
|---|
| 333 | ('Turli Tava','Salt',10), ('Turli Tava','Black pepper',3),
|
|---|
| 334 | ('Turli Tava','Paprika powder',8),
|
|---|
| 335 | -- Homemade Ajvar
|
|---|
| 336 | ('Homemade Ajvar','Red bell pepper',2000), ('Homemade Ajvar','Aubergine',500),
|
|---|
| 337 | ('Homemade Ajvar','Garlic',30), ('Homemade Ajvar','Sunflower oil',200),
|
|---|
| 338 | ('Homemade Ajvar','Salt',20),
|
|---|
| 339 | -- Grilled Trout with Parsley
|
|---|
| 340 | ('Grilled Trout with Parsley','Trout fillet',400), ('Grilled Trout with Parsley','Olive oil',20),
|
|---|
| 341 | ('Grilled Trout with Parsley','Garlic',10), ('Grilled Trout with Parsley','Parsley',20),
|
|---|
| 342 | ('Grilled Trout with Parsley','Lemon',60), ('Grilled Trout with Parsley','Salt',5),
|
|---|
| 343 | ('Grilled Trout with Parsley','Black pepper',2),
|
|---|
| 344 | -- Chicken Bulgur Bowl
|
|---|
| 345 | ('Chicken Bulgur Bowl','Chicken breast',400), ('Chicken Bulgur Bowl','Bulgur',200),
|
|---|
| 346 | ('Chicken Bulgur Bowl','Tomato',150), ('Chicken Bulgur Bowl','Cucumber',100),
|
|---|
| 347 | ('Chicken Bulgur Bowl','Olive oil',20), ('Chicken Bulgur Bowl','Salt',5),
|
|---|
| 348 | -- Oat Porridge with Banana and Walnuts
|
|---|
| 349 | ('Oat Porridge with Banana and Walnuts','Oats',80), ('Oat Porridge with Banana and Walnuts','Cow milk',250),
|
|---|
| 350 | ('Oat Porridge with Banana and Walnuts','Banana',120),('Oat Porridge with Banana and Walnuts','Walnut',30),
|
|---|
| 351 | ('Oat Porridge with Banana and Walnuts','Honey',20),
|
|---|
| 352 | -- Lentil Soup
|
|---|
| 353 | ('Lentil Soup','Lentils',300), ('Lentil Soup','Carrot',150),
|
|---|
| 354 | ('Lentil Soup','Onion',120), ('Lentil Soup','Garlic',15),
|
|---|
| 355 | ('Lentil Soup','Olive oil',30), ('Lentil Soup','Salt',8),
|
|---|
| 356 | ('Lentil Soup','Black pepper',2),
|
|---|
| 357 | -- Zelnik Spinach and Cheese Filling
|
|---|
| 358 | ('Zelnik Spinach and Cheese Filling','Spinach',500), ('Zelnik Spinach and Cheese Filling','White brine cheese',300),
|
|---|
| 359 | ('Zelnik Spinach and Cheese Filling','Egg',120), ('Zelnik Spinach and Cheese Filling','Sunflower oil',40),
|
|---|
| 360 | ('Zelnik Spinach and Cheese Filling','Salt',6),
|
|---|
| 361 | -- Tarator
|
|---|
| 362 | ('Tarator','Yogurt',500), ('Tarator','Cucumber',300),
|
|---|
| 363 | ('Tarator','Garlic',10), ('Tarator','Dill',15),
|
|---|
| 364 | ('Tarator','Olive oil',15), ('Tarator','Walnut',25),
|
|---|
| 365 | ('Tarator','Salt',4),
|
|---|
| 366 | -- Baked Mackerel with Vegetables
|
|---|
| 367 | ('Baked Mackerel with Vegetables','Mackerel',500), ('Baked Mackerel with Vegetables','Potato',300),
|
|---|
| 368 | ('Baked Mackerel with Vegetables','Carrot',150), ('Baked Mackerel with Vegetables','Onion',100),
|
|---|
| 369 | ('Baked Mackerel with Vegetables','Olive oil',25), ('Baked Mackerel with Vegetables','Salt',6),
|
|---|
| 370 | ('Baked Mackerel with Vegetables','Black pepper',2),
|
|---|
| 371 | -- Protein Pancakes
|
|---|
| 372 | ('Protein Pancakes','Oats',100), ('Protein Pancakes','Egg',150),
|
|---|
| 373 | ('Protein Pancakes','Cow milk',150),('Protein Pancakes','Banana',100),
|
|---|
| 374 | ('Protein Pancakes','Butter',15),
|
|---|
| 375 | -- Grilled Chicken Salad
|
|---|
| 376 | ('Grilled Chicken Salad','Chicken breast',300), ('Grilled Chicken Salad','Spinach',150),
|
|---|
| 377 | ('Grilled Chicken Salad','Tomato',150), ('Grilled Chicken Salad','Cucumber',100),
|
|---|
| 378 | ('Grilled Chicken Salad','Olive oil',20), ('Grilled Chicken Salad','Salt',4),
|
|---|
| 379 | -- Stuffed Peppers with Rice
|
|---|
| 380 | ('Stuffed Peppers with Rice','Red bell pepper',600), ('Stuffed Peppers with Rice','White rice',200),
|
|---|
| 381 | ('Stuffed Peppers with Rice','Beef mince',250), ('Stuffed Peppers with Rice','Onion',100),
|
|---|
| 382 | ('Stuffed Peppers with Rice','Sunflower oil',40), ('Stuffed Peppers with Rice','Salt',8),
|
|---|
| 383 | ('Stuffed Peppers with Rice','Paprika powder',5)
|
|---|
| 384 | ) AS v(recipe_name, ing, qty)
|
|---|
| 385 | JOIN recipe r ON r.name = v.recipe_name;
|
|---|
| 386 |
|
|---|
| 387 | INSERT INTO recipe_contains_restriction (recipe_id, restriction_id)
|
|---|
| 388 | SELECT r.id, res.id
|
|---|
| 389 | FROM (VALUES
|
|---|
| 390 | ('Tavce Gravce','Contains no ingredient of animal origin'),
|
|---|
| 391 | ('Tavce Gravce','Contains no meat and no fish'),
|
|---|
| 392 | ('Tavce Gravce','Free of gluten containing cereals'),
|
|---|
| 393 | ('Tavce Gravce','Free of lactose'),
|
|---|
| 394 | ('Shopska Salad','Contains no meat and no fish'),
|
|---|
| 395 | ('Shopska Salad','Contains milk protein and lactose'),
|
|---|
| 396 | ('Shopska Salad','Free of gluten containing cereals'),
|
|---|
| 397 | ('Turli Tava','Free of gluten containing cereals'),
|
|---|
| 398 | ('Turli Tava','Free of lactose'),
|
|---|
| 399 | ('Homemade Ajvar','Contains no ingredient of animal origin'),
|
|---|
| 400 | ('Homemade Ajvar','Contains no meat and no fish'),
|
|---|
| 401 | ('Homemade Ajvar','Free of gluten containing cereals'),
|
|---|
| 402 | ('Homemade Ajvar','Free of lactose'),
|
|---|
| 403 | ('Grilled Trout with Parsley','Fish and seafood allowed, no other meat'),
|
|---|
| 404 | ('Grilled Trout with Parsley','Contains fish'),
|
|---|
| 405 | ('Grilled Trout with Parsley','Free of gluten containing cereals'),
|
|---|
| 406 | ('Grilled Trout with Parsley','Low carbohydrate and high fat, ketogenic'),
|
|---|
| 407 | ('Chicken Bulgur Bowl','Contains gluten from wheat, barley or rye'),
|
|---|
| 408 | ('Chicken Bulgur Bowl','Free of lactose'),
|
|---|
| 409 | ('Oat Porridge with Banana and Walnuts','Contains no meat and no fish'),
|
|---|
| 410 | ('Oat Porridge with Banana and Walnuts','Contains milk protein and lactose'),
|
|---|
| 411 | ('Oat Porridge with Banana and Walnuts','Contains tree nuts'),
|
|---|
| 412 | ('Lentil Soup','Contains no ingredient of animal origin'),
|
|---|
| 413 | ('Lentil Soup','Contains no meat and no fish'),
|
|---|
| 414 | ('Lentil Soup','Free of gluten containing cereals'),
|
|---|
| 415 | ('Lentil Soup','Free of lactose'),
|
|---|
| 416 | ('Zelnik Spinach and Cheese Filling','Contains no meat and no fish'),
|
|---|
| 417 | ('Zelnik Spinach and Cheese Filling','Contains milk protein and lactose'),
|
|---|
| 418 | ('Zelnik Spinach and Cheese Filling','Contains egg'),
|
|---|
| 419 | ('Tarator','Contains no meat and no fish'),
|
|---|
| 420 | ('Tarator','Contains milk protein and lactose'),
|
|---|
| 421 | ('Tarator','Contains tree nuts'),
|
|---|
| 422 | ('Tarator','Free of gluten containing cereals'),
|
|---|
| 423 | ('Baked Mackerel with Vegetables','Fish and seafood allowed, no other meat'),
|
|---|
| 424 | ('Baked Mackerel with Vegetables','Contains fish'),
|
|---|
| 425 | ('Baked Mackerel with Vegetables','Free of lactose'),
|
|---|
| 426 | ('Protein Pancakes','Contains no meat and no fish'),
|
|---|
| 427 | ('Protein Pancakes','Contains milk protein and lactose'),
|
|---|
| 428 | ('Protein Pancakes','Contains egg'),
|
|---|
| 429 | ('Grilled Chicken Salad','Free of gluten containing cereals'),
|
|---|
| 430 | ('Grilled Chicken Salad','Free of lactose'),
|
|---|
| 431 | ('Grilled Chicken Salad','Suitable for a diabetic meal plan, low glycaemic load'),
|
|---|
| 432 | ('Stuffed Peppers with Rice','Free of gluten containing cereals'),
|
|---|
| 433 | ('Stuffed Peppers with Rice','Free of lactose')
|
|---|
| 434 | ) AS v(recipe_name, restriction_description)
|
|---|
| 435 | JOIN recipe r ON r.name = v.recipe_name
|
|---|
| 436 | JOIN restriction res ON res.description = v.restriction_description;
|
|---|
| 437 |
|
|---|
| 438 |
|
|---|
| 439 | INSERT INTO post (created_by, recipe_id, is_private, is_favourite, status, created_at, media, media_type, media_name)
|
|---|
| 440 | SELECT v.author, r.id, v.is_private, v.is_favourite, v.status::post_status, v.created_at::timestamp, NULL, NULL, v.media_name
|
|---|
| 441 | FROM (VALUES
|
|---|
| 442 | ('marija.trajkovska@gmail.com', 'Tavce Gravce', FALSE, TRUE, 'published', '2026-01-12 18:20:00', 'tavce_gravce.jpg'),
|
|---|
| 443 | ('stefan.petrov@gmail.com', 'Shopska Salad', FALSE, FALSE, 'published', '2026-01-14 12:05:00', 'shopska.jpg'),
|
|---|
| 444 | ('ana.jovanovska@yahoo.com', 'Turli Tava', FALSE, TRUE, 'published', '2026-01-15 19:40:00', 'turli_tava.jpg'),
|
|---|
| 445 | ('elena.dimitrova@hotmail.com', 'Homemade Ajvar', FALSE, TRUE, 'published', '2026-01-18 16:10:00', 'ajvar_jars.jpg'),
|
|---|
| 446 | ('nikola.stojanov@gmail.com', 'Grilled Trout with Parsley', FALSE, FALSE, 'published', '2026-01-20 20:00:00', 'trout.jpg'),
|
|---|
| 447 | ('viktor.ilievski@nutritioneer.mk', 'Chicken Bulgur Bowl', FALSE, TRUE, 'published', '2026-01-21 13:30:00', 'bulgur_bowl.jpg'),
|
|---|
| 448 | ('marija.trajkovska@gmail.com', 'Oat Porridge with Banana and Walnuts', TRUE, FALSE, 'published', '2026-01-22 08:15:00', 'porridge.jpg'),
|
|---|
| 449 | ('bojan.kostov@gmail.com', 'Lentil Soup', FALSE, FALSE, 'draft', '2026-01-23 17:45:00', NULL),
|
|---|
| 450 | ('elena.dimitrova@hotmail.com', 'Zelnik Spinach and Cheese Filling', FALSE, FALSE, 'archived', '2026-01-05 11:00:00', 'zelnik.jpg'),
|
|---|
| 451 | ('ana.jovanovska@yahoo.com', 'Tarator', FALSE, TRUE, 'published', '2026-01-25 14:20:00', 'tarator.jpg'),
|
|---|
| 452 | ('nikola.stojanov@gmail.com', 'Baked Mackerel with Vegetables', FALSE, FALSE, 'published', '2026-01-26 19:10:00', 'mackerel.jpg'),
|
|---|
| 453 | ('teodora.mihajlova@nutritioneer.mk','Protein Pancakes', FALSE, TRUE, 'published', '2026-01-27 09:00:00', 'pancakes.jpg'),
|
|---|
| 454 | ('stefan.petrov@gmail.com', 'Grilled Chicken Salad', TRUE, FALSE, 'draft', '2026-01-28 12:40:00', NULL),
|
|---|
| 455 | ('filip.angelov@gmail.com', 'Stuffed Peppers with Rice', FALSE, FALSE, 'published', '2026-01-29 18:55:00', 'peppers.jpg')
|
|---|
| 456 | ) AS v(author, recipe_name, is_private, is_favourite, status, created_at, media_name)
|
|---|
| 457 | JOIN recipe r ON r.name = v.recipe_name;
|
|---|
| 458 |
|
|---|
| 459 | INSERT INTO post (created_by, recipe_id, is_private, is_favourite, status, created_at, media, media_type, media_name)
|
|---|
| 460 | VALUES ('marija.trajkovska@gmail.com', NULL, TRUE, FALSE, 'published', '2026-01-30 07:30:00',
|
|---|
| 461 | decode('iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==', 'base64'),
|
|---|
| 462 | 'image/png', 'progress_week4.png');
|
|---|
| 463 |
|
|---|
| 464 |
|
|---|
| 465 | INSERT INTO comment (description, created_at, post_id, created_by)
|
|---|
| 466 | SELECT v.body, v.created_at::timestamp, p.id, v.author
|
|---|
| 467 | FROM (VALUES
|
|---|
| 468 | ('Tavce Gravce', 'stefan.petrov@gmail.com', 'Exactly how my grandmother made it. Adding it to my planner.', '2026-01-12 19:02:00'),
|
|---|
| 469 | ('Tavce Gravce', 'ana.jovanovska@yahoo.com', 'How long do the beans need to soak?', '2026-01-13 09:11:00'),
|
|---|
| 470 | ('Tavce Gravce', 'marija.trajkovska@gmail.com', 'At least eight hours, overnight is best.', '2026-01-13 09:40:00'),
|
|---|
| 471 | ('Shopska Salad', 'elena.dimitrova@hotmail.com', 'Simple and perfect. I use half the cheese to cut the sodium.', '2026-01-14 13:20:00'),
|
|---|
| 472 | ('Turli Tava', 'bojan.kostov@gmail.com', 'Made it without the mince, still excellent.', '2026-01-16 20:15:00'),
|
|---|
| 473 | ('Turli Tava', 'viktor.ilievski@nutritioneer.mk', 'Good macro balance for a rest day.', '2026-01-16 21:00:00'),
|
|---|
| 474 | ('Homemade Ajvar', 'marija.trajkovska@gmail.com', 'Two hours of stirring is no joke but worth every minute.', '2026-01-19 10:05:00'),
|
|---|
| 475 | ('Homemade Ajvar', 'filip.angelov@gmail.com', 'How many jars does this quantity fill?', '2026-01-19 11:30:00'),
|
|---|
| 476 | ('Grilled Trout with Parsley', 'teodora.mihajlova@nutritioneer.mk','Very clean protein source, great for a cutting phase.', '2026-01-21 08:45:00'),
|
|---|
| 477 | ('Chicken Bulgur Bowl', 'stefan.petrov@gmail.com', 'This is now my default meal prep for the week.', '2026-01-21 18:10:00'),
|
|---|
| 478 | ('Chicken Bulgur Bowl', 'nikola.stojanov@gmail.com', 'Swapped bulgur for rice to keep it gluten free.', '2026-01-22 12:25:00'),
|
|---|
| 479 | ('Tarator', 'stefan.petrov@gmail.com', 'Draining the cucumber really does make a difference.', '2026-01-25 16:00:00'),
|
|---|
| 480 | ('Baked Mackerel with Vegetables','ana.jovanovska@yahoo.com', 'The vitamin D content on this one is impressive.', '2026-01-27 08:20:00'),
|
|---|
| 481 | ('Protein Pancakes', 'marija.trajkovska@gmail.com', 'Thirty grams of protein in a breakfast, finally.', '2026-01-27 10:15:00'),
|
|---|
| 482 | ('Stuffed Peppers with Rice', 'elena.dimitrova@hotmail.com', 'Try it with a spoon of ajvar mixed into the filling.', '2026-01-30 09:05:00')
|
|---|
| 483 | ) AS v(recipe_name, author, body, created_at)
|
|---|
| 484 | JOIN recipe r ON r.name = v.recipe_name
|
|---|
| 485 | JOIN post p ON p.recipe_id = r.id;
|
|---|
| 486 |
|
|---|
| 487 |
|
|---|
| 488 | INSERT INTO grocery_list (date_time, notes, is_bought, kcal, user_email) VALUES
|
|---|
| 489 | ('2026-01-11 10:00:00', 'Weekly shopping - Sunday cooking', TRUE, 0, 'marija.trajkovska@gmail.com'),
|
|---|
| 490 | ('2026-01-14 17:30:00', 'Vegetables for the tray bake', TRUE, 0, 'ana.jovanovska@yahoo.com'),
|
|---|
| 491 | ('2026-01-17 09:15:00', 'Ajvar season - green market', TRUE, 0, 'elena.dimitrova@hotmail.com'),
|
|---|
| 492 | ('2026-01-19 18:00:00', 'Fish market on Saturday morning', FALSE, 0, 'nikola.stojanov@gmail.com'),
|
|---|
| 493 | ('2026-01-22 11:45:00', 'Cheap protein week', FALSE, 0, 'bojan.kostov@gmail.com');
|
|---|
| 494 |
|
|---|
| 495 | INSERT INTO grocery_list_bulk_add_ingredient (list_id, recipe_id)
|
|---|
| 496 | SELECT g.id, r.id
|
|---|
| 497 | FROM (VALUES
|
|---|
| 498 | ('marija.trajkovska@gmail.com', '2026-01-11 10:00:00', 'Tavce Gravce'),
|
|---|
| 499 | ('marija.trajkovska@gmail.com', '2026-01-11 10:00:00', 'Oat Porridge with Banana and Walnuts'),
|
|---|
| 500 | ('ana.jovanovska@yahoo.com', '2026-01-14 17:30:00', 'Turli Tava'),
|
|---|
| 501 | ('ana.jovanovska@yahoo.com', '2026-01-14 17:30:00', 'Tarator'),
|
|---|
| 502 | ('elena.dimitrova@hotmail.com', '2026-01-17 09:15:00', 'Homemade Ajvar'),
|
|---|
| 503 | ('nikola.stojanov@gmail.com', '2026-01-19 18:00:00', 'Grilled Trout with Parsley'),
|
|---|
| 504 | ('nikola.stojanov@gmail.com', '2026-01-19 18:00:00', 'Baked Mackerel with Vegetables'),
|
|---|
| 505 | ('bojan.kostov@gmail.com', '2026-01-22 11:45:00', 'Lentil Soup')
|
|---|
| 506 | ) AS v(user_email, dt, recipe_name)
|
|---|
| 507 | JOIN grocery_list g ON g.user_email = v.user_email AND g.date_time = v.dt::timestamp
|
|---|
| 508 | JOIN recipe r ON r.name = v.recipe_name;
|
|---|
| 509 |
|
|---|
| 510 | INSERT INTO grocery_list_single_add_ingredient (list_id, ingredient_name, buy_quantity)
|
|---|
| 511 | SELECT g.id, v.ing, v.qty
|
|---|
| 512 | FROM (VALUES
|
|---|
| 513 | ('marija.trajkovska@gmail.com', '2026-01-11 10:00:00', 'Sunflower oil', 1000),
|
|---|
| 514 | ('marija.trajkovska@gmail.com', '2026-01-11 10:00:00', 'Salt', 500),
|
|---|
| 515 | ('marija.trajkovska@gmail.com', '2026-01-11 10:00:00', 'Apple', 1500),
|
|---|
| 516 | ('ana.jovanovska@yahoo.com', '2026-01-14 17:30:00', 'Potato', 2000),
|
|---|
| 517 | ('ana.jovanovska@yahoo.com', '2026-01-14 17:30:00', 'White bread', 500),
|
|---|
| 518 | ('elena.dimitrova@hotmail.com', '2026-01-17 09:15:00', 'Red bell pepper', 5000),
|
|---|
| 519 | ('elena.dimitrova@hotmail.com', '2026-01-17 09:15:00', 'Garlic', 150),
|
|---|
| 520 | ('nikola.stojanov@gmail.com', '2026-01-19 18:00:00', 'Olive oil', 750),
|
|---|
| 521 | ('nikola.stojanov@gmail.com', '2026-01-19 18:00:00', 'Lemon', 300),
|
|---|
| 522 | ('bojan.kostov@gmail.com', '2026-01-22 11:45:00', 'Chickpeas', 1000),
|
|---|
| 523 | ('bojan.kostov@gmail.com', '2026-01-22 11:45:00', 'Carrot', 800),
|
|---|
| 524 | ('bojan.kostov@gmail.com', '2026-01-22 11:45:00', 'Onion', 700)
|
|---|
| 525 | ) AS v(user_email, dt, ing, qty)
|
|---|
| 526 | JOIN grocery_list g ON g.user_email = v.user_email AND g.date_time = v.dt::timestamp;
|
|---|
| 527 |
|
|---|
| 528 |
|
|---|
| 529 | INSERT INTO intake_planner (date_time, notes, kcal, is_consumed, user_email) VALUES
|
|---|
| 530 | ('2026-01-22 08:30:00', 'Breakfast', 0, TRUE, 'marija.trajkovska@gmail.com'),
|
|---|
| 531 | ('2026-01-22 13:00:00', 'Lunch at home', 0, TRUE, 'marija.trajkovska@gmail.com'),
|
|---|
| 532 | ('2026-01-22 19:30:00', 'Light dinner', 0, TRUE, 'marija.trajkovska@gmail.com'),
|
|---|
| 533 | ('2026-01-23 08:30:00', 'Breakfast', 0, TRUE, 'marija.trajkovska@gmail.com'),
|
|---|
| 534 | ('2026-01-23 13:15:00', 'Lunch', 0, TRUE, 'marija.trajkovska@gmail.com'),
|
|---|
| 535 | ('2026-01-24 09:00:00', 'Late breakfast after training', 0, TRUE, 'marija.trajkovska@gmail.com'),
|
|---|
| 536 | ('2026-01-24 20:00:00', 'Dinner with family', 0, TRUE, 'marija.trajkovska@gmail.com'),
|
|---|
| 537 | ('2026-01-25 12:30:00', 'Planned lunch - not eaten yet', 0, FALSE, 'marija.trajkovska@gmail.com'),
|
|---|
| 538 | ('2026-01-22 12:45:00', 'Meal prep box 1', 0, TRUE, 'stefan.petrov@gmail.com'),
|
|---|
| 539 | ('2026-01-23 12:45:00', 'Meal prep box 2', 0, TRUE, 'stefan.petrov@gmail.com'),
|
|---|
| 540 | ('2026-01-26 19:45:00', 'Dinner', 0, TRUE, 'nikola.stojanov@gmail.com'),
|
|---|
| 541 | ('2026-01-27 09:30:00', 'Post workout breakfast', 0, TRUE, 'teodora.mihajlova@nutritioneer.mk'),
|
|---|
| 542 | ('2026-01-28 13:00:00', 'Lunch', 0, TRUE, 'ana.jovanovska@yahoo.com'),
|
|---|
| 543 | ('2026-01-29 10:00:00', 'Coffee and fruit only', 180, TRUE, 'bojan.kostov@gmail.com');
|
|---|
| 544 |
|
|---|
| 545 | INSERT INTO intake_planner_save_to_list_post (planner_id, post_id)
|
|---|
| 546 | SELECT ip.id, p.id
|
|---|
| 547 | FROM (VALUES
|
|---|
| 548 | ('marija.trajkovska@gmail.com', '2026-01-22 08:30:00', 'Oat Porridge with Banana and Walnuts'),
|
|---|
| 549 | ('marija.trajkovska@gmail.com', '2026-01-22 13:00:00', 'Tavce Gravce'),
|
|---|
| 550 | ('marija.trajkovska@gmail.com', '2026-01-22 19:30:00', 'Shopska Salad'),
|
|---|
| 551 | ('marija.trajkovska@gmail.com', '2026-01-23 08:30:00', 'Protein Pancakes'),
|
|---|
| 552 | ('marija.trajkovska@gmail.com', '2026-01-23 13:15:00', 'Chicken Bulgur Bowl'),
|
|---|
| 553 | ('marija.trajkovska@gmail.com', '2026-01-24 09:00:00', 'Oat Porridge with Banana and Walnuts'),
|
|---|
| 554 | ('marija.trajkovska@gmail.com', '2026-01-24 20:00:00', 'Turli Tava'),
|
|---|
| 555 | ('marija.trajkovska@gmail.com', '2026-01-25 12:30:00', 'Grilled Trout with Parsley'),
|
|---|
| 556 | ('stefan.petrov@gmail.com', '2026-01-22 12:45:00', 'Chicken Bulgur Bowl'),
|
|---|
| 557 | ('stefan.petrov@gmail.com', '2026-01-23 12:45:00', 'Chicken Bulgur Bowl'),
|
|---|
| 558 | ('nikola.stojanov@gmail.com', '2026-01-26 19:45:00', 'Baked Mackerel with Vegetables'),
|
|---|
| 559 | ('teodora.mihajlova@nutritioneer.mk','2026-01-27 09:30:00','Protein Pancakes'),
|
|---|
| 560 | ('ana.jovanovska@yahoo.com', '2026-01-28 13:00:00', 'Tarator'),
|
|---|
| 561 | ('ana.jovanovska@yahoo.com', '2026-01-28 13:00:00', 'Stuffed Peppers with Rice')
|
|---|
| 562 | ) AS v(user_email, dt, recipe_name)
|
|---|
| 563 | JOIN intake_planner ip ON ip.user_email = v.user_email AND ip.date_time = v.dt::timestamp
|
|---|
| 564 | JOIN recipe r ON r.name = v.recipe_name
|
|---|
| 565 | JOIN post p ON p.recipe_id = r.id;
|
|---|
| 566 |
|
|---|
| 567 |
|
|---|
| 568 | INSERT INTO biometrics (date, weight, height, age, muscle_fat_ratio, user_email) VALUES
|
|---|
| 569 | ('2026-01-05', 74.5, 168, 29, 1.80, 'marija.trajkovska@gmail.com'),
|
|---|
| 570 | ('2026-01-12', 73.8, 168, 29, 1.84, 'marija.trajkovska@gmail.com'),
|
|---|
| 571 | ('2026-01-19', 73.1, 168, 29, 1.90, 'marija.trajkovska@gmail.com'),
|
|---|
| 572 | ('2026-01-26', 72.4, 168, 29, 1.95, 'marija.trajkovska@gmail.com'),
|
|---|
| 573 | ('2026-01-06', 88.2, 182, 34, 2.10, 'stefan.petrov@gmail.com'),
|
|---|
| 574 | ('2026-01-20', 87.0, 182, 34, 2.18, 'stefan.petrov@gmail.com'),
|
|---|
| 575 | ('2026-01-27', 86.3, 182, 34, 2.24, 'stefan.petrov@gmail.com'),
|
|---|
| 576 | ('2026-01-10', 61.0, 163, 41, 1.65, 'ana.jovanovska@yahoo.com'),
|
|---|
| 577 | ('2026-01-24', 60.4, 163, 41, 1.70, 'ana.jovanovska@yahoo.com'),
|
|---|
| 578 | ('2026-01-08', 95.7, 190, 27, 2.35, 'nikola.stojanov@gmail.com'),
|
|---|
| 579 | ('2026-01-22', 94.9, 190, 27, 2.40, 'nikola.stojanov@gmail.com'),
|
|---|
| 580 | ('2026-01-15', 68.3, 171, 36, 1.72, 'elena.dimitrova@hotmail.com'),
|
|---|
| 581 | ('2026-01-29', 67.9, 171, 36, 1.75, 'elena.dimitrova@hotmail.com'),
|
|---|
| 582 | ('2026-01-18', 79.0, 176, 31, 1.60, 'bojan.kostov@gmail.com');
|
|---|
| 583 |
|
|---|
| 584 |
|
|---|
| 585 |
|
|---|
| 586 | UPDATE recipe r
|
|---|
| 587 | SET kcal_sum = ROUND(COALESCE((
|
|---|
| 588 | SELECT SUM(i.kcal * rci.ingredient_quantity / 100.0)
|
|---|
| 589 | FROM recipe_contains_ingredient rci
|
|---|
| 590 | JOIN ingredient i ON i.name = rci.ingredient_name
|
|---|
| 591 | WHERE rci.recipe_id = r.id
|
|---|
| 592 | ), 0), 2);
|
|---|
| 593 |
|
|---|
| 594 | UPDATE grocery_list g
|
|---|
| 595 | SET kcal = ROUND(
|
|---|
| 596 | COALESCE((SELECT SUM(r.kcal_sum)
|
|---|
| 597 | FROM grocery_list_bulk_add_ingredient b
|
|---|
| 598 | JOIN recipe r ON r.id = b.recipe_id
|
|---|
| 599 | WHERE b.list_id = g.id), 0)
|
|---|
| 600 | + COALESCE((SELECT SUM(i.kcal * s.buy_quantity / 100.0)
|
|---|
| 601 | FROM grocery_list_single_add_ingredient s
|
|---|
| 602 | JOIN ingredient i ON i.name = s.ingredient_name
|
|---|
| 603 | WHERE s.list_id = g.id), 0)
|
|---|
| 604 | , 2);
|
|---|
| 605 |
|
|---|
| 606 | UPDATE intake_planner ip
|
|---|
| 607 | SET kcal = ROUND((
|
|---|
| 608 | SELECT SUM(r.kcal_sum / r.servings)
|
|---|
| 609 | FROM intake_planner_save_to_list_post sp
|
|---|
| 610 | JOIN post p ON p.id = sp.post_id
|
|---|
| 611 | JOIN recipe r ON r.id = p.recipe_id
|
|---|
| 612 | WHERE sp.planner_id = ip.id
|
|---|
| 613 | ), 2)
|
|---|
| 614 | WHERE EXISTS (SELECT 1
|
|---|
| 615 | FROM intake_planner_save_to_list_post sp
|
|---|
| 616 | JOIN post p ON p.id = sp.post_id
|
|---|
| 617 | WHERE sp.planner_id = ip.id AND p.recipe_id IS NOT NULL);
|
|---|
| 618 |
|
|---|
| 619 | COMMIT;
|
|---|
| 620 |
|
|---|
| 621 |
|
|---|
| 622 | SELECT 'user' AS table_name, count(*) AS rows FROM "user"
|
|---|
| 623 | UNION ALL SELECT 'ingredient', count(*) FROM ingredient
|
|---|
| 624 | UNION ALL SELECT 'nutrient', count(*) FROM nutrient
|
|---|
| 625 | UNION ALL SELECT 'restriction', count(*) FROM restriction
|
|---|
| 626 | UNION ALL SELECT 'recipe', count(*) FROM recipe
|
|---|
| 627 | UNION ALL SELECT 'post', count(*) FROM post
|
|---|
| 628 | UNION ALL SELECT 'comment', count(*) FROM comment
|
|---|
| 629 | UNION ALL SELECT 'grocery_list', count(*) FROM grocery_list
|
|---|
| 630 | UNION ALL SELECT 'intake_planner', count(*) FROM intake_planner
|
|---|
| 631 | UNION ALL SELECT 'biometrics', count(*) FROM biometrics
|
|---|
| 632 | UNION ALL SELECT 'recipe_contains_ingredient', count(*) FROM recipe_contains_ingredient
|
|---|
| 633 | UNION ALL SELECT 'ingredient_contains_nutrient', count(*) FROM ingredient_contains_nutrient
|
|---|
| 634 | UNION ALL SELECT 'recipe_contains_restriction', count(*) FROM recipe_contains_restriction
|
|---|
| 635 | UNION ALL SELECT 'grocery_list_bulk_add_ingredient', count(*) FROM grocery_list_bulk_add_ingredient
|
|---|
| 636 | UNION ALL SELECT 'grocery_list_single_add_ingredient', count(*) FROM grocery_list_single_add_ingredient
|
|---|
| 637 | UNION ALL SELECT 'intake_planner_save_to_list_post', count(*) FROM intake_planner_save_to_list_post
|
|---|
| 638 | ORDER BY 1;
|
|---|
| 639 |
|
|---|