diff --git a/backend/prisma/migrations/20260616_add_magic_cooldown_until/migration.sql b/backend/prisma/migrations/20260616_add_magic_cooldown_until/migration.sql new file mode 100644 index 0000000..2c771ff --- /dev/null +++ b/backend/prisma/migrations/20260616_add_magic_cooldown_until/migration.sql @@ -0,0 +1,2 @@ +-- Add magicCooldownUntil for temporary sleep mode on Magic desktop devices +ALTER TABLE "rebreak"."user_devices" ADD COLUMN "magic_cooldown_until" TIMESTAMP(3); diff --git a/backend/prisma/schema.prisma b/backend/prisma/schema.prisma index c1fed42..41ee24c 100644 --- a/backend/prisma/schema.prisma +++ b/backend/prisma/schema.prisma @@ -1105,6 +1105,8 @@ model UserDevice { /// Wann der User die Entfernung des Magic-Profils beantragt hat. /// Removal-Passwort wird erst nach +MAGIC_RELEASE_COOLDOWN_H sichtbar. magicReleaseRequestedAt DateTime? @map("magic_release_requested_at") + /// Temporärer Sleep-Mode für Magic-Desktop-Geräte. NULL = kein Cooldown aktiv. + magicCooldownUntil DateTime? @map("magic_cooldown_until") @@unique([userId, deviceId]) @@index([userId]) @@ -1295,3 +1297,28 @@ model OauthPendingState { @@map("oauth_pending_states") @@schema("rebreak") } + +/// Client error / crash reports submitted by users or captured automatically. +/// Intentionally minimal PII: no emails, passwords, tokens, or message content. +/// Used for debugging during test phases and high-traffic rollouts. +model ErrorReport { + id String @id @default(uuid()) @db.Uuid + source String /// "native" | "magic" | "web" | "manual" | "auto" + severity String /// "error" | "crash" | "warning" | "info" + title String + message String + stack String? + context Json? /// free-form structured context (screen, device info, etc.) + deviceInfo Json? @map("device_info") /// platform, osVersion, appVersion, model + profileId String? @map("profile_id") @db.Uuid + /// Original client timestamp if provided, otherwise server time. + reportedAt DateTime @map("reported_at") + createdAt DateTime @default(now()) @map("created_at") + + @@index([source]) + @@index([severity]) + @@index([createdAt]) + @@index([profileId]) + @@map("error_reports") + @@schema("rebreak") +}