Habit tracker app database schema

A small local-first SQLite schema for habit tracking: habits with date-versioned schedules, one row per completion, pauses that skip a streak instead of breaking it, reminders, and streaks derived from check-ins rather than stored as a counter.

Habit Tracker ER diagram

Habit tracker app database schema n1 n1 n1 n1 n1 n1 n1 n1 11 users idINTEGER nameTEXT timezoneTEXT day_start_offset_…INTEGER week_starts_onINTEGER created_atTIMESTAMP categories idINTEGER user_idINTEGER nameTEXT colorTEXT positionINTEGER habits idINTEGER user_idINTEGER category_idINTEGER nameTEXT descriptionTEXT kindTEXT target_amountREAL unitTEXT is_archivedBOOLEAN started_onDATE positionINTEGER created_atTIMESTAMP habit_schedules idINTEGER habit_idINTEGER rule_kindTEXT days_maskINTEGER target_countINTEGER interval_daysINTEGER effective_fromDATE effective_toDATE created_atTIMESTAMP check_ins idINTEGER habit_idINTEGER local_dateDATE occurrenceINTEGER amountREAL noteTEXT moodINTEGER completed_atTIMESTAMP pauses idINTEGER habit_idINTEGER starts_onDATE ends_onDATE reasonTEXT created_atTIMESTAMP reminders idINTEGER habit_idINTEGER remind_atTIME days_maskINTEGER is_enabledBOOLEAN skip_if_doneBOOLEAN created_atTIMESTAMP reminder_deliveries idINTEGER reminder_idINTEGER local_dateDATE fired_atTIMESTAMP outcomeTEXT streak_cache habit_idINTEGER current_streakINTEGER longest_streakINTEGER last_check_in_dateDATE total_check_insINTEGER computed_throughDATE computed_atTIMESTAMP

Related database schemas