You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This schema supports a simple habit challenge app where users commit to completing a set of tasks daily over a fixed number of days.
Database Overview
A Challenge is a fixed-length commitment of a set of ChallengeTasks. For example, the Challenge may last 21 days and include 3 ChallengeTasks:
Walk 10K steps
Drink 8 glasses of water
Study 45 minutes
Each day, the user sees the same list of tasks, DailyTaskItems, which are grouped in the DailyTaskList for that day.
The schema is designed to record consistency and progress without changing the challenge once it starts.
Database Details
This schema is implemented using SQLite, the native local database engine on Android devices.
Data access is managed using the Room persistence library. This is optimal for offline-first, local storage of structured data in Android apps.
ER Diagram
erDiagram
CHALLENGES {
Long id PK
Int numDays
Date startDate
Date stoppedAt
Date completedAt
}
CHALLENGE_TASKS {
Long id PK
Long challengeId FK
String title
String unit
Float amount
}
DAILY_TASK_LISTS {
Long id PK
Long challengeId FK
Date date
Int numDay
Date completedAt
}
DAILY_TASK_ITEMS {
Long id PK
Long dailyTaskListId FK
Long challengeTaskId FK
Float progressAmount
Date completedAt
}
CHALLENGES ||--o{ CHALLENGE_TASKS : has
CHALLENGES ||--o{ DAILY_TASK_LISTS : contains
DAILY_TASK_LISTS ||--o{ DAILY_TASK_ITEMS : includes
CHALLENGE_TASKS ||--o{ DAILY_TASK_ITEMS : used_by