CREATE TABLE IF NOT EXISTS daily_checkins ( id TEXT PRIMARY KEY, profile_id TEXT NOT NULL, club_id TEXT NOT NULL, streak_day INTEGER NOT NULL DEFAULT 1, coins_awarded INTEGER NOT NULL DEFAULT 0, pack_granted TEXT, -- nullable pack definition id checked_in_at TEXT NOT NULL ); CREATE INDEX IF NOT EXISTS idx_daily_checkins_profile ON daily_checkins (profile_id, checked_in_at DESC);