Portal: move Schedule to per-License-Key with daily/weekly and Block.day

Adds Schedule.licenseKeyId (unique, nullable) and Schedule.type, makes the
legacy userId optional/non-unique, adds Block.day and flips Block
dynamicAudio default to true. The migration backfills each existing
per-user schedule onto that account's oldest License Key as a daily
schedule, preserves unmappable schedules (licenseKeyId NULL) with a
NOTICE, and is reversible. Tested up/down against a scratch schema.
This commit is contained in:
NeilClack
2026-09-29 10:11:21 -05:00
parent 25b5eeb144
commit 138bf03ea9
9 changed files with 630 additions and 130 deletions
@@ -2069,7 +2069,9 @@ export type AuditLogScalarFieldEnum = (typeof AuditLogScalarFieldEnum)[keyof typ
export const ScheduleScalarFieldEnum = {
id: 'id',
licenseKeyId: 'licenseKeyId',
userId: 'userId',
type: 'type',
createdAt: 'createdAt',
updatedAt: 'updatedAt'
} as const
@@ -2080,6 +2082,7 @@ export type ScheduleScalarFieldEnum = (typeof ScheduleScalarFieldEnum)[keyof typ
export const BlockScalarFieldEnum = {
id: 'id',
scheduleId: 'scheduleId',
day: 'day',
startMinutes: 'startMinutes',
endMinutes: 'endMinutes',
dynamicAudio: 'dynamicAudio',