Establish Git-first TasksNest documentation and audit baseline
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
# Migrations
|
||||
|
||||
Django migrations are stored per app under `main/<app>/migrations/`. Current working tree heads include `planner/0025`, `food/0024`, `recipes/0007`, `groceries/0003`, `home_assistant/0004`, `stress/0002`, and `dreams/0001`. Some heads are untracked in Git at this audit; deployment state may differ. `food` contains two migrations numbered `0017` with different names. Check their dependencies and run `showmigrations` and `makemigrations --check` before schema work; do not infer ordering from filenames.
|
||||
|
||||
Several migrations backfill or preserve data, including food package quantities, hydration contributions, API UUIDs and task ownership/completion. Avoid editing applied migrations; add new migrations after validating the current graph.
|
||||
@@ -0,0 +1,16 @@
|
||||
# Data model map
|
||||
|
||||
Models are in each app's `models.py`; migrations, not this page, define the deployed schema. Most personal records reference Django's auth user. UUID API identifiers often coexist with integer database primary keys. Verify exact constraints and `on_delete` rules before writing data migrations.
|
||||
|
||||
| App | Models and purpose |
|
||||
| --- | --- |
|
||||
| `planner` | `Task`, `TaskOccurrence`, `TaskOccurrenceEvent`, `TaskWeatherShift` manage scheduling; `UserSettings`, fasting and water models hold user settings and tracking; workout, pain, tooth, bowel and sleep models record health events. |
|
||||
| `food` | `FoodProduct`, `FoodPortion`, `FoodLogEntry`, `FoodLogAttachment`, `FoodFavourite`; `KitchenInventoryItem`, package/consumption and scanner models; `CanonicalIngredient`, nutrition import/source/review, suggestions and links; `DietaryPreference`, exception and audit; OAuth PAT, idempotency, housekeeping and Open Food Facts records. |
|
||||
| `recipes` | `Recipe`, ingredient, substitution, subrecipe and link models; selection and cook-later records; stock use lines and cooking runs. |
|
||||
| `groceries` | `GroceryItem`, `GrocerySource`, `GroceryRecipeDemand` connect shopping entries to recipe demand and inventory transfer. |
|
||||
| `home_assistant` | `HomeAssistantConnection`, `HomeAssistantSyncRun`, `HomeAssistantItemMap` store connection, sync history and stable mapping. |
|
||||
| `stress`, `dreams` | `StressEntry`, `DreamEntry` store private journal records. |
|
||||
|
||||
Key cross-app relations: recipe ingredients can point to food products; recipe stock-use lines reference inventory consumption; grocery items can point to products and recipe demand; food diary entries snapshot nutrition so later recipe/product edits do not rewrite history. Recipe links are suggestions; subrecipes are composition. See [features](../features/overview.md).
|
||||
|
||||
Validation lives in model `clean()` methods, forms, API helpers and services, not solely database constraints. Examples include positive quantities and serving counts, no self-link and uniqueness for recipe links, ownership checks, dietary revision checks, and idempotency on creation. Use the relevant service/API tests when changing these rules.
|
||||
Reference in New Issue
Block a user