Skip to content

Data Model

haakooto edited this page Oct 25, 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) | Notify | Timer(defId or inline expr, label?) | Relay(defId or inline script, label?) | Stopwatch(name?, t₀). Every row also stores createdBy (user / external app).

Calendar reminders (§10b, DB v8) add: eventId? (the item it reminds of), startEpochDay? (repeat begins), repeatMonthDay? / repeatMonth? (monthly / yearly), leadMinutes (fires this long before each occurrence).

Event (§10b)

  • id, kind: EVENT / REMINDER, title, note
  • startEpochDay, startMinute? (null = all day), endEpochDay?, endMinute?
  • repeatKind: NONE / WEEKLY / MONTHLY / YEARLY, repeatDays (weekly mask), untilEpochDay?
  • Its reminder is a Schedule with eventId = this id
  • calendarId (DB v9), color? (null = the calendar's)

Calendar (#34, DB v9)

  • id, name (blank = a starting calendar's translated name), color, sortOrder, shown (in the pane)
  • defaultForAlarms (exactly one), defaultLeadMinutes?, defaultTarget, defaultRepeat
  • Alarms carry calendarId? on their Schedule (null = the default for alarms)
  • repeatRule? on events and on reminder schedules (DB v11, #43): an RFC 5545 rule for RepeatKind.CUSTOM; icsUid? on events (#33)
  • subscriptionUrl?, refreshedAtMillis? on calendars (DB v11, #33)
  • exportCalendarId? (DB v10, #16): the phone calendar its items are copied to; each item keeps its copy's providerEventId?

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