ForkFit Docs
ServerDatabase

Profiles & Biometrics

Database tables tracking user profile metadata, biometrics logs, workouts, goals, and medical safety.

Profiles & Biometrics

This module holds relational schemas related to user properties (names, DOB), UI preferences, biometric tracking values, workouts, goals, and allergies.

Migrated by: 00002_create_profiles_and_biometrics.sql


1. Profiles & Preferences

profiles

Holds general user details.

  • Schema:
    ColumnTypeConstraintsDefaultDescription
    user_iduuidPRIMARY KEY-Foreign key referencing users.id (ON DELETE CASCADE).
    full_nametext--Display name of the user.
    avatar_urltext--URL to profile picture.
    gendertext--User biological gender ('male', 'female').
    dobdate--Date of birth.
    timezonetext-'UTC'User preferred timezone (e.g. 'Asia/Kolkata').
    created_attimestamptzNOT NULLnow()Record creation timestamp.
    updated_attimestamptzNOT NULLnow()Record change timestamp.

user_preferences

Contains application configuration selections.

  • Schema: user_id (PRIMARY KEY), theme (default 'system'), language (default 'en'), measurement_system (default 'metric'), preferences (JSONB for dynamic flags), created_at, updated_at.

2. Safety Profiles

medical_safety_profiles

Maintains user medical parameters. This is audited during agent execution loops to guarantee nutritional plan safety.

  • Schema:
    ColumnTypeConstraintsDefaultDescription
    user_iduuidPRIMARY KEY-Foreign key referencing users.id (ON DELETE CASCADE).
    allergiestext[]NOT NULL'{}'String array list of allergies (e.g. {'peanuts', 'eggs'}).
    medical_conditionstext[]NOT NULL'{}'String array list of medical conditions.
    is_pregnantbooleanNOT NULLfalseTrue if the user is pregnant.
    is_lactatingbooleanNOT NULLfalseTrue if the user is lactating.
    updated_attimestamptzNOT NULLnow()Last update timestamp.

3. Logs & Targets

biometric_logs

Chronological logs of user metrics for progress tracking.

  • Schema:
    ColumnTypeConstraintsDefaultDescription
    iduuidPRIMARY KEYgen_random_uuid()Unique log identifier.
    user_iduuidNOT NULL-Foreign key referencing users.id (ON DELETE CASCADE).
    logged_attimestamptzNOT NULLnow()Metric entry timestamp.
    metric_typetextNOT NULL-Target metric: 'weight_kg', 'height_cm', or 'body_fat_pct'.
    valuenumeric(5,2)NOT NULL-Value of the logged metric.
    notestext--Optional comments.
    created_attimestamptzNOT NULLnow()Creation timestamp.

workout_logs

Tracks physical activity logs and estimates calories burned.

  • Schema: id (PRIMARY KEY), user_id (foreign key users), logged_at, activity_name (e.g. 'Weightlifting'), duration_minutes, calories_burned (default 0.00), notes, created_at.

user_goals

Active objectives configuration.

  • Schema:
    ColumnTypeConstraintsDefaultDescription
    iduuidPRIMARY KEYgen_random_uuid()Unique goal identifier.
    user_iduuidNOT NULL-Foreign key referencing users.id (ON DELETE CASCADE).
    categorytextNOT NULL-Goal class: 'nutrition', 'weight', or 'activity'.
    target_typetextNOT NULL-Goal detail: 'weight_loss', 'calorie_surplus', 'macro_maintenance', or 'daily_steps'.
    target_valuenumeric(8,2)NOT NULL-Numerical target.
    unittextNOT NULL-Metric unit (e.g. 'kg', 'kcal', 'steps').
    configjsonbNOT NULL'{}'Specific limits config (e.g., {"protein_g": 150}).
    start_datedateNOT NULLCURRENT_DATEGoal activation date.
    target_datedate--Target resolution date.
    is_activebooleanNOT NULLtrueTrue if the goal is currently active.
    created_attimestamptzNOT NULLnow()Record creation timestamp.
    updated_attimestamptzNOT NULLnow()Record update timestamp.

On this page