Coverage for opt/mealie/lib/python3.12/site-packages/mealie/alembic/versions/2023-02-07-20.57.21_ff5f73b01a7a_add_missing_foreign_key_and_order_.py: 52%
201 statements
« prev ^ index » next coverage.py v7.10.6, created at 2025-12-05 15:32 +0000
« prev ^ index » next coverage.py v7.10.6, created at 2025-12-05 15:32 +0000
1"""add missing foreign key and order indices
3Revision ID: ff5f73b01a7a
4Revises: 165d943c64ee
5Create Date: 2023-02-07 20:57:21.066927
7"""
9from alembic import op 1a
11# revision identifiers, used by Alembic.
12revision = "ff5f73b01a7a" 1a
13down_revision = "165d943c64ee" 1a
14branch_labels: str | tuple[str, ...] | None = None 1a
15depends_on: str | tuple[str, ...] | None = None 1a
18def upgrade(): 1a
19 # ### commands auto generated by Alembic - please adjust! ###
20 op.create_index(op.f("ix_api_extras_created_at"), "api_extras", ["created_at"], unique=False) 1a
21 op.create_index(op.f("ix_api_extras_recipee_id"), "api_extras", ["recipee_id"], unique=False) 1a
22 op.create_index(op.f("ix_categories_created_at"), "categories", ["created_at"], unique=False) 1a
23 op.create_index(op.f("ix_cookbooks_created_at"), "cookbooks", ["created_at"], unique=False) 1a
24 op.create_index(op.f("ix_cookbooks_group_id"), "cookbooks", ["group_id"], unique=False) 1a
25 op.create_index(op.f("ix_cookbooks_slug"), "cookbooks", ["slug"], unique=False) 1a
26 op.create_index( 1a
27 op.f("ix_cookbooks_to_categories_category_id"), "cookbooks_to_categories", ["category_id"], unique=False
28 )
29 op.create_index( 1a
30 op.f("ix_cookbooks_to_categories_cookbook_id"), "cookbooks_to_categories", ["cookbook_id"], unique=False
31 )
32 op.create_index(op.f("ix_cookbooks_to_tags_cookbook_id"), "cookbooks_to_tags", ["cookbook_id"], unique=False) 1a
33 op.create_index(op.f("ix_cookbooks_to_tags_tag_id"), "cookbooks_to_tags", ["tag_id"], unique=False) 1a
34 op.create_index(op.f("ix_cookbooks_to_tools_cookbook_id"), "cookbooks_to_tools", ["cookbook_id"], unique=False) 1a
35 op.create_index(op.f("ix_cookbooks_to_tools_tool_id"), "cookbooks_to_tools", ["tool_id"], unique=False) 1a
36 op.create_index(op.f("ix_group_data_exports_created_at"), "group_data_exports", ["created_at"], unique=False) 1a
37 op.create_index( 1a
38 op.f("ix_group_events_notifier_options_created_at"),
39 "group_events_notifier_options",
40 ["created_at"],
41 unique=False,
42 )
43 op.create_index( 1a
44 op.f("ix_group_events_notifiers_created_at"), "group_events_notifiers", ["created_at"], unique=False
45 )
46 op.create_index(op.f("ix_group_meal_plan_rules_created_at"), "group_meal_plan_rules", ["created_at"], unique=False) 1a
47 op.create_index(op.f("ix_group_meal_plan_rules_group_id"), "group_meal_plan_rules", ["group_id"], unique=False) 1a
48 op.create_index(op.f("ix_group_meal_plans_created_at"), "group_meal_plans", ["created_at"], unique=False) 1a
49 op.create_index(op.f("ix_group_preferences_created_at"), "group_preferences", ["created_at"], unique=False) 1a
50 op.create_index(op.f("ix_group_reports_created_at"), "group_reports", ["created_at"], unique=False) 1a
51 op.create_index(op.f("ix_group_to_categories_category_id"), "group_to_categories", ["category_id"], unique=False) 1a
52 op.create_index(op.f("ix_group_to_categories_group_id"), "group_to_categories", ["group_id"], unique=False) 1a
53 op.create_index(op.f("ix_groups_created_at"), "groups", ["created_at"], unique=False) 1a
54 op.create_index( 1a
55 op.f("ix_ingredient_food_extras_created_at"), "ingredient_food_extras", ["created_at"], unique=False
56 )
57 op.create_index( 1a
58 op.f("ix_ingredient_food_extras_ingredient_food_id"),
59 "ingredient_food_extras",
60 ["ingredient_food_id"],
61 unique=False,
62 )
63 op.create_index(op.f("ix_ingredient_foods_created_at"), "ingredient_foods", ["created_at"], unique=False) 1a
64 op.create_index(op.f("ix_ingredient_foods_group_id"), "ingredient_foods", ["group_id"], unique=False) 1a
65 op.create_index(op.f("ix_ingredient_foods_label_id"), "ingredient_foods", ["label_id"], unique=False) 1a
66 op.create_index(op.f("ix_ingredient_units_created_at"), "ingredient_units", ["created_at"], unique=False) 1a
67 op.create_index(op.f("ix_ingredient_units_group_id"), "ingredient_units", ["group_id"], unique=False) 1a
68 op.create_index(op.f("ix_invite_tokens_created_at"), "invite_tokens", ["created_at"], unique=False) 1a
69 op.create_index(op.f("ix_invite_tokens_group_id"), "invite_tokens", ["group_id"], unique=False) 1a
70 op.create_index(op.f("ix_long_live_tokens_created_at"), "long_live_tokens", ["created_at"], unique=False) 1a
71 op.create_index(op.f("ix_long_live_tokens_token"), "long_live_tokens", ["token"], unique=False) 1a
72 op.create_index(op.f("ix_long_live_tokens_user_id"), "long_live_tokens", ["user_id"], unique=False) 1a
73 op.create_index(op.f("ix_multi_purpose_labels_created_at"), "multi_purpose_labels", ["created_at"], unique=False) 1a
74 op.create_index(op.f("ix_notes_created_at"), "notes", ["created_at"], unique=False) 1a
75 op.create_index(op.f("ix_notes_recipe_id"), "notes", ["recipe_id"], unique=False) 1a
76 op.create_index(op.f("ix_password_reset_tokens_created_at"), "password_reset_tokens", ["created_at"], unique=False) 1a
77 op.create_index(op.f("ix_password_reset_tokens_user_id"), "password_reset_tokens", ["user_id"], unique=False) 1a
78 op.create_index( 1a
79 op.f("ix_plan_rules_to_categories_category_id"), "plan_rules_to_categories", ["category_id"], unique=False
80 )
81 op.create_index( 1a
82 op.f("ix_plan_rules_to_categories_group_plan_rule_id"),
83 "plan_rules_to_categories",
84 ["group_plan_rule_id"],
85 unique=False,
86 )
87 op.create_index(op.f("ix_plan_rules_to_tags_plan_rule_id"), "plan_rules_to_tags", ["plan_rule_id"], unique=False) 1a
88 op.create_index(op.f("ix_plan_rules_to_tags_tag_id"), "plan_rules_to_tags", ["tag_id"], unique=False) 1a
89 op.create_index(op.f("ix_recipe_assets_created_at"), "recipe_assets", ["created_at"], unique=False) 1a
90 op.create_index(op.f("ix_recipe_assets_recipe_id"), "recipe_assets", ["recipe_id"], unique=False) 1a
91 op.create_index(op.f("ix_recipe_comments_created_at"), "recipe_comments", ["created_at"], unique=False) 1a
92 op.create_index(op.f("ix_recipe_comments_recipe_id"), "recipe_comments", ["recipe_id"], unique=False) 1a
93 op.create_index(op.f("ix_recipe_comments_user_id"), "recipe_comments", ["user_id"], unique=False) 1a
94 op.create_index( 1a
95 op.f("ix_recipe_ingredient_ref_link_created_at"), "recipe_ingredient_ref_link", ["created_at"], unique=False
96 )
97 op.create_index( 1a
98 op.f("ix_recipe_ingredient_ref_link_instruction_id"),
99 "recipe_ingredient_ref_link",
100 ["instruction_id"],
101 unique=False,
102 )
103 op.create_index( 1a
104 op.f("ix_recipe_ingredient_ref_link_reference_id"), "recipe_ingredient_ref_link", ["reference_id"], unique=False
105 )
106 op.create_index(op.f("ix_recipe_instructions_created_at"), "recipe_instructions", ["created_at"], unique=False) 1a
107 op.create_index(op.f("ix_recipe_instructions_position"), "recipe_instructions", ["position"], unique=False) 1a
108 op.create_index(op.f("ix_recipe_instructions_recipe_id"), "recipe_instructions", ["recipe_id"], unique=False) 1a
109 op.create_index(op.f("ix_recipe_nutrition_created_at"), "recipe_nutrition", ["created_at"], unique=False) 1a
110 op.create_index(op.f("ix_recipe_nutrition_recipe_id"), "recipe_nutrition", ["recipe_id"], unique=False) 1a
111 op.create_index(op.f("ix_recipe_settings_created_at"), "recipe_settings", ["created_at"], unique=False) 1a
112 op.create_index(op.f("ix_recipe_settings_recipe_id"), "recipe_settings", ["recipe_id"], unique=False) 1a
113 op.create_index(op.f("ix_recipe_share_tokens_created_at"), "recipe_share_tokens", ["created_at"], unique=False) 1a
114 op.create_index(op.f("ix_recipe_share_tokens_recipe_id"), "recipe_share_tokens", ["recipe_id"], unique=False) 1a
115 op.create_index( 1a
116 op.f("ix_recipe_timeline_events_created_at"), "recipe_timeline_events", ["created_at"], unique=False
117 )
118 op.create_index(op.f("ix_recipe_timeline_events_recipe_id"), "recipe_timeline_events", ["recipe_id"], unique=False) 1a
119 op.create_index(op.f("ix_recipe_timeline_events_timestamp"), "recipe_timeline_events", ["timestamp"], unique=False) 1a
120 op.create_index(op.f("ix_recipe_timeline_events_user_id"), "recipe_timeline_events", ["user_id"], unique=False) 1a
121 op.create_index(op.f("ix_recipes_created_at"), "recipes", ["created_at"], unique=False) 1a
122 op.create_index(op.f("ix_recipes_name"), "recipes", ["name"], unique=False) 1a
123 op.create_index(op.f("ix_recipes_ingredients_created_at"), "recipes_ingredients", ["created_at"], unique=False) 1a
124 op.create_index(op.f("ix_recipes_ingredients_food_id"), "recipes_ingredients", ["food_id"], unique=False) 1a
125 op.create_index(op.f("ix_recipes_ingredients_position"), "recipes_ingredients", ["position"], unique=False) 1a
126 op.create_index(op.f("ix_recipes_ingredients_unit_id"), "recipes_ingredients", ["unit_id"], unique=False) 1a
127 op.create_index( 1a
128 op.f("ix_recipes_to_categories_category_id"), "recipes_to_categories", ["category_id"], unique=False
129 )
130 op.create_index(op.f("ix_recipes_to_categories_recipe_id"), "recipes_to_categories", ["recipe_id"], unique=False) 1a
131 op.create_index(op.f("ix_recipes_to_tags_recipe_id"), "recipes_to_tags", ["recipe_id"], unique=False) 1a
132 op.create_index(op.f("ix_recipes_to_tags_tag_id"), "recipes_to_tags", ["tag_id"], unique=False) 1a
133 op.create_index(op.f("ix_recipes_to_tools_recipe_id"), "recipes_to_tools", ["recipe_id"], unique=False) 1a
134 op.create_index(op.f("ix_recipes_to_tools_tool_id"), "recipes_to_tools", ["tool_id"], unique=False) 1a
135 op.create_index(op.f("ix_report_entries_created_at"), "report_entries", ["created_at"], unique=False) 1a
136 op.create_index(op.f("ix_report_entries_report_id"), "report_entries", ["report_id"], unique=False) 1a
137 op.create_index(op.f("ix_server_tasks_created_at"), "server_tasks", ["created_at"], unique=False) 1a
138 op.create_index(op.f("ix_shopping_list_extras_created_at"), "shopping_list_extras", ["created_at"], unique=False) 1a
139 op.create_index( 1a
140 op.f("ix_shopping_list_extras_shopping_list_id"), "shopping_list_extras", ["shopping_list_id"], unique=False
141 )
142 op.create_index( 1a
143 op.f("ix_shopping_list_item_extras_created_at"), "shopping_list_item_extras", ["created_at"], unique=False
144 )
145 op.create_index( 1a
146 op.f("ix_shopping_list_item_extras_shopping_list_item_id"),
147 "shopping_list_item_extras",
148 ["shopping_list_item_id"],
149 unique=False,
150 )
151 op.create_index( 1a
152 op.f("ix_shopping_list_item_recipe_reference_created_at"),
153 "shopping_list_item_recipe_reference",
154 ["created_at"],
155 unique=False,
156 )
157 op.create_index(op.f("ix_shopping_list_items_created_at"), "shopping_list_items", ["created_at"], unique=False) 1a
158 op.create_index(op.f("ix_shopping_list_items_position"), "shopping_list_items", ["position"], unique=False) 1a
159 op.create_index( 1a
160 op.f("ix_shopping_list_items_shopping_list_id"), "shopping_list_items", ["shopping_list_id"], unique=False
161 )
162 op.create_index( 1a
163 op.f("ix_shopping_list_recipe_reference_created_at"),
164 "shopping_list_recipe_reference",
165 ["created_at"],
166 unique=False,
167 )
168 op.create_index(op.f("ix_shopping_lists_created_at"), "shopping_lists", ["created_at"], unique=False) 1a
169 op.create_index(op.f("ix_tags_created_at"), "tags", ["created_at"], unique=False) 1a
170 op.create_index(op.f("ix_tools_created_at"), "tools", ["created_at"], unique=False) 1a
171 op.create_index(op.f("ix_tools_group_id"), "tools", ["group_id"], unique=False) 1a
172 op.create_index(op.f("ix_users_created_at"), "users", ["created_at"], unique=False) 1a
173 op.create_index(op.f("ix_users_to_favorites_recipe_id"), "users_to_favorites", ["recipe_id"], unique=False) 1a
174 op.create_index(op.f("ix_users_to_favorites_user_id"), "users_to_favorites", ["user_id"], unique=False) 1a
175 op.create_index(op.f("ix_webhook_urls_created_at"), "webhook_urls", ["created_at"], unique=False) 1a
176 # ### end Alembic commands ###
179def downgrade(): 1a
180 # ### commands auto generated by Alembic - please adjust! ###
181 op.drop_index(op.f("ix_webhook_urls_created_at"), table_name="webhook_urls")
182 op.drop_index(op.f("ix_users_to_favorites_user_id"), table_name="users_to_favorites")
183 op.drop_index(op.f("ix_users_to_favorites_recipe_id"), table_name="users_to_favorites")
184 op.drop_index(op.f("ix_users_created_at"), table_name="users")
185 op.drop_index(op.f("ix_tools_group_id"), table_name="tools")
186 op.drop_index(op.f("ix_tools_created_at"), table_name="tools")
187 op.drop_index(op.f("ix_tags_created_at"), table_name="tags")
188 op.drop_index(op.f("ix_shopping_lists_created_at"), table_name="shopping_lists")
189 op.drop_index(op.f("ix_shopping_list_recipe_reference_created_at"), table_name="shopping_list_recipe_reference")
190 op.drop_index(op.f("ix_shopping_list_items_shopping_list_id"), table_name="shopping_list_items")
191 op.drop_index(op.f("ix_shopping_list_items_position"), table_name="shopping_list_items")
192 op.drop_index(op.f("ix_shopping_list_items_created_at"), table_name="shopping_list_items")
193 op.drop_index(
194 op.f("ix_shopping_list_item_recipe_reference_created_at"), table_name="shopping_list_item_recipe_reference"
195 )
196 op.drop_index(op.f("ix_shopping_list_item_extras_shopping_list_item_id"), table_name="shopping_list_item_extras")
197 op.drop_index(op.f("ix_shopping_list_item_extras_created_at"), table_name="shopping_list_item_extras")
198 op.drop_index(op.f("ix_shopping_list_extras_shopping_list_id"), table_name="shopping_list_extras")
199 op.drop_index(op.f("ix_shopping_list_extras_created_at"), table_name="shopping_list_extras")
200 op.drop_index(op.f("ix_server_tasks_created_at"), table_name="server_tasks")
201 op.drop_index(op.f("ix_report_entries_report_id"), table_name="report_entries")
202 op.drop_index(op.f("ix_report_entries_created_at"), table_name="report_entries")
203 op.drop_index(op.f("ix_recipes_to_tools_tool_id"), table_name="recipes_to_tools")
204 op.drop_index(op.f("ix_recipes_to_tools_recipe_id"), table_name="recipes_to_tools")
205 op.drop_index(op.f("ix_recipes_to_tags_tag_id"), table_name="recipes_to_tags")
206 op.drop_index(op.f("ix_recipes_to_tags_recipe_id"), table_name="recipes_to_tags")
207 op.drop_index(op.f("ix_recipes_to_categories_recipe_id"), table_name="recipes_to_categories")
208 op.drop_index(op.f("ix_recipes_to_categories_category_id"), table_name="recipes_to_categories")
209 op.drop_index(op.f("ix_recipes_ingredients_unit_id"), table_name="recipes_ingredients")
210 op.drop_index(op.f("ix_recipes_ingredients_position"), table_name="recipes_ingredients")
211 op.drop_index(op.f("ix_recipes_ingredients_food_id"), table_name="recipes_ingredients")
212 op.drop_index(op.f("ix_recipes_ingredients_created_at"), table_name="recipes_ingredients")
213 op.drop_index(op.f("ix_recipes_name"), table_name="recipes")
214 op.drop_index(op.f("ix_recipes_created_at"), table_name="recipes")
215 op.drop_index(op.f("ix_recipe_timeline_events_user_id"), table_name="recipe_timeline_events")
216 op.drop_index(op.f("ix_recipe_timeline_events_timestamp"), table_name="recipe_timeline_events")
217 op.drop_index(op.f("ix_recipe_timeline_events_recipe_id"), table_name="recipe_timeline_events")
218 op.drop_index(op.f("ix_recipe_timeline_events_created_at"), table_name="recipe_timeline_events")
219 op.drop_index(op.f("ix_recipe_share_tokens_recipe_id"), table_name="recipe_share_tokens")
220 op.drop_index(op.f("ix_recipe_share_tokens_created_at"), table_name="recipe_share_tokens")
221 op.drop_index(op.f("ix_recipe_settings_recipe_id"), table_name="recipe_settings")
222 op.drop_index(op.f("ix_recipe_settings_created_at"), table_name="recipe_settings")
223 op.drop_index(op.f("ix_recipe_nutrition_recipe_id"), table_name="recipe_nutrition")
224 op.drop_index(op.f("ix_recipe_nutrition_created_at"), table_name="recipe_nutrition")
225 op.drop_index(op.f("ix_recipe_instructions_recipe_id"), table_name="recipe_instructions")
226 op.drop_index(op.f("ix_recipe_instructions_position"), table_name="recipe_instructions")
227 op.drop_index(op.f("ix_recipe_instructions_created_at"), table_name="recipe_instructions")
228 op.drop_index(op.f("ix_recipe_ingredient_ref_link_reference_id"), table_name="recipe_ingredient_ref_link")
229 op.drop_index(op.f("ix_recipe_ingredient_ref_link_instruction_id"), table_name="recipe_ingredient_ref_link")
230 op.drop_index(op.f("ix_recipe_ingredient_ref_link_created_at"), table_name="recipe_ingredient_ref_link")
231 op.drop_index(op.f("ix_recipe_comments_user_id"), table_name="recipe_comments")
232 op.drop_index(op.f("ix_recipe_comments_recipe_id"), table_name="recipe_comments")
233 op.drop_index(op.f("ix_recipe_comments_created_at"), table_name="recipe_comments")
234 op.drop_index(op.f("ix_recipe_assets_recipe_id"), table_name="recipe_assets")
235 op.drop_index(op.f("ix_recipe_assets_created_at"), table_name="recipe_assets")
236 op.drop_index(op.f("ix_plan_rules_to_tags_tag_id"), table_name="plan_rules_to_tags")
237 op.drop_index(op.f("ix_plan_rules_to_tags_plan_rule_id"), table_name="plan_rules_to_tags")
238 op.drop_index(op.f("ix_plan_rules_to_categories_group_plan_rule_id"), table_name="plan_rules_to_categories")
239 op.drop_index(op.f("ix_plan_rules_to_categories_category_id"), table_name="plan_rules_to_categories")
240 op.drop_index(op.f("ix_password_reset_tokens_user_id"), table_name="password_reset_tokens")
241 op.drop_index(op.f("ix_password_reset_tokens_created_at"), table_name="password_reset_tokens")
242 op.drop_index(op.f("ix_notes_recipe_id"), table_name="notes")
243 op.drop_index(op.f("ix_notes_created_at"), table_name="notes")
244 op.drop_index(op.f("ix_multi_purpose_labels_created_at"), table_name="multi_purpose_labels")
245 op.drop_index(op.f("ix_long_live_tokens_user_id"), table_name="long_live_tokens")
246 op.drop_index(op.f("ix_long_live_tokens_token"), table_name="long_live_tokens")
247 op.drop_index(op.f("ix_long_live_tokens_created_at"), table_name="long_live_tokens")
248 op.drop_index(op.f("ix_invite_tokens_group_id"), table_name="invite_tokens")
249 op.drop_index(op.f("ix_invite_tokens_created_at"), table_name="invite_tokens")
250 op.drop_index(op.f("ix_ingredient_units_group_id"), table_name="ingredient_units")
251 op.drop_index(op.f("ix_ingredient_units_created_at"), table_name="ingredient_units")
252 op.drop_index(op.f("ix_ingredient_foods_label_id"), table_name="ingredient_foods")
253 op.drop_index(op.f("ix_ingredient_foods_group_id"), table_name="ingredient_foods")
254 op.drop_index(op.f("ix_ingredient_foods_created_at"), table_name="ingredient_foods")
255 op.drop_index(op.f("ix_ingredient_food_extras_ingredient_food_id"), table_name="ingredient_food_extras")
256 op.drop_index(op.f("ix_ingredient_food_extras_created_at"), table_name="ingredient_food_extras")
257 op.drop_index(op.f("ix_groups_created_at"), table_name="groups")
258 op.drop_index(op.f("ix_group_to_categories_group_id"), table_name="group_to_categories")
259 op.drop_index(op.f("ix_group_to_categories_category_id"), table_name="group_to_categories")
260 op.drop_index(op.f("ix_group_reports_created_at"), table_name="group_reports")
261 op.drop_index(op.f("ix_group_preferences_created_at"), table_name="group_preferences")
262 op.drop_index(op.f("ix_group_meal_plans_created_at"), table_name="group_meal_plans")
263 op.drop_index(op.f("ix_group_meal_plan_rules_group_id"), table_name="group_meal_plan_rules")
264 op.drop_index(op.f("ix_group_meal_plan_rules_created_at"), table_name="group_meal_plan_rules")
265 op.drop_index(op.f("ix_group_events_notifiers_created_at"), table_name="group_events_notifiers")
266 op.drop_index(op.f("ix_group_events_notifier_options_created_at"), table_name="group_events_notifier_options")
267 op.drop_index(op.f("ix_group_data_exports_created_at"), table_name="group_data_exports")
268 op.drop_index(op.f("ix_cookbooks_to_tools_tool_id"), table_name="cookbooks_to_tools")
269 op.drop_index(op.f("ix_cookbooks_to_tools_cookbook_id"), table_name="cookbooks_to_tools")
270 op.drop_index(op.f("ix_cookbooks_to_tags_tag_id"), table_name="cookbooks_to_tags")
271 op.drop_index(op.f("ix_cookbooks_to_tags_cookbook_id"), table_name="cookbooks_to_tags")
272 op.drop_index(op.f("ix_cookbooks_to_categories_cookbook_id"), table_name="cookbooks_to_categories")
273 op.drop_index(op.f("ix_cookbooks_to_categories_category_id"), table_name="cookbooks_to_categories")
274 op.drop_index(op.f("ix_cookbooks_slug"), table_name="cookbooks")
275 op.drop_index(op.f("ix_cookbooks_group_id"), table_name="cookbooks")
276 op.drop_index(op.f("ix_cookbooks_created_at"), table_name="cookbooks")
277 op.drop_index(op.f("ix_categories_created_at"), table_name="categories")
278 op.drop_index(op.f("ix_api_extras_recipee_id"), table_name="api_extras")
279 op.drop_index(op.f("ix_api_extras_created_at"), table_name="api_extras")
280 # ### end Alembic commands ###