132512
Tables (28)
allergens
- allergen_id — bigserial
- allergen_name — varchar(80) — NOT NULL
- created_at — timestamp — NOT NULL
body_measurements
- measurement_id — bigserial
- user_id — bigint — Foreign key → users.user_id — NOT NULL
- measured_at — timestamp — NOT NULL
- weight_kg — numeric(6, 2) — NOT NULL
- height_cm — numeric(6, 2)
- body_fat_percent — numeric(5, 2)
- skeletal_muscle_kg — numeric(6, 2)
- source — varchar(20) — NOT NULL
- note — text
- created_at — timestamp — NOT NULL
daily_logs
- daily_log_id — bigserial
- user_id — bigint — Foreign key → users.user_id — NOT NULL
- weekly_plan_id — bigint — Foreign key → weekly_plans.weekly_plan_id
- log_date — date — NOT NULL
- calculated_bmr_kcal — numeric(8, 2)
- calculated_tdee_kcal — numeric(8, 2)
- target_calories_kcal — numeric(8, 2)
- total_calories_in_kcal — numeric(10, 2) — NOT NULL
- total_calories_out_kcal — numeric(10, 2) — NOT NULL
- total_spent_krw — int — NOT NULL
- remaining_weekly_budget_krw — int
- created_at — timestamp — NOT NULL
- updated_at — timestamp — NOT NULL
- daily_budget_category — varchar(30)
- age_group — varchar(30)
exercise_logs
- exercise_log_id — bigserial
- daily_log_id — bigint — Foreign key → daily_logs.daily_log_id
- user_id — bigint — Foreign key → users.user_id — NOT NULL
- exercise_id — bigint — Foreign key → exercises.exercise_id
- recommendation_candidate_id — bigint — Foreign key → recommendation_candidates.recommendation_candidate_id
- duration_minutes — numeric(8, 2) — NOT NULL
- calories_burned_kcal — numeric(10, 2)
- performed_at — timestamp — NOT NULL
exercises
- exercise_id — bigserial
- exercise_name — varchar(80) — NOT NULL
- met_value — double
- created_at — timestamp — NOT NULL
food_allergens
- food_id — bigint — Foreign key → foods.food_id — NOT NULL
- allergen_id — bigint — Foreign key → allergens.allergen_id — NOT NULL
food_logs
- food_log_id — bigserial
- daily_log_id — bigint — Foreign key → daily_logs.daily_log_id
- user_id — bigint — Foreign key → users.user_id — NOT NULL
- food_id — bigint — Foreign key → foods.food_id — NOT NULL
- recommendation_candidate_id — bigint — Foreign key → recommendation_candidates.recommendation_candidate_id
- weekly_plan_meal_id — bigint — Foreign key → weekly_plan_meals.weekly_plan_meal_id
- meal_type — varchar(20) — NOT NULL
- quantity_g — numeric(8, 2)
- quantity_label — varchar(30)
- spent_money_krw — int — NOT NULL
- consumed_at — timestamp — NOT NULL
- source_type — varchar(20) — NOT NULL
- deleted_at — timestamp
- created_at — timestamp — NOT NULL
- updated_at — timestamp — NOT NULL
food_tag_map
- food_id — bigint — Foreign key → foods.food_id — NOT NULL
- tag_id — bigint — Foreign key → tags.tag_id — NOT NULL
foods
- food_id — bigserial
- food_name — varchar(100) — NOT NULL
- food_unit_type — varchar(30) — NOT NULL
- meal_channel — varchar(30) — NOT NULL
- category — varchar(30)
- default_quantity_g — numeric(8, 2)
- serving_size_g — numeric(8, 2) — NOT NULL
- serving_unit_label — varchar(30)
- price_krw — int — NOT NULL
- calories_kcal — numeric(10, 2) — NOT NULL
- protein_g — numeric(10, 2) — NOT NULL
- fat_g — numeric(10, 2) — NOT NULL
- carbs_g — numeric(10, 2) — NOT NULL
- protein_per_price — double
- is_variable_amount — boolean — NOT NULL
- source_label — varchar(100)
- is_active — boolean — NOT NULL
- created_at — timestamp — NOT NULL
- updated_at — timestamp — NOT NULL
- budget_level — varchar(30)
- is_high_protein — int
- is_low_fat — int
meal_candidate_items
- meal_candidate_item_id — bigserial
- candidate_id — bigint — Foreign key → meal_candidates.candidate_id — NOT NULL
- food_id — bigint — Foreign key → foods.food_id — NOT NULL
- quantity_g — numeric(8, 2)
- quantity_label — varchar(30)
- quantity_bucket — varchar(30) — NOT NULL
- item_order — smallint — NOT NULL
- item_price_krw — int — NOT NULL
- item_calories_kcal — numeric(10, 2) — NOT NULL
- item_protein_g — numeric(10, 2) — NOT NULL
- item_fat_g — numeric(10, 2) — NOT NULL
- item_carbs_g — numeric(10, 2) — NOT NULL
meal_candidates
- candidate_id — bigserial
- candidate_name — varchar(160)
- candidate_fingerprint — varchar(255) — NOT NULL
- fingerprint_version — varchar(20) — NOT NULL
- meal_type — varchar(20) — NOT NULL
- meal_channel — varchar(30) — NOT NULL
- total_price_krw — int — NOT NULL
- total_calories_kcal — numeric(10, 2) — NOT NULL
- total_protein_g — numeric(10, 2) — NOT NULL
- total_fat_g — numeric(10, 2) — NOT NULL
- total_carbs_g — numeric(10, 2) — NOT NULL
- generation_source — varchar(30) — NOT NULL
- is_active — boolean — NOT NULL
- created_at — timestamp — NOT NULL
- updated_at — timestamp — NOT NULL
model_versions
- model_version_id — bigserial
- training_job_id — bigint — Foreign key → training_jobs.training_job_id
- model_type — varchar(30) — NOT NULL
- version_name — varchar(100) — NOT NULL
- artifact_uri — text
- code_version — varchar(80)
- promotion_status — varchar(20) — NOT NULL
- auc — double
- precision_at_k — double
- map_at_k — double
- coverage — double
- diversity — double
- validation_loss — double
- promoted_at — timestamp
- rejected_reason — text
- created_at — timestamp — NOT NULL
plan_revision_meals
- plan_revision_meal_id — bigserial
- plan_revision_id — bigint — Foreign key → plan_revisions.plan_revision_id — NOT NULL
- weekly_plan_meal_id — bigint — Foreign key → weekly_plan_meals.weekly_plan_meal_id
- day_index — smallint — NOT NULL
- meal_type — varchar(20) — NOT NULL
- action — varchar(20) — NOT NULL
- candidate_id — bigint — Foreign key → meal_candidates.candidate_id
- revised_price_krw — int
- revised_calories_kcal — numeric(10, 2)
- revised_protein_g — numeric(10, 2)
- created_at — timestamp — NOT NULL
plan_revisions
- plan_revision_id — bigserial
- weekly_plan_id — bigint — Foreign key → weekly_plans.weekly_plan_id — NOT NULL
- shock_event_id — bigint — Foreign key → shock_events.shock_event_id — NOT NULL
- revision_status — varchar(20) — NOT NULL
- blocked_constraint — varchar(20)
- generated_at — timestamp — NOT NULL
- accepted_at — timestamp
recommendation_candidates
- recommendation_candidate_id — bigserial
- run_id — bigint — Foreign key → recommendation_runs.run_id — NOT NULL
- candidate_id — bigint — Foreign key → meal_candidates.candidate_id — NOT NULL
- milp_feasible — boolean — NOT NULL
- milp_rank — int
- rule_score — double
- lightfm_score — double
- xgboost_probability — double
- mmr_penalty — double — NOT NULL
- repeat_food_penalty — double — NOT NULL
- repeat_combo_penalty — double — NOT NULL
- final_score — double
- final_rank — int
- feature_snapshot — jsonb
- score_breakdown — jsonb
- was_selected — boolean — NOT NULL
- selected_at — timestamp
- created_at — timestamp — NOT NULL
recommendation_runs
- run_id — bigserial
- user_id — bigint — Foreign key → users.user_id — NOT NULL
- daily_log_id — bigint — Foreign key → daily_logs.daily_log_id
- weekly_plan_id — bigint — Foreign key → weekly_plans.weekly_plan_id
- requested_at — timestamp — NOT NULL
- context_meal_type — varchar(20) — NOT NULL
- context_time_of_day — varchar(20)
- context_remaining_budget_krw — int
- context_remaining_calories_kcal — numeric(8, 2)
- context_week_start — date
- context_week_end — date
- context_lookback_days — int — NOT NULL
- strategy_type — varchar(20) — NOT NULL
- user_interaction_count — int — NOT NULL
- profile_snapshot — jsonb — NOT NULL
- milp_model_version_id — bigint — Foreign key → model_versions.model_version_id
- lightfm_model_version_id — bigint — Foreign key → model_versions.model_version_id
- xgboost_model_version_id — bigint — Foreign key → model_versions.model_version_id
- mmr_model_version_id — bigint — Foreign key → model_versions.model_version_id
- created_at — timestamp — NOT NULL
recovery_outcomes
- recovery_outcome_id — bigserial
- weekly_plan_id — bigint — Foreign key → weekly_plans.weekly_plan_id — NOT NULL
- shock_event_id — bigint — Foreign key → shock_events.shock_event_id — NOT NULL
- plan_revision_id — bigint — Foreign key → plan_revisions.plan_revision_id — NOT NULL
- was_feasible — boolean — NOT NULL
- was_accepted — boolean — NOT NULL
- counted_as_success — boolean — NOT NULL
- created_at — timestamp — NOT NULL
shock_events
- shock_event_id — bigserial
- user_id — bigint — Foreign key → users.user_id — NOT NULL
- weekly_plan_id — bigint — Foreign key → weekly_plans.weekly_plan_id — NOT NULL
- event_type — varchar(30) — NOT NULL
- expected_spend_krw — int — NOT NULL
- event_day_index — smallint — NOT NULL
- note — text
- created_at — timestamp — NOT NULL
tags
- tag_id — bigserial
- tag_name — varchar(80) — NOT NULL
- tag_type — varchar(30) — NOT NULL
- created_at — timestamp — NOT NULL
training_examples
- training_example_id — bigserial
- training_job_id — bigint — Foreign key → training_jobs.training_job_id — NOT NULL
- user_id — bigint — Foreign key → users.user_id — NOT NULL
- candidate_id — bigint — Foreign key → meal_candidates.candidate_id
- recommendation_candidate_id — bigint — Foreign key → recommendation_candidates.recommendation_candidate_id
- model_type — varchar(30) — NOT NULL
- feature_snapshot — jsonb — NOT NULL
- label_value — double
- sample_weight — double — NOT NULL
- created_at — timestamp — NOT NULL
training_jobs
- training_job_id — bigserial
- job_type — varchar(30) — NOT NULL
- status — varchar(20) — NOT NULL
- started_at — timestamp — NOT NULL
- finished_at — timestamp
- dataset_start_date — date
- dataset_end_date — date
- training_config — jsonb
- error_message — text
user_allergens
- user_id — bigint — Foreign key → users.user_id — NOT NULL
- allergen_id — bigint — Foreign key → allergens.allergen_id — NOT NULL
- severity — varchar(20) — NOT NULL
- note — text
- created_at — timestamp — NOT NULL
user_item_interactions
- interaction_id — bigserial
- user_id — bigint — Foreign key → users.user_id — NOT NULL
- food_id — bigint — Foreign key → foods.food_id
- candidate_id — bigint — Foreign key → meal_candidates.candidate_id
- recommendation_candidate_id — bigint — Foreign key → recommendation_candidates.recommendation_candidate_id
- run_id — bigint — Foreign key → recommendation_runs.run_id
- interaction_type — varchar(20) — NOT NULL
- interaction_weight — double — NOT NULL
- metadata — jsonb
- created_at — timestamp — NOT NULL
user_preferences
- preference_id — bigserial
- user_id — bigint — Foreign key → users.user_id — NOT NULL
- preference_type — varchar(20) — NOT NULL
- target_type — varchar(20) — NOT NULL
- food_id — bigint — Foreign key → foods.food_id
- tag_id — bigint — Foreign key → tags.tag_id
- target_value — text
- strength — smallint — NOT NULL
- created_at — timestamp — NOT NULL
user_profiles
- profile_id — bigserial
- user_id — bigint — Foreign key → users.user_id — NOT NULL
- goal_type — varchar(20) — NOT NULL
- sex — varchar(20)
- birth_date — date
- age_years_snapshot — int
- height_cm — numeric(6, 2)
- target_weight_kg — numeric(6, 2)
- activity_level — varchar(20)
- activity_factor — double
- energy_target_source — varchar(20) — NOT NULL
- bmr_kcal — numeric(8, 2)
- tdee_kcal — numeric(8, 2)
- target_calories_kcal — numeric(8, 2) — NOT NULL
- target_calorie_delta_kcal — int
- weekly_budget_krw — int — NOT NULL
- available_meal_channels — varchar(30) — NOT NULL
- created_at — timestamp — NOT NULL
- updated_at — timestamp — NOT NULL
users
- user_id — bigserial
- email — varchar(255)
- display_name — varchar(50)
- created_at — timestamp — NOT NULL
- updated_at — timestamp — NOT NULL
weekly_plan_meals
- weekly_plan_meal_id — bigserial
- weekly_plan_id — bigint — Foreign key → weekly_plans.weekly_plan_id — NOT NULL
- day_index — smallint — NOT NULL
- meal_type — varchar(20) — NOT NULL
- candidate_id — bigint — Foreign key → meal_candidates.candidate_id — NOT NULL
- planned_price_krw — int — NOT NULL
- planned_calories_kcal — numeric(10, 2) — NOT NULL
- planned_protein_g — numeric(10, 2) — NOT NULL
- created_at — timestamp — NOT NULL
weekly_plans
- weekly_plan_id — bigserial
- user_id — bigint — Foreign key → users.user_id — NOT NULL
- profile_id — bigint — Foreign key → user_profiles.profile_id
- plan_window_start — date — NOT NULL
- plan_window_end — date — NOT NULL
- weekly_budget_krw — int — NOT NULL
- goal_type — varchar(20) — NOT NULL
- target_calories_kcal — numeric(8, 2) — NOT NULL
- status — varchar(20) — NOT NULL
- generated_at — timestamp — NOT NULL