refactor(store): single account name on users; rename profile/laps tables

users.display_name becomes users.name and is now the only human-facing
name -- profiles.name is dropped (it duplicated the account name; the
Profile page's Name field now edits users.name through PUT /api/profile,
which carries Name alongside the profiles columns). The profile table
becomes profiles and laps becomes activity_laps, homogeneous with
activity_samples. Onboarding pre-fills the display name from the OIDC
claim's name.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-04 16:11:23 +02:00
parent e2b2bf9611
commit 042579a396
19 changed files with 109 additions and 79 deletions

View File

@@ -5,11 +5,11 @@ Generated from the live schema via `go run ./cmd/dumpschema` -- do not hand-edit
## Tables
- [`users`](#users)
- [`profile`](#profile)
- [`profiles`](#profiles)
- [`workout_kinds`](#workout_kinds)
- [`workout_type_paces`](#workout_type_paces)
- [`activities`](#activities)
- [`laps`](#laps)
- [`activity_laps`](#activity_laps)
- [`activity_samples`](#activity_samples)
- [`kind_assignments`](#kind_assignments)
- [`sync_state`](#sync_state)
@@ -20,20 +20,19 @@ Generated from the live schema via `go run ./cmd/dumpschema` -- do not hand-edit
```sql
CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
oidc_sub TEXT NOT NULL UNIQUE,
display_name TEXT NOT NULL,
created_at TEXT NOT NULL DEFAULT (datetime('now'))
id INTEGER PRIMARY KEY AUTOINCREMENT,
oidc_sub TEXT NOT NULL UNIQUE,
name TEXT NOT NULL,
created_at TEXT NOT NULL DEFAULT (datetime('now'))
);
```
## `profile`
## `profiles`
```sql
CREATE TABLE profile (
CREATE TABLE profiles (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
name TEXT NOT NULL DEFAULT 'Default',
garmin_email TEXT NOT NULL DEFAULT '',
garmin_password TEXT NOT NULL DEFAULT '',
-- Set once, the first time this user successfully authenticates with
@@ -171,10 +170,10 @@ Indexes:
CREATE INDEX idx_activities_start_time ON activities(start_time_utc);
```
## `laps`
## `activity_laps`
```sql
CREATE TABLE laps (
CREATE TABLE activity_laps (
id INTEGER PRIMARY KEY AUTOINCREMENT,
activity_id INTEGER NOT NULL REFERENCES activities(id) ON DELETE CASCADE,
lap_index INTEGER NOT NULL,

View File

@@ -11,7 +11,7 @@ for that history) and remove it from here once a spec exists.
- make setupSessionIdleTimeout an application configuration (key session.idle_timeout), check difference with appCfg.SessionDuration
- don't put id_token in Claim, store it in the cookie apart from Claim
- find alternative to deprecated React.FormEvent
- replace all go log calls by our application logger
- replace all standard go log calls by our application logger,
- new workout kinds
- add "Recovery", "Quick", and "Sprint" workout kinds
- order to follow (in activities page filter buttons, in analysis page combobox, in profile page workout kinds cards) is Recovery -> Easy -> Long -> Tempo -> 60' Threshold -> 30' Threshold -> Quick -> Intervals -> MAS Test -> Sprint -> Race