Marked as helpful by the asker
The schema is fine for the size you're at. One thing that will bite you: streaks has a current_streak column you update from the client on every check-in. That will drift out of sync the moment two devices check in close together.
Compute it instead with a Postgres function that counts consecutive days from checkins, called from a trigger after insert. Slightly more setup, never wrong.
I'll calculate the streak in a view instead of storing it. Is that the right direction? rosa_m · edited
Yes. Derive it from the check-ins and there's nothing left to drift. mira_dev · edited