Skip to content

Data Model

Håkon Olav Torvik edited this page Oct 24, 2026 · 5 revisions

Data Model

Part of the Relay design spec. See the contents.

14 · Data model

Persistence

TimerDef

  • id: UUID
  • label: String, unique
  • durationExpr: String
  • sound: SoundSpec
  • headerId, sortOrder: library
  • warnSeconds, warnTone: 0 = none (v7)

RelayDef

  • id: UUID
  • label: String, unique
  • script: String
  • stepOverrides: Map<stepKey, StepOverride>
  • defaultSound: SoundSpec
  • transitionMode: SEAMLESS / INTERACTION
  • transitionTone: enum
  • headerId, sortOrder: library

Run

  • id: UUID
  • sourceDefId?: null = anonymous
  • label?: String
  • plan: List<Step> snapshot
  • stepIndex, phase: Int, enum
  • stepEndsAt / remaining: Instant / Duration
  • startedBy: user / scheduleId / external

Schedule

  • id, label?, enabled
  • time, date?: LocalTime, LocalDate
  • repeatDays: Set<DayOfWeek>
  • endRule: never / date / count
  • afterFire: DELETE / DISABLE
  • target: sealed, below

target = Ring(sound, ramp, snooze, maxSnoozes) | Timer(defId or inline expr, label?) | Relay(defId or inline script, label?) | Stopwatch(name?, t₀). Every row also stores createdBy (user / external app).

ScheduleException

  • scheduleId: FK
  • startDay, endDay: LocalDate
  • kind: SKIP / RETIME(time)

Stopwatch

  • id, name?
  • t0, accumulated: Duration
  • startedAt?: Instant
  • laps: List<Lap(at, note?)>
  • sortOrder: Long

ClockStyle

  • kind: DIGITAL / ANALOGUE
  • digital fields: font, format, seconds, date
  • analogue fields: hands, ticks, face, secondHand
  • colors: per element

Embedded (JSON) in the main-clock setting and in each WidgetInstance.

Location / WidgetInstance

  • Location: zoneId, city, sortOrder
  • Widget: appWidgetId, style, zoneId?, city?
  • widget background, shape, border

Library + sound

  • LibraryHeader: title, sortOrder
  • SoundSpec: ringtoneUri, vibration: embedded

v0.5's SoundProfile table stored vibration and volume that nothing ever read. It's now an embedded value, with every field used.


Relay · spec v1.0 · clean-restart baseline, update as screens get built

Clone this wiki locally