Open-source status page, incident response and uptime monitoring
TypeScript alertingincident-managementmcpmcp-servermonitoringmonitoring-as-codeobservabilityon-callopen-sourcesrestatus-pagestatuspagesynthetic-monitoringterraformtinybirdtursouptimeuptime-checkeruptime-monitor
feat: grouped monitors (#1524)
Maximilian Kaske1d89615b3a55
diff --git a/apps/dashboard/src/components/forms/status-page/form-monitors.tsx b/apps/dashboard/src/components/forms/status-page/form-monitors.tsxindex 5c0723bd7..f5c52896b 100644--- a/apps/dashboard/src/components/forms/status-page/form-monitors.tsx+++ b/apps/dashboard/src/components/forms/status-page/form-monitors.tsx@@ -15,6 +15,17 @@ import {FormCardSeparator,FormCardTitle,} from "@/components/forms/form-card";+import {+ AlertDialog,+ AlertDialogAction,+ AlertDialogCancel,+ AlertDialogContent,+ AlertDialogDescription,+ AlertDialogFooter,+ AlertDialogHeader,+ AlertDialogTitle,+ AlertDialogTrigger,+} from "@/components/ui/alert-dialog";import { Button } from "@/components/ui/button";import {Command,@@ -33,6 +44,7 @@ import {FormLabel,FormMessage,} from "@/components/ui/form";+import { Input } from "@/components/ui/input";import { PopoverContent } from "@/components/ui/popover";import { Popover, PopoverTrigger } from "@/components/ui/popover";import {@@ -42,11 +54,23 @@ import {SortableItemHandle,SortableOverlay,} from "@/components/ui/sortable";+import {+ Tooltip,+ TooltipContent,+ TooltipProvider,+ TooltipTrigger,+} from "@/components/ui/tooltip";import { cn } from "@/lib/utils";import type { UniqueIdentifier } from "@dnd-kit/core";import { zodResolver } from "@hookform/resolvers/zod";import { isTRPCClientError } from "@trpc/client";-import { Check, ChevronsUpDown, GripVertical } from "lucide-react";+import {+ Check,+ ChevronsUpDown,+ GripVertical,+ Plus,+ Trash2,+} from "lucide-react";import { useCallback, useEffect, useState, useTransition } from "react";import { type UseFormReturn, useForm } from "react-hook-form";import { toast } from "sonner";@@ -59,12 +83,28 @@ type Monitor = {active: boolean | null;};+type MonitorGroup = {+ id: number;+ name: string;+ monitors: Monitor[];+};++const monitorSchema = z.object({+ id: z.number(),+ order: z.number(),+ active: z.boolean().nullable(),+});+const schema = z.object({- monitors: z.array(+ monitors: z.array(monitorSchema),+ groups: z.array(z.object({id: z.number(),order: z.number(),- active: z.boolean().nullable(),+ name: z.string(),+ monitors: z+ .array(monitorSchema)+ .min(1, { message: "At least one monitor is required" }),}),),});@@ -84,16 +124,58 @@ const getSortedMonitors = (});};+const getSortedItems = (+ monitors: Monitor[],+ monitorData: { id: number; order: number }[],+ groups: Array<{+ id: number;+ order: number;+ name: string;+ monitors: Array<{ id: number; order: number; active: boolean | null }>;+ }>,+): (Monitor | MonitorGroup)[] => {+ // Create map of monitor orders+ const monitorOrderMap = new Map(monitorData.map((m) => [m.id, m.order]));++ // Create array of monitors with their orders+ const monitorsWithOrder = monitors+ .filter((monitor) => monitorOrderMap.has(monitor.id))+ .map((monitor) => ({+ item: monitor,+ order: monitorOrderMap.get(monitor.id) ?? 0,+ }));++ // Create array of groups with their orders+ const groupsWithOrder = groups.map((group) => ({+ item: {+ id: group.id,+ name: group.name,+ monitors: getSortedMonitors(monitors, group.monitors),+ } as MonitorGroup,+ order: group.order,+ }));++ // Combine and sort by order+ return [...monitorsWithOrder, ...groupsWithOrder]+ .sort((a, b) => a.order - b.order)+ .map((entry) => entry.item);+};+type FormValues = z.infer<typeof schema>;export function FormMonitors({defaultValues,onSubmit,monitors,+ legacy,...props}: Omit<React.ComponentProps<"form">, "onSubmit"> & {defaultValues?: FormValues;monitors: Monitor[];+ /**+ * Whether the status page is legacy or new+ */+ legacy: boolean;onSubmit: (values: FormValues) => Promise<void>;}) {const form = useForm<FormValues>({@@ -102,50 +184,142 @@ export function FormMonitors({});const [isPending, startTransition] = useTransition();const watchMonitors = form.watch("monitors");- const [data, setData] = useState<Monitor[]>(- getSortedMonitors(monitors, defaultValues?.monitors ?? []),+ const watchGroups = form.watch("groups");+ const [data, setData] = useState<(Monitor | MonitorGroup)[]>(+ getSortedItems(+ monitors,+ defaultValues?.monitors ?? [],+ defaultValues?.groups ?? [],+ ),+ );++ // Get all monitor IDs that are already used in groups+ const monitorsInGroups = new Set(+ (watchGroups ?? []).flatMap((g) => g.monitors.map((m) => m.id)),);- // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>useEffect(() => {- if (watchMonitors.length !== data.length) {- setData(getSortedMonitors(monitors, watchMonitors));- }- // eslint-disable-next-line react-hooks/exhaustive-deps- }, [watchMonitors]);+ const sortedItems = getSortedItems(+ monitors,+ watchMonitors,+ watchGroups ?? [],+ );+ setData(sortedItems);+ }, [watchMonitors, watchGroups, monitors]);const onValueChange = useCallback(- (newMonitors: Monitor[]) => {- setData(newMonitors);- form.setValue(- "monitors",- newMonitors.map((m, index) => ({- id: m.id,+ (newItems: (Monitor | MonitorGroup)[]) => {+ setData(newItems);++ // Update monitors with their position in the overall list+ const monitors = newItems+ .map((item, index) => ({ item, index }))+ .filter(+ (entry): entry is { item: Monitor; index: number } =>+ "url" in entry.item,+ )+ .map(({ item, index }) => ({+ id: item.id,order: index,- active: m.active,- })),- );+ active: item.active,+ }));+ form.setValue("monitors", monitors);++ // Update groups with their position in the overall list+ const existingGroups = form.getValues("groups") ?? [];+ const groups = newItems+ .map((item, index) => ({ item, index }))+ .filter(+ (entry): entry is { item: MonitorGroup; index: number } =>+ "monitors" in entry.item && !("url" in entry.item),+ )+ .map(({ item, index }) => {+ const existingGroup = existingGroups.find((g) => g.id === item.id);+ return existingGroup+ ? {+ ...existingGroup,+ order: index,+ }+ : {+ id: item.id,+ order: index,+ name: item.name,+ monitors: [],+ };+ });+ form.setValue("groups", groups);},[form],);- const getItemValue = useCallback((item: Monitor) => item.id, []);+ const getItemValue = useCallback(+ (item: Monitor | MonitorGroup) => item.id,+ [],+ );++ const handleAddGroup = useCallback(() => {+ const newGroupId = Date.now();+ const existingGroups = form.getValues("groups") ?? [];+ const existingMonitors = form.getValues("monitors") ?? [];+ const order = existingGroups.length + existingMonitors.length;+ const newGroups = [+ ...existingGroups,+ { id: newGroupId, order, name: "", monitors: [] },+ ];+ form.setValue("groups", newGroups);+ setData((prev) => [+ ...prev,+ { id: newGroupId, order, name: "", monitors: [] },+ ]);+ }, [form]);++ const handleDeleteGroup = useCallback(+ (groupId: number) => {+ const existingGroups = form.getValues("groups") ?? [];+ form.setValue(+ "groups",+ existingGroups.filter((g) => g.id !== groupId),+ );+ setData((prev) => prev.filter((item) => item.id !== groupId));+ },+ [form],+ );- // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>const renderOverlay = useCallback(({ value }: { value: UniqueIdentifier }) => {- const monitor = data.find((monitor) => monitor.id === value);+ const monitor = data.find((item) => item.id === value);if (!monitor) return null;- return <MonitorRow monitor={monitor} form={form} />;+ if ("url" in monitor) {+ return (+ <MonitorRow+ monitor={monitor}+ form={form}+ className="border-transparent border-x px-2"+ />+ );+ }++ const groups = form.getValues("groups") ?? [];+ const groupIndex = groups.findIndex((g) => g.id === monitor.id);+ return (+ <MonitorGroup+ group={monitor}+ groupIndex={groupIndex}+ onDeleteGroup={handleDeleteGroup}+ form={form}+ monitors={monitors}+ />+ );},- // eslint-disable-next-line react-hooks/exhaustive-deps- [data],+ [data, handleDeleteGroup, form, monitors],);function submitAction(values: FormValues) {if (isPending) return;+ console.log("submitAction", values);+startTransition(async () => {try {const promise = onSubmit(values);@@ -176,7 +350,7 @@ export function FormMonitors({Connect your monitors to your status page.</FormCardDescription></FormCardHeader>- <FormCardContent>+ <FormCardContent className="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3"><FormFieldcontrol={form.control}name="monitors"@@ -190,7 +364,7 @@ export function FormMonitors({variant="outline"role="combobox"className={cn(- "w-[200px] justify-between",+ "w-full justify-between",!field.value && "text-muted-foreground",)}>@@ -201,7 +375,7 @@ export function FormMonitors({</Button></FormControl></PopoverTrigger>- <PopoverContent className="w-[200px] p-0">+ <PopoverContent className="p-0"><Command><CommandInputplaceholder="Search monitors..."@@ -210,81 +384,137 @@ export function FormMonitors({<CommandList><CommandEmpty>No monitors found.</CommandEmpty><CommandGroup>- {monitors.map((monitor) => (- <CommandItem- value={monitor.name}- key={monitor.id}- onSelect={() => {- if (- field.value.some((m) => m.id === monitor.id)- ) {- form.setValue(- "monitors",- field.value.filter(- (m) => m.id !== monitor.id,- ),- );- } else {- form.setValue("monitors", [- ...field.value,- {- id: monitor.id,- order: watchMonitors.length,- active: monitor.active,- },- ]);- }- }}- >- {monitor.name}- <Check- className={cn(- "ml-auto",- field.value.some((m) => m.id === monitor.id)- ? "opacity-100"- : "opacity-0",- )}- />- </CommandItem>- ))}+ {monitors.map((monitor) => {+ const isInGroup = monitorsInGroups.has(+ monitor.id,+ );+ const isSelected = field.value.some(+ (m) => m.id === monitor.id,+ );+ return (+ <CommandItem+ value={monitor.name}+ key={monitor.id}+ disabled={isInGroup}+ onSelect={() => {+ if (isSelected) {+ form.setValue(+ "monitors",+ field.value.filter(+ (m) => m.id !== monitor.id,+ ),+ );+ } else {+ form.setValue("monitors", [+ ...field.value,+ {+ id: monitor.id,+ order: watchMonitors.length,+ active: monitor.active,+ },+ ]);+ }+ }}+ >+ {monitor.name}+ <Check+ className={cn(+ "ml-auto",+ isSelected ? "opacity-100" : "opacity-0",+ )}+ />+ </CommandItem>+ );+ })}</CommandGroup></CommandList></Command></PopoverContent></Popover>- <FormDescription>- Select the monitors you want to display on your status page.- </FormDescription>+ <FormDescription>Choose monitors to display.</FormDescription><FormMessage /></FormItem>)}/>+ {legacy ? (+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>+ <span className="w-full">+ <Button+ variant="outline"+ type="button"+ className="w-full"+ disabled={legacy}+ >+ <Plus />+ Add Group+ </Button>+ </span>+ </TooltipTrigger>+ <TooltipContent>+ <p>+ Enable the new redesign to add groups to your status page.+ </p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ ) : (+ <Button+ variant="outline"+ type="button"+ className="w-full"+ onClick={handleAddGroup}+ >+ <Plus />+ Add Group+ </Button>+ )}</FormCardContent><FormCardSeparator /><FormCardContent>- {data.length ? (- <Sortable- value={data}- onValueChange={onValueChange}- getItemValue={getItemValue}- orientation="vertical"- >+ <Sortable+ value={data}+ onValueChange={onValueChange}+ getItemValue={getItemValue}+ orientation="vertical"+ >+ {data.length ? (<SortableContent className="grid gap-2">- {data.map((monitor) => (- <MonitorRow- key={monitor.id}- monitor={monitor}- form={form}- />- ))}+ {data.map((item) => {+ if ("url" in item) {+ return (+ <MonitorRow+ key={`${item.id}-monitor`}+ className="border-transparent border-x px-2"+ monitor={item}+ form={form}+ />+ );+ }+ const groups = form.getValues("groups") ?? [];+ const groupIndex = groups.findIndex(+ (g) => g.id === item.id,+ );+ return (+ <MonitorGroup+ key={`${item.id}-group`}+ group={item}+ groupIndex={groupIndex}+ onDeleteGroup={handleDeleteGroup}+ form={form}+ monitors={monitors}+ />+ );+ })}<SortableOverlay>{renderOverlay}</SortableOverlay></SortableContent>- </Sortable>- ) : (- <EmptyStateContainer>- <EmptyStateTitle>No monitors selected</EmptyStateTitle>- </EmptyStateContainer>- )}+ ) : (+ <EmptyStateContainer>+ <EmptyStateTitle>No monitors selected</EmptyStateTitle>+ </EmptyStateContainer>+ )}+ </Sortable></FormCardContent><FormCardFooter><FormCardFooterInfo>@@ -306,10 +536,15 @@ interface MonitorRowPropsform: UseFormReturn<FormValues>;}-function MonitorRow({ monitor, ...props }: MonitorRowProps) {+function MonitorRow({ monitor, className, ...props }: MonitorRowProps) {return (- <SortableItem value={monitor.id} asChild {...props}>- <div className="grid grid-cols-3 gap-2">+ <SortableItem+ value={monitor.id}+ asChild+ className={cn("rounded-md", className)}+ {...props}+ >+ <div className="grid h-9 grid-cols-3 gap-2"><div className="flex flex-row items-center gap-4 self-center"><SortableItemHandle><GripVertical@@ -323,10 +558,251 @@ function MonitorRow({ monitor, ...props }: MonitorRowProps) {<div className="self-center truncate text-muted-foreground text-sm">{monitor.url}</div>- <div className="truncate text-muted-foreground text-sm">+ <div className="self-center truncate text-muted-foreground text-sm">{monitor.active ? "Active" : "Inactive"}</div></div></SortableItem>);}++interface MonitorGroupProps+ extends Omit<React.ComponentPropsWithoutRef<typeof SortableItem>, "value"> {+ group: MonitorGroup;+ groupIndex: number;+ onDeleteGroup: (groupId: number) => void;+ form: UseFormReturn<FormValues>;+ monitors: Monitor[];+}++function MonitorGroup({+ group,+ groupIndex,+ onDeleteGroup,+ form,+ monitors,+}: MonitorGroupProps) {+ const watchGroup = form.watch(`groups.${groupIndex}`);+ const watchMonitors = form.watch("monitors");+ const watchGroups = form.watch("groups");+ const [data, setData] = useState<Monitor[]>(group.monitors);++ // Calculate taken monitors (in main list or other groups)+ const takenMonitorIds = new Set([+ ...watchMonitors.map((m) => m.id),+ ...watchGroups+ .filter((g) => g.id !== group.id)+ .flatMap((g) => g.monitors.map((m) => m.id)),+ ]);++ const onValueChange = useCallback(+ (newMonitors: Monitor[]) => {+ setData(newMonitors);+ // Update the form with the new monitor order+ form.setValue(+ `groups.${groupIndex}.monitors`,+ newMonitors.map((m, index) => ({+ id: m.id,+ order: index,+ active: m.active,+ })),+ );+ },+ [form, groupIndex],+ );++ useEffect(() => {+ setData(getSortedMonitors(monitors, watchGroup.monitors));+ }, [watchGroup.monitors, monitors]);++ const getItemValue = useCallback((item: Monitor) => item.id, []);++ const renderOverlay = useCallback(+ ({ value }: { value: UniqueIdentifier }) => {+ const monitor = data.find((item) => item.id === value);+ if (!monitor) return null;++ return <MonitorRow monitor={monitor} form={form} />;+ },+ [data, form],+ );++ return (+ <SortableItem value={group.id} className="rounded-md border bg-muted">+ <div className="grid grid-cols-3 gap-2 px-2 pt-2">+ <div className="flex flex-row items-center gap-1 self-center">+ <SortableItemHandle>+ <GripVertical+ size={16}+ aria-hidden="true"+ className="text-muted-foreground"+ />+ </SortableItemHandle>+ <FormField+ control={form.control}+ name={`groups.${groupIndex}.name` as const}+ render={({ field }) => (+ <FormItem className="w-full">+ <FormLabel className="sr-only">Group name</FormLabel>+ <FormControl>+ <Input+ placeholder="Group Name"+ className="w-full bg-background"+ {...field}+ />+ </FormControl>+ <FormMessage />+ </FormItem>+ )}+ />+ </div>+ <FormField+ control={form.control}+ name={`groups.${groupIndex}.monitors` as const}+ render={({ field }) => (+ <FormItem className="flex w-full flex-col">+ <FormLabel className="sr-only">Monitors</FormLabel>+ <Popover>+ <PopoverTrigger asChild>+ <FormControl>+ <Button+ variant="outline"+ role="combobox"+ className={cn(+ "w-full justify-between",+ !field.value && "text-muted-foreground",+ )}+ >+ {Array.isArray(field.value) && field.value.length > 0+ ? `${field.value.length} monitors selected`+ : "Select monitors"}+ <ChevronsUpDown className="opacity-50" />+ </Button>+ </FormControl>+ </PopoverTrigger>+ <PopoverContent className="p-0">+ <Command>+ <CommandInput+ placeholder="Search monitors..."+ className="h-9"+ />+ <CommandList>+ <CommandEmpty>No monitors found.</CommandEmpty>+ <CommandGroup>+ {monitors.map((monitor) => {+ const current = field.value ?? [];+ const isSelected = current.some(+ (m) => m.id === monitor.id,+ );+ const isTaken = takenMonitorIds.has(monitor.id);+ return (+ <CommandItem+ value={monitor.name}+ key={monitor.id}+ disabled={isTaken}+ onSelect={() => {+ if (isSelected) {+ form.setValue(+ `groups.${groupIndex}.monitors`,+ current.filter((m) => m.id !== monitor.id),+ );+ } else {+ form.setValue(+ `groups.${groupIndex}.monitors`,+ [+ ...current,+ {+ id: monitor.id,+ order: 0,+ active: monitor.active,+ },+ ],+ );+ }+ }}+ >+ {monitor.name}+ <Check+ className={cn(+ "ml-auto",+ isSelected ? "opacity-100" : "opacity-0",+ )}+ />+ </CommandItem>+ );+ })}+ </CommandGroup>+ </CommandList>+ </Command>+ </PopoverContent>+ </Popover>+ <FormMessage />+ </FormItem>+ )}+ />+ <div className="flex justify-end">+ <AlertDialog>+ <AlertDialogTrigger asChild>+ <Button+ type="button"+ variant="ghost"+ size="icon"+ className="text-destructive hover:bg-destructive/10 hover:text-destructive dark:hover:bg-destructive/20 [&_svg]:size-4 [&_svg]:text-destructive"+ // NOTE: delete directly if no monitors are in the group+ {...(data.length === 0+ ? { onClick: () => onDeleteGroup(group.id) }+ : {})}+ >+ <Trash2 />+ </Button>+ </AlertDialogTrigger>+ <AlertDialogContent>+ <AlertDialogHeader>+ <AlertDialogTitle>Are you sure?</AlertDialogTitle>+ <AlertDialogDescription>+ You are about to delete this group and all its monitors.+ </AlertDialogDescription>+ </AlertDialogHeader>+ <AlertDialogFooter>+ <AlertDialogCancel>Cancel</AlertDialogCancel>+ <AlertDialogAction+ className="bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40"+ onClick={() => onDeleteGroup(group.id)}+ >+ Delete+ </AlertDialogAction>+ </AlertDialogFooter>+ </AlertDialogContent>+ </AlertDialog>+ </div>+ </div>+ <div className="mt-2 border-t px-2 pt-2 pb-2">+ <Sortable+ value={data}+ onValueChange={onValueChange}+ getItemValue={getItemValue}+ orientation="vertical"+ >+ {data.length ? (+ <SortableContent className="grid gap-2">+ {data.map((item) => {+ return (+ <MonitorRow+ key={`${item.id}-monitor`}+ monitor={item}+ form={form}+ />+ );+ })}+ <SortableOverlay>{renderOverlay}</SortableOverlay>+ </SortableContent>+ ) : (+ <EmptyStateContainer>+ <EmptyStateTitle>No monitors selected</EmptyStateTitle>+ </EmptyStateContainer>+ )}+ </Sortable>+ </div>+ </SortableItem>+ );+}diff --git a/apps/dashboard/src/components/forms/status-page/update.tsx b/apps/dashboard/src/components/forms/status-page/update.tsxindex 5cb3df25e..b54f79365 100644--- a/apps/dashboard/src/components/forms/status-page/update.tsx+++ b/apps/dashboard/src/components/forms/status-page/update.tsx@@ -116,16 +116,38 @@ export function FormStatusPageUpdate() {<FormMonitorsmonitors={monitors ?? []}defaultValues={{- monitors: statusPage.monitors.map((monitor) => ({- id: monitor.id,- order: monitor.order,- active: monitor.active ?? null,- })),+ monitors: statusPage.monitors+ .filter((m) => !m.groupId)+ .map((monitor) => ({+ id: monitor.id,+ order: monitor.order,+ active: monitor.active ?? null,+ })),+ groups: statusPage.monitorGroups.map((group) => {+ const order =+ statusPage.monitors.find((m) => m.groupId === group.id)+ ?.groupOrder ?? 0;+ console.log(group);+ return {+ id: -1 * group.id, // negative id to avoid conflicts with monitors+ order,+ name: group.name,+ monitors: statusPage.monitors+ .filter((m) => m.groupId === group.id)+ .map((monitor) => ({+ id: monitor.id,+ order: monitor.order,+ active: monitor.active ?? null,+ })),+ };+ }),}}+ legacy={statusPage.legacyPage}onSubmit={async (values) => {await updateMonitorsMutation.mutateAsync({id: Number.parseInt(id),monitors: values.monitors,+ groups: values.groups,});}}/>diff --git a/apps/status-page/src/app/(status-page)/[domain]/(public)/page.tsx b/apps/status-page/src/app/(status-page)/[domain]/(public)/page.tsxindex 821ac66d9..adef90de5 100644--- a/apps/status-page/src/app/(status-page)/[domain]/(public)/page.tsx+++ b/apps/status-page/src/app/(status-page)/[domain]/(public)/page.tsx@@ -23,6 +23,7 @@ import {} from "@/components/status-page/status-events";import { StatusFeed } from "@/components/status-page/status-feed";import { StatusMonitor } from "@/components/status-page/status-monitor";+import { StatusTrackerGroup } from "@/components/status-page/status-tracker-group";import { Separator } from "@/components/ui/separator";import { useTRPC } from "@/lib/trpc/client";import { cn } from "@/lib/utils";@@ -178,21 +179,48 @@ export default function Page() {<StatusBanner status={page.status} />)}{/* NOTE: check what gap feels right */}- {page.monitors.length > 0 ? (+ {page.trackers.length > 0 ? (<StatusContent className="gap-5">- {page.monitors.map((monitor) => {- const { data, uptime } =- uptimeData?.find((m) => m.id === monitor.id) ?? {};+ {page.trackers.map((tracker) => {+ if (tracker.type === "monitor") {+ const monitor = tracker.monitor;+ const { data, uptime } =+ uptimeData?.find((m) => m.id === monitor.id) ?? {};+ return (+ <StatusMonitor+ key={`monitor-${monitor.id}`}+ status={monitor.status}+ data={data}+ monitor={monitor}+ uptime={uptime}+ showUptime={showUptime}+ isLoading={isLoading}+ />+ );+ }+return (- <StatusMonitor- key={monitor.id}- status={monitor.status}- data={data}- monitor={monitor}- uptime={uptime}- showUptime={showUptime}- isLoading={isLoading}- />+ <StatusTrackerGroup+ key={`group-${tracker.groupId}`}+ title={tracker.groupName}+ status={tracker.status}+ >+ {tracker.monitors.map((monitor) => {+ const { data, uptime } =+ uptimeData?.find((m) => m.id === monitor.id) ?? {};+ return (+ <StatusMonitor+ key={`monitor-${monitor.id}`}+ status={monitor.status}+ data={data}+ monitor={monitor}+ uptime={uptime}+ showUptime={showUptime}+ isLoading={isLoading}+ />+ );+ })}+ </StatusTrackerGroup>);})}</StatusContent>diff --git a/apps/status-page/src/components/nav/header.tsx b/apps/status-page/src/components/nav/header.tsxindex d19ffb079..f8accb120 100644--- a/apps/status-page/src/components/nav/header.tsx+++ b/apps/status-page/src/components/nav/header.tsx@@ -92,20 +92,31 @@ export function Header(props: React.ComponentProps<"header">) {{/* NOTE: same width as the `StatusUpdates` button */}<div className="flex w-[150px] shrink-0"><div className="flex items-center justify-center">- <Link- href={page?.homepageUrl || "/"}- target={page?.homepageUrl ? "_blank" : undefined}- rel={page?.homepageUrl ? "noreferrer" : undefined}- className="rounded-full"- >- {page?.icon ? (- <img- src={page.icon}- alt={`${page.title} status page`}- className="size-8 rounded-full border"- />- ) : null}- </Link>+ <Button variant="outline" size="icon" className="size-8" asChild>+ <Link+ href={page?.homepageUrl || "/"}+ target={page?.homepageUrl ? "_blank" : undefined}+ rel={page?.homepageUrl ? "noreferrer" : undefined}+ >+ {page?.icon ? (+ <img+ src={page.icon}+ alt={`${page.title} status page`}+ className="size-8"+ />+ ) : (+ <div className="flex size-8 items-center justify-center font-mono">+ {/* NOTE: show the first two letters of the title and if its multiple words, show the first letter of the first two words */}+ {page?.title+ ?.split(" ")+ .map((word) => word.charAt(0))+ .slice(0, 2)+ .join("")+ .toUpperCase()}+ </div>+ )}+ </Link>+ </Button></div></div><NavDesktop className="hidden md:flex" />diff --git a/apps/status-page/src/components/status-page/status-tracker-group.tsx b/apps/status-page/src/components/status-page/status-tracker-group.tsxindex db5c81c4d..413fbd6b4 100644--- a/apps/status-page/src/components/status-page/status-tracker-group.tsx+++ b/apps/status-page/src/components/status-page/status-tracker-group.tsx@@ -10,28 +10,28 @@ import { StatusMonitorIcon, StatusMonitorStatus } from "./status-monitor";export function StatusTrackerGroup({children,title,- variant,+ status,className,...props}: React.ComponentProps<typeof CollapsibleTrigger> & {title: string;- variant?: VariantType;+ status?: VariantType;}) {return (<CollapsibleclassName={cn("-mx-3",- "rounded-lg border border-transparent hover:border-border/50 hover:bg-muted/50 data-[state=open]:border-border/50 data-[state=open]:bg-muted/50",+ "rounded-lg border border-transparent bg-muted/50 hover:border-border/50 data-[state=open]:border-border/50 data-[state=open]:bg-muted/50",className,)}><CollapsibleTriggerclassName={cn(- "group/monitor flex w-full items-center justify-between gap-2 rounded-lg px-3 py-2 font-medium",+ "group/monitor flex w-full items-center justify-between gap-2 rounded-lg px-3 py-2 font-medium font-mono","cursor-pointer",className,)}- data-variant={variant}+ data-variant={status}{...props}>{title}diff --git a/apps/web/public/assets/changelog/grouped-monitors.png b/apps/web/public/assets/changelog/grouped-monitors.pngnew file mode 100644index 000000000..188814314Binary files /dev/null and b/apps/web/public/assets/changelog/grouped-monitors.png differdiff --git a/apps/web/src/content/changelog/grouped-monitors.mdx b/apps/web/src/content/changelog/grouped-monitors.mdxnew file mode 100644index 000000000..a91356e44--- /dev/null+++ b/apps/web/src/content/changelog/grouped-monitors.mdx@@ -0,0 +1,8 @@+---+title: Grouped Monitors+description: Organize monitors by region or service for a cleaner overview.+image: /assets/changelog/grouped-monitors.png+publishedAt: 2025-11-06+---++You can now group monitors on your status page - for example, by region (EU, US, APAC) or service (API, Dashboard, Auth). This makes it easier for visitors to understand which parts of your system are affected.\ No newline at end of filediff --git a/packages/api/src/router/page.ts b/packages/api/src/router/page.tsindex 79ad1a06f..45d30396f 100644--- a/packages/api/src/router/page.ts+++ b/packages/api/src/router/page.ts@@ -18,9 +18,11 @@ import {legacy_selectPublicPageSchemaWithRelation,maintenance,monitor,+ monitorGroup,monitorsToPages,page,selectMaintenanceSchema,+ selectMonitorGroupSchema,selectMonitorSchema,selectPageSchema,selectPageSchemaWithMonitorsRelation,@@ -490,7 +492,7 @@ export const pageRouter = createTRPCRouter({const data = await opts.ctx.db.query.page.findFirst({where: and(...whereConditions),with: {- monitorsToPages: { with: { monitor: true } },+ monitorsToPages: { with: { monitor: true, monitorGroup: true } },maintenances: true,},});@@ -498,8 +500,15 @@ export const pageRouter = createTRPCRouter({return selectPageSchema.extend({monitors: z- .array(selectMonitorSchema.extend({ order: z.number().default(0) }))+ .array(+ selectMonitorSchema.extend({+ order: z.number().default(0),+ groupOrder: z.number().default(0),+ groupId: z.number().nullable(),+ }),+ ).default([]),+ monitorGroups: z.array(selectMonitorGroupSchema).default([]),maintenances: z.array(selectMaintenanceSchema).default([]),}).parse({@@ -507,7 +516,16 @@ export const pageRouter = createTRPCRouter({monitors: data?.monitorsToPages.map((m) => ({...m.monitor,order: m.order,+ groupId: m.monitorGroupId,+ groupOrder: m.groupOrder,})),+ monitorGroups: Array.from(+ new Map(+ data?.monitorsToPages+ .filter((m) => m.monitorGroup)+ .map((m) => [m.monitorGroup?.id, m.monitorGroup]),+ ).values(),+ ),maintenances: data?.maintenances,});}),@@ -824,21 +842,32 @@ export const pageRouter = createTRPCRouter({z.object({id: z.number(),monitors: z.array(z.object({ id: z.number(), order: z.number() })),+ groups: z.array(+ z.object({+ // id: z.number(), // we dont need it as we are deleting and adding+ order: z.number(),+ name: z.string(),+ monitors: z.array(z.object({ id: z.number(), order: z.number() })),+ }),+ ),}),).mutation(async (opts) => {+ const monitorIds = opts.input.monitors.map((m) => m.id);+ const groupMonitorIds = opts.input.groups.flatMap((g) =>+ g.monitors.map((m) => m.id),+ );++ const allMonitorIds = [...new Set([...monitorIds, ...groupMonitorIds])];// check if the monitors are in the workspaceconst monitors = await opts.ctx.db.query.monitor.findMany({where: and(- inArray(- monitor.id,- opts.input.monitors.map((m) => m.id),- ),+ inArray(monitor.id, allMonitorIds),eq(monitor.workspaceId, opts.ctx.workspace.id),),});- if (monitors.length !== opts.input.monitors.length) {+ if (monitors.length !== allMonitorIds.length) {throw new TRPCError({code: "FORBIDDEN",message: "You don't have access to all the monitors.",@@ -846,10 +875,38 @@ export const pageRouter = createTRPCRouter({}await opts.ctx.db.transaction(async (tx) => {+ await tx+ .delete(monitorGroup)+ .where(eq(monitorGroup.pageId, opts.input.id));await tx.delete(monitorsToPages).where(eq(monitorsToPages.pageId, opts.input.id));+ if (opts.input.groups.length > 0) {+ const monitorGroups = await tx+ .insert(monitorGroup)+ .values(+ opts.input.groups.map((g) => ({+ workspaceId: opts.ctx.workspace.id,+ pageId: opts.input.id,+ name: g.name,+ })),+ )+ .returning();++ await tx.insert(monitorsToPages).values(+ opts.input.groups.flatMap((g, i) =>+ g.monitors.map((m) => ({+ pageId: opts.input.id,+ monitorId: m.id,+ order: g.order,+ monitorGroupId: monitorGroups[i].id,+ groupOrder: m.order,+ })),+ ),+ );+ }+if (opts.input.monitors.length > 0) {await tx.insert(monitorsToPages).values(opts.input.monitors.map((m) => ({diff --git a/packages/api/src/router/statusPage.ts b/packages/api/src/router/statusPage.tsindex 5b3713af0..d43730f99 100644--- a/packages/api/src/router/statusPage.ts+++ b/packages/api/src/router/statusPage.ts@@ -21,6 +21,7 @@ import {fillStatusDataFor45DaysNoop,getEvents,getUptime,+ getWorstVariant,setDataByType,} from "./statusPage.utils";import {@@ -82,6 +83,7 @@ export const statusPageRouter = createTRPCRouter({incidents: true,},},+ monitorGroup: true,},orderBy: (monitorsToPages, { asc }) => asc(monitorsToPages.order),},@@ -127,7 +129,14 @@ export const statusPageRouter = createTRPCRouter({)? "info": "success";- return { ...m.monitor, status, events };+ return {+ ...m.monitor,+ status,+ events,+ monitorGroupId: m.monitorGroupId,+ order: m.order,+ groupOrder: m.groupOrder,+ };});const status =@@ -177,9 +186,109 @@ export const statusPageRouter = createTRPCRouter({return false;});+ const monitorGroups = Array.from(+ new Map(+ _page.monitorsToPages.map((m) => [+ m.monitorGroup?.id,+ m.monitorGroup,+ ]),+ )+ .values()+ .filter(Boolean),+ );++ // Create trackers array with grouped and ungrouped monitors+ const groupedMap = new Map<+ number | null,+ {+ groupId: number | null;+ groupName: string | null;+ monitors: typeof monitors;+ minOrder: number;+ }+ >();++ monitors.forEach((monitor) => {+ const groupId = monitor.monitorGroupId ?? null;+ const group = groupId+ ? monitorGroups.find((g) => g?.id === groupId)+ : null;+ const groupName = group?.name ?? null;++ if (!groupedMap.has(groupId)) {+ groupedMap.set(groupId, {+ groupId,+ groupName,+ monitors: [],+ minOrder: monitor.order ?? 0,+ });+ }+ const currentGroup = groupedMap.get(groupId);+ if (currentGroup) {+ currentGroup.monitors.push(monitor);+ currentGroup.minOrder = Math.min(+ currentGroup.minOrder,+ monitor.order ?? 0,+ );+ }+ });++ // Convert to trackers array+ type MonitorTracker = {+ type: "monitor";+ monitor: (typeof monitors)[number];+ order: number;+ };++ type GroupTracker = {+ type: "group";+ groupId: number;+ groupName: string;+ monitors: typeof monitors;+ status: "success" | "degraded" | "error" | "info" | "empty";+ order: number;+ };++ type Tracker = MonitorTracker | GroupTracker;++ const trackers: Tracker[] = Array.from(groupedMap.values())+ .flatMap((group): Tracker[] => {+ if (group.groupId === null) {+ // Ungrouped monitors - return as individual trackers+ return group.monitors.map(+ (monitor): MonitorTracker => ({+ type: "monitor",+ monitor,+ order: monitor.order ?? 0,+ }),+ );+ }+ // Grouped monitors - return as single group tracker+ const sortedMonitors = group.monitors.sort(+ (a, b) => (a.groupOrder ?? 0) - (b.groupOrder ?? 0),+ );+ return [+ {+ type: "group",+ groupId: group.groupId,+ groupName: group.groupName ?? "",+ monitors: sortedMonitors,+ status: getWorstVariant(+ group.monitors.map(+ (m) => m.status as "success" | "degraded" | "error" | "info",+ ),+ ),+ order: group.minOrder,+ },+ ];+ })+ .sort((a, b) => a.order - b.order);+return selectPublicPageSchemaWithRelation.parse({..._page,monitors,+ monitorGroups,+ trackers,incidents: monitors.flatMap((m) => m.incidents) ?? [],statusReports:// NOTE: we need to sort the status reports by the first update datediff --git a/packages/api/src/router/statusPage.utils.ts b/packages/api/src/router/statusPage.utils.tsindex 64dbcfbe2..f98b37b9c 100644--- a/packages/api/src/router/statusPage.utils.ts+++ b/packages/api/src/router/statusPage.utils.ts@@ -204,6 +204,21 @@ export function getEvents({// Keep the old function name for backward compatibilityexport const getEventsByMonitorId = getEvents;+export function getWorstVariant(+ statuses: (keyof typeof STATUS_PRIORITY)[],+): keyof typeof STATUS_PRIORITY {+ if (statuses.length === 0) return "success";++ return statuses.reduce(+ (worst, current) => {+ return STATUS_PRIORITY[current] > STATUS_PRIORITY[worst]+ ? current+ : worst;+ },+ "success" as keyof typeof STATUS_PRIORITY,+ );+}+type UptimeData = {day: string;events: Event[];diff --git a/packages/db/drizzle/0049_sloppy_inhumans.sql b/packages/db/drizzle/0049_sloppy_inhumans.sqlnew file mode 100644index 000000000..45d0f9b12--- /dev/null+++ b/packages/db/drizzle/0049_sloppy_inhumans.sql@@ -0,0 +1,13 @@+CREATE TABLE `monitor_group` (+ `id` integer PRIMARY KEY NOT NULL,+ `workspace_id` integer NOT NULL,+ `page_id` integer NOT NULL,+ `name` text NOT NULL,+ `created_at` integer DEFAULT (strftime('%s', 'now')),+ `updated_at` integer DEFAULT (strftime('%s', 'now')),+ FOREIGN KEY (`workspace_id`) REFERENCES `workspace`(`id`) ON UPDATE no action ON DELETE cascade,+ FOREIGN KEY (`page_id`) REFERENCES `page`(`id`) ON UPDATE no action ON DELETE cascade+);+--> statement-breakpoint+ALTER TABLE `monitors_to_pages` ADD `monitor_group_id` integer REFERENCES monitor_group(id);--> statement-breakpoint+ALTER TABLE `monitors_to_pages` ADD `group_order` integer DEFAULT 0;\ No newline at end of filediff --git a/packages/db/drizzle/meta/0049_snapshot.json b/packages/db/drizzle/meta/0049_snapshot.jsonnew file mode 100644index 000000000..dce8dc7c0--- /dev/null+++ b/packages/db/drizzle/meta/0049_snapshot.json@@ -0,0 +1,2696 @@+{+ "version": "6",+ "dialect": "sqlite",+ "id": "7fd60946-e536-4fb1-863b-877d0d01dcc9",+ "prevId": "091d5fb3-ae4f-4ce2-a91f-695d054c0f79",+ "tables": {+ "workspace": {+ "name": "workspace",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "slug": {+ "name": "slug",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "stripe_id": {+ "name": "stripe_id",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "subscription_id": {+ "name": "subscription_id",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "plan": {+ "name": "plan",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "ends_at": {+ "name": "ends_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "paid_until": {+ "name": "paid_until",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "limits": {+ "name": "limits",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'{}'"+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "dsn": {+ "name": "dsn",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {+ "workspace_slug_unique": {+ "name": "workspace_slug_unique",+ "columns": [+ "slug"+ ],+ "isUnique": true+ },+ "workspace_stripe_id_unique": {+ "name": "workspace_stripe_id_unique",+ "columns": [+ "stripe_id"+ ],+ "isUnique": true+ },+ "workspace_id_dsn_unique": {+ "name": "workspace_id_dsn_unique",+ "columns": [+ "id",+ "dsn"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "account": {+ "name": "account",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "type": {+ "name": "type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "provider_account_id": {+ "name": "provider_account_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "refresh_token": {+ "name": "refresh_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "access_token": {+ "name": "access_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "token_type": {+ "name": "token_type",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "scope": {+ "name": "scope",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "id_token": {+ "name": "id_token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "session_state": {+ "name": "session_state",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "account_user_id_user_id_fk": {+ "name": "account_user_id_user_id_fk",+ "tableFrom": "account",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "account_provider_provider_account_id_pk": {+ "columns": [+ "provider",+ "provider_account_id"+ ],+ "name": "account_provider_provider_account_id_pk"+ }+ },+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "session": {+ "name": "session",+ "columns": {+ "session_token": {+ "name": "session_token",+ "type": "text",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "user_id": {+ "name": "user_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "expires": {+ "name": "expires",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "session_user_id_user_id_fk": {+ "name": "session_user_id_user_id_fk",+ "tableFrom": "session",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "user": {+ "name": "user",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "tenant_id": {+ "name": "tenant_id",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "first_name": {+ "name": "first_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "''"+ },+ "last_name": {+ "name": "last_name",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "''"+ },+ "photo_url": {+ "name": "photo_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "''"+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "''"+ },+ "emailVerified": {+ "name": "emailVerified",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {+ "user_tenant_id_unique": {+ "name": "user_tenant_id_unique",+ "columns": [+ "tenant_id"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "users_to_workspaces": {+ "name": "users_to_workspaces",+ "columns": {+ "user_id": {+ "name": "user_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'member'"+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "users_to_workspaces_user_id_user_id_fk": {+ "name": "users_to_workspaces_user_id_user_id_fk",+ "tableFrom": "users_to_workspaces",+ "tableTo": "user",+ "columnsFrom": [+ "user_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "users_to_workspaces_workspace_id_workspace_id_fk": {+ "name": "users_to_workspaces_workspace_id_workspace_id_fk",+ "tableFrom": "users_to_workspaces",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "users_to_workspaces_user_id_workspace_id_pk": {+ "columns": [+ "user_id",+ "workspace_id"+ ],+ "name": "users_to_workspaces_user_id_workspace_id_pk"+ }+ },+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "verification_token": {+ "name": "verification_token",+ "columns": {+ "identifier": {+ "name": "identifier",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "expires": {+ "name": "expires",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {+ "verification_token_identifier_token_pk": {+ "columns": [+ "identifier",+ "token"+ ],+ "name": "verification_token_identifier_token_pk"+ }+ },+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "status_report_to_monitors": {+ "name": "status_report_to_monitors",+ "columns": {+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "status_report_id": {+ "name": "status_report_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "status_report_to_monitors_monitor_id_monitor_id_fk": {+ "name": "status_report_to_monitors_monitor_id_monitor_id_fk",+ "tableFrom": "status_report_to_monitors",+ "tableTo": "monitor",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "status_report_to_monitors_status_report_id_status_report_id_fk": {+ "name": "status_report_to_monitors_status_report_id_status_report_id_fk",+ "tableFrom": "status_report_to_monitors",+ "tableTo": "status_report",+ "columnsFrom": [+ "status_report_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "status_report_to_monitors_monitor_id_status_report_id_pk": {+ "columns": [+ "monitor_id",+ "status_report_id"+ ],+ "name": "status_report_to_monitors_monitor_id_status_report_id_pk"+ }+ },+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "status_report": {+ "name": "status_report",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "title": {+ "name": "title",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "page_id": {+ "name": "page_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "status_report_workspace_id_workspace_id_fk": {+ "name": "status_report_workspace_id_workspace_id_fk",+ "tableFrom": "status_report",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "status_report_page_id_page_id_fk": {+ "name": "status_report_page_id_page_id_fk",+ "tableFrom": "status_report",+ "tableTo": "page",+ "columnsFrom": [+ "page_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "status_report_update": {+ "name": "status_report_update",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "date": {+ "name": "date",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "message": {+ "name": "message",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "status_report_id": {+ "name": "status_report_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "status_report_update_status_report_id_status_report_id_fk": {+ "name": "status_report_update_status_report_id_status_report_id_fk",+ "tableFrom": "status_report_update",+ "tableTo": "status_report",+ "columnsFrom": [+ "status_report_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "integration": {+ "name": "integration",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "credential": {+ "name": "credential",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "external_id": {+ "name": "external_id",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "data": {+ "name": "data",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "integration_workspace_id_workspace_id_fk": {+ "name": "integration_workspace_id_workspace_id_fk",+ "tableFrom": "integration",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "page": {+ "name": "page",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "icon": {+ "name": "icon",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "''"+ },+ "slug": {+ "name": "slug",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "custom_domain": {+ "name": "custom_domain",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "published": {+ "name": "published",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": false+ },+ "force_theme": {+ "name": "force_theme",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'system'"+ },+ "password": {+ "name": "password",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "password_protected": {+ "name": "password_protected",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": false+ },+ "homepage_url": {+ "name": "homepage_url",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "contact_url": {+ "name": "contact_url",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "legacy_page": {+ "name": "legacy_page",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": true+ },+ "configuration": {+ "name": "configuration",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "show_monitor_values": {+ "name": "show_monitor_values",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": true+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {+ "page_slug_unique": {+ "name": "page_slug_unique",+ "columns": [+ "slug"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "page_workspace_id_workspace_id_fk": {+ "name": "page_workspace_id_workspace_id_fk",+ "tableFrom": "page",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "monitor": {+ "name": "monitor",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "job_type": {+ "name": "job_type",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'http'"+ },+ "periodicity": {+ "name": "periodicity",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'other'"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'active'"+ },+ "active": {+ "name": "active",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": false+ },+ "regions": {+ "name": "regions",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "''"+ },+ "url": {+ "name": "url",+ "type": "text(2048)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "''"+ },+ "description": {+ "name": "description",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "''"+ },+ "headers": {+ "name": "headers",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "''"+ },+ "body": {+ "name": "body",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "''"+ },+ "method": {+ "name": "method",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "'GET'"+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "timeout": {+ "name": "timeout",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": 45000+ },+ "degraded_after": {+ "name": "degraded_after",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "assertions": {+ "name": "assertions",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "otel_endpoint": {+ "name": "otel_endpoint",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "otel_headers": {+ "name": "otel_headers",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "public": {+ "name": "public",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": false+ },+ "retry": {+ "name": "retry",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": 3+ },+ "follow_redirects": {+ "name": "follow_redirects",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": true+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "monitor_workspace_id_workspace_id_fk": {+ "name": "monitor_workspace_id_workspace_id_fk",+ "tableFrom": "monitor",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "monitors_to_pages": {+ "name": "monitors_to_pages",+ "columns": {+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "page_id": {+ "name": "page_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "order": {+ "name": "order",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": 0+ },+ "monitor_group_id": {+ "name": "monitor_group_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "group_order": {+ "name": "group_order",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": 0+ }+ },+ "indexes": {},+ "foreignKeys": {+ "monitors_to_pages_monitor_id_monitor_id_fk": {+ "name": "monitors_to_pages_monitor_id_monitor_id_fk",+ "tableFrom": "monitors_to_pages",+ "tableTo": "monitor",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "monitors_to_pages_page_id_page_id_fk": {+ "name": "monitors_to_pages_page_id_page_id_fk",+ "tableFrom": "monitors_to_pages",+ "tableTo": "page",+ "columnsFrom": [+ "page_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "monitors_to_pages_monitor_group_id_monitor_group_id_fk": {+ "name": "monitors_to_pages_monitor_group_id_monitor_group_id_fk",+ "tableFrom": "monitors_to_pages",+ "tableTo": "monitor_group",+ "columnsFrom": [+ "monitor_group_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "monitors_to_pages_monitor_id_page_id_pk": {+ "columns": [+ "monitor_id",+ "page_id"+ ],+ "name": "monitors_to_pages_monitor_id_page_id_pk"+ }+ },+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "page_subscriber": {+ "name": "page_subscriber",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "page_id": {+ "name": "page_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "accepted_at": {+ "name": "accepted_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "page_subscriber_page_id_page_id_fk": {+ "name": "page_subscriber_page_id_page_id_fk",+ "tableFrom": "page_subscriber",+ "tableTo": "page",+ "columnsFrom": [+ "page_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "notification": {+ "name": "notification",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "provider": {+ "name": "provider",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "data": {+ "name": "data",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "'{}'"+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "notification_workspace_id_workspace_id_fk": {+ "name": "notification_workspace_id_workspace_id_fk",+ "tableFrom": "notification",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "notification_trigger": {+ "name": "notification_trigger",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "notification_id": {+ "name": "notification_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "cron_timestamp": {+ "name": "cron_timestamp",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ }+ },+ "indexes": {+ "notification_id_monitor_id_crontimestampe": {+ "name": "notification_id_monitor_id_crontimestampe",+ "columns": [+ "notification_id",+ "monitor_id",+ "cron_timestamp"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "notification_trigger_monitor_id_monitor_id_fk": {+ "name": "notification_trigger_monitor_id_monitor_id_fk",+ "tableFrom": "notification_trigger",+ "tableTo": "monitor",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "notification_trigger_notification_id_notification_id_fk": {+ "name": "notification_trigger_notification_id_notification_id_fk",+ "tableFrom": "notification_trigger",+ "tableTo": "notification",+ "columnsFrom": [+ "notification_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "notifications_to_monitors": {+ "name": "notifications_to_monitors",+ "columns": {+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "notification_id": {+ "name": "notification_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "notifications_to_monitors_monitor_id_monitor_id_fk": {+ "name": "notifications_to_monitors_monitor_id_monitor_id_fk",+ "tableFrom": "notifications_to_monitors",+ "tableTo": "monitor",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "notifications_to_monitors_notification_id_notification_id_fk": {+ "name": "notifications_to_monitors_notification_id_notification_id_fk",+ "tableFrom": "notifications_to_monitors",+ "tableTo": "notification",+ "columnsFrom": [+ "notification_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "notifications_to_monitors_monitor_id_notification_id_pk": {+ "columns": [+ "monitor_id",+ "notification_id"+ ],+ "name": "notifications_to_monitors_monitor_id_notification_id_pk"+ }+ },+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "monitor_status": {+ "name": "monitor_status",+ "columns": {+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "region": {+ "name": "region",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "''"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'active'"+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {+ "monitor_status_idx": {+ "name": "monitor_status_idx",+ "columns": [+ "monitor_id",+ "region"+ ],+ "isUnique": false+ }+ },+ "foreignKeys": {+ "monitor_status_monitor_id_monitor_id_fk": {+ "name": "monitor_status_monitor_id_monitor_id_fk",+ "tableFrom": "monitor_status",+ "tableTo": "monitor",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "monitor_status_monitor_id_region_pk": {+ "columns": [+ "monitor_id",+ "region"+ ],+ "name": "monitor_status_monitor_id_region_pk"+ }+ },+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "invitation": {+ "name": "invitation",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "email": {+ "name": "email",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "role": {+ "name": "role",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'member'"+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "expires_at": {+ "name": "expires_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "accepted_at": {+ "name": "accepted_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {},+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "incident": {+ "name": "incident",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "title": {+ "name": "title",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "''"+ },+ "summary": {+ "name": "summary",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "''"+ },+ "status": {+ "name": "status",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "'triage'"+ },+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "started_at": {+ "name": "started_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "acknowledged_at": {+ "name": "acknowledged_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "acknowledged_by": {+ "name": "acknowledged_by",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "resolved_at": {+ "name": "resolved_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "resolved_by": {+ "name": "resolved_by",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "incident_screenshot_url": {+ "name": "incident_screenshot_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "recovery_screenshot_url": {+ "name": "recovery_screenshot_url",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "auto_resolved": {+ "name": "auto_resolved",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {+ "incident_monitor_id_started_at_unique": {+ "name": "incident_monitor_id_started_at_unique",+ "columns": [+ "monitor_id",+ "started_at"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "incident_monitor_id_monitor_id_fk": {+ "name": "incident_monitor_id_monitor_id_fk",+ "tableFrom": "incident",+ "tableTo": "monitor",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "set default",+ "onUpdate": "no action"+ },+ "incident_workspace_id_workspace_id_fk": {+ "name": "incident_workspace_id_workspace_id_fk",+ "tableFrom": "incident",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "incident_acknowledged_by_user_id_fk": {+ "name": "incident_acknowledged_by_user_id_fk",+ "tableFrom": "incident",+ "tableTo": "user",+ "columnsFrom": [+ "acknowledged_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "incident_resolved_by_user_id_fk": {+ "name": "incident_resolved_by_user_id_fk",+ "tableFrom": "incident",+ "tableTo": "user",+ "columnsFrom": [+ "resolved_by"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "monitor_tag": {+ "name": "monitor_tag",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "color": {+ "name": "color",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "monitor_tag_workspace_id_workspace_id_fk": {+ "name": "monitor_tag_workspace_id_workspace_id_fk",+ "tableFrom": "monitor_tag",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "monitor_tag_to_monitor": {+ "name": "monitor_tag_to_monitor",+ "columns": {+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "monitor_tag_id": {+ "name": "monitor_tag_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "monitor_tag_to_monitor_monitor_id_monitor_id_fk": {+ "name": "monitor_tag_to_monitor_monitor_id_monitor_id_fk",+ "tableFrom": "monitor_tag_to_monitor",+ "tableTo": "monitor",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "monitor_tag_to_monitor_monitor_tag_id_monitor_tag_id_fk": {+ "name": "monitor_tag_to_monitor_monitor_tag_id_monitor_tag_id_fk",+ "tableFrom": "monitor_tag_to_monitor",+ "tableTo": "monitor_tag",+ "columnsFrom": [+ "monitor_tag_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "monitor_tag_to_monitor_monitor_id_monitor_tag_id_pk": {+ "columns": [+ "monitor_id",+ "monitor_tag_id"+ ],+ "name": "monitor_tag_to_monitor_monitor_id_monitor_tag_id_pk"+ }+ },+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "application": {+ "name": "application",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "dsn": {+ "name": "dsn",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {+ "application_dsn_unique": {+ "name": "application_dsn_unique",+ "columns": [+ "dsn"+ ],+ "isUnique": true+ }+ },+ "foreignKeys": {+ "application_workspace_id_workspace_id_fk": {+ "name": "application_workspace_id_workspace_id_fk",+ "tableFrom": "application",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "maintenance": {+ "name": "maintenance",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "title": {+ "name": "title",+ "type": "text(256)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "message": {+ "name": "message",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "from": {+ "name": "from",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "to": {+ "name": "to",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "page_id": {+ "name": "page_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "maintenance_workspace_id_workspace_id_fk": {+ "name": "maintenance_workspace_id_workspace_id_fk",+ "tableFrom": "maintenance",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "maintenance_page_id_page_id_fk": {+ "name": "maintenance_page_id_page_id_fk",+ "tableFrom": "maintenance",+ "tableTo": "page",+ "columnsFrom": [+ "page_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "maintenance_to_monitor": {+ "name": "maintenance_to_monitor",+ "columns": {+ "maintenance_id": {+ "name": "maintenance_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "maintenance_to_monitor_maintenance_id_maintenance_id_fk": {+ "name": "maintenance_to_monitor_maintenance_id_maintenance_id_fk",+ "tableFrom": "maintenance_to_monitor",+ "tableTo": "maintenance",+ "columnsFrom": [+ "maintenance_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "maintenance_to_monitor_monitor_id_monitor_id_fk": {+ "name": "maintenance_to_monitor_monitor_id_monitor_id_fk",+ "tableFrom": "maintenance_to_monitor",+ "tableTo": "monitor",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {+ "maintenance_to_monitor_maintenance_id_monitor_id_pk": {+ "columns": [+ "maintenance_id",+ "monitor_id"+ ],+ "name": "maintenance_to_monitor_maintenance_id_monitor_id_pk"+ }+ },+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "check": {+ "name": "check",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": true+ },+ "regions": {+ "name": "regions",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false,+ "default": "''"+ },+ "url": {+ "name": "url",+ "type": "text(4096)",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "headers": {+ "name": "headers",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "''"+ },+ "body": {+ "name": "body",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "''"+ },+ "method": {+ "name": "method",+ "type": "text",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "'GET'"+ },+ "count_requests": {+ "name": "count_requests",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": 1+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "check_workspace_id_workspace_id_fk": {+ "name": "check_workspace_id_workspace_id_fk",+ "tableFrom": "check",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "monitor_run": {+ "name": "monitor_run",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "runned_at": {+ "name": "runned_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "monitor_run_workspace_id_workspace_id_fk": {+ "name": "monitor_run_workspace_id_workspace_id_fk",+ "tableFrom": "monitor_run",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ },+ "monitor_run_monitor_id_monitor_id_fk": {+ "name": "monitor_run_monitor_id_monitor_id_fk",+ "tableFrom": "monitor_run",+ "tableTo": "monitor",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "private_location": {+ "name": "private_location",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "token": {+ "name": "token",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "last_seen_at": {+ "name": "last_seen_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "private_location_workspace_id_workspace_id_fk": {+ "name": "private_location_workspace_id_workspace_id_fk",+ "tableFrom": "private_location",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "no action",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "private_location_to_monitor": {+ "name": "private_location_to_monitor",+ "columns": {+ "private_location_id": {+ "name": "private_location_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "monitor_id": {+ "name": "monitor_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "deleted_at": {+ "name": "deleted_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false+ }+ },+ "indexes": {},+ "foreignKeys": {+ "private_location_to_monitor_private_location_id_private_location_id_fk": {+ "name": "private_location_to_monitor_private_location_id_private_location_id_fk",+ "tableFrom": "private_location_to_monitor",+ "tableTo": "private_location",+ "columnsFrom": [+ "private_location_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "private_location_to_monitor_monitor_id_monitor_id_fk": {+ "name": "private_location_to_monitor_monitor_id_monitor_id_fk",+ "tableFrom": "private_location_to_monitor",+ "tableTo": "monitor",+ "columnsFrom": [+ "monitor_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ },+ "monitor_group": {+ "name": "monitor_group",+ "columns": {+ "id": {+ "name": "id",+ "type": "integer",+ "primaryKey": true,+ "notNull": true,+ "autoincrement": false+ },+ "workspace_id": {+ "name": "workspace_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "page_id": {+ "name": "page_id",+ "type": "integer",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "name": {+ "name": "name",+ "type": "text",+ "primaryKey": false,+ "notNull": true,+ "autoincrement": false+ },+ "created_at": {+ "name": "created_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ },+ "updated_at": {+ "name": "updated_at",+ "type": "integer",+ "primaryKey": false,+ "notNull": false,+ "autoincrement": false,+ "default": "(strftime('%s', 'now'))"+ }+ },+ "indexes": {},+ "foreignKeys": {+ "monitor_group_workspace_id_workspace_id_fk": {+ "name": "monitor_group_workspace_id_workspace_id_fk",+ "tableFrom": "monitor_group",+ "tableTo": "workspace",+ "columnsFrom": [+ "workspace_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ },+ "monitor_group_page_id_page_id_fk": {+ "name": "monitor_group_page_id_page_id_fk",+ "tableFrom": "monitor_group",+ "tableTo": "page",+ "columnsFrom": [+ "page_id"+ ],+ "columnsTo": [+ "id"+ ],+ "onDelete": "cascade",+ "onUpdate": "no action"+ }+ },+ "compositePrimaryKeys": {},+ "uniqueConstraints": {},+ "checkConstraints": {}+ }+ },+ "views": {},+ "enums": {},+ "_meta": {+ "schemas": {},+ "tables": {},+ "columns": {}+ },+ "internal": {+ "indexes": {}+ }+}\ No newline at end of filediff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.jsonindex ce009ffb6..0532c7f4a 100644--- a/packages/db/drizzle/meta/_journal.json+++ b/packages/db/drizzle/meta/_journal.json@@ -344,6 +344,13 @@"when": 1760602903085,"tag": "0048_neat_tempest","breakpoints": true+ },+ {+ "idx": 49,+ "version": "6",+ "when": 1761901661043,+ "tag": "0049_sloppy_inhumans",+ "breakpoints": true}]}\ No newline at end of filediff --git a/packages/db/src/schema/index.ts b/packages/db/src/schema/index.tsindex da395b0c8..b76344a93 100644--- a/packages/db/src/schema/index.ts+++ b/packages/db/src/schema/index.ts@@ -16,3 +16,4 @@ export * from "./maintenances";export * from "./check";export * from "./monitor_run";export * from "./private_locations";+export * from "./monitor_groups";diff --git a/packages/db/src/schema/monitor_groups/index.ts b/packages/db/src/schema/monitor_groups/index.tsnew file mode 100644index 000000000..184c06cfc--- /dev/null+++ b/packages/db/src/schema/monitor_groups/index.ts@@ -0,0 +1,2 @@+export * from "./monitor_group";+export * from "./validation";diff --git a/packages/db/src/schema/monitor_groups/monitor_group.ts b/packages/db/src/schema/monitor_groups/monitor_group.tsnew file mode 100644index 000000000..da027806f--- /dev/null+++ b/packages/db/src/schema/monitor_groups/monitor_group.ts@@ -0,0 +1,23 @@+import { sql } from "drizzle-orm";+import { integer, sqliteTable, text } from "drizzle-orm/sqlite-core";++import { page } from "../pages";+import { workspace } from "../workspaces";++export const monitorGroup = sqliteTable("monitor_group", {+ id: integer("id").primaryKey(),+ workspaceId: integer("workspace_id")+ .references(() => workspace.id, { onDelete: "cascade" })+ .notNull(),+ pageId: integer("page_id")+ .references(() => page.id, { onDelete: "cascade" })+ .notNull(),+ name: text("name").notNull(),++ createdAt: integer("created_at", { mode: "timestamp" }).default(+ sql`(strftime('%s', 'now'))`,+ ),+ updatedAt: integer("updated_at", { mode: "timestamp" }).default(+ sql`(strftime('%s', 'now'))`,+ ),+});diff --git a/packages/db/src/schema/monitor_groups/validation.ts b/packages/db/src/schema/monitor_groups/validation.tsnew file mode 100644index 000000000..405b1dce6--- /dev/null+++ b/packages/db/src/schema/monitor_groups/validation.ts@@ -0,0 +1,11 @@+import { createInsertSchema, createSelectSchema } from "drizzle-zod";+import type { z } from "zod";++import { monitorGroup } from "./monitor_group";++export const selectMonitorGroupSchema = createSelectSchema(monitorGroup);++export const insertMonitorGroupSchema = createInsertSchema(monitorGroup);++export type InsertMonitorGroup = z.infer<typeof insertMonitorGroupSchema>;+export type MonitorGroup = z.infer<typeof selectMonitorGroupSchema>;diff --git a/packages/db/src/schema/monitors/monitor.ts b/packages/db/src/schema/monitors/monitor.tsindex 107cf0abe..5892627ca 100644--- a/packages/db/src/schema/monitors/monitor.ts+++ b/packages/db/src/schema/monitors/monitor.ts@@ -9,6 +9,7 @@ import {import { monitorPeriodicity } from "../constants";import { incidentTable } from "../incidents/incident";import { maintenancesToMonitors } from "../maintenances";+import { monitorGroup } from "../monitor_groups";import { monitorStatusTable } from "../monitor_status/monitor_status";import { monitorTagsToMonitors } from "../monitor_tags";import { notificationsToMonitors } from "../notifications";@@ -99,6 +100,12 @@ export const monitorsToPages = sqliteTable(sql`(strftime('%s', 'now'))`,),order: integer("order").default(0),++ monitorGroupId: integer("monitor_group_id").references(+ () => monitorGroup.id,+ { onDelete: "cascade" },+ ),+ groupOrder: integer("group_order").default(0),},(t) => ({pk: primaryKey({ columns: [t.monitorId, t.pageId] }),@@ -116,5 +123,9 @@ export const monitorsToPagesRelation = relations(fields: [monitorsToPages.pageId],references: [page.id],}),+ monitorGroup: one(monitorGroup, {+ fields: [monitorsToPages.monitorGroupId],+ references: [monitorGroup.id],+ }),}),);diff --git a/packages/db/src/schema/shared.ts b/packages/db/src/schema/shared.tsindex 725a950b7..22500c9e4 100644--- a/packages/db/src/schema/shared.ts+++ b/packages/db/src/schema/shared.ts@@ -2,6 +2,7 @@ import { z } from "zod";import { selectIncidentSchema } from "./incidents/validation";import { selectMaintenanceSchema } from "./maintenances";+import { selectMonitorGroupSchema } from "./monitor_groups";import { selectMonitorSchema } from "./monitors";import { selectPageSchema } from "./pages";import {@@ -84,16 +85,41 @@ export const legacy_selectPublicPageSchemaWithRelation = selectPageSchemaid: true,});-export const selectPublicPageSchemaWithRelation = selectPageSchema- .extend({- // TODO: include status of the monitor- monitors: selectPublicMonitorSchema- .extend({+const selectPublicMonitorWithStatusSchema = selectPublicMonitorSchema.extend({+ status: z.enum(["success", "degraded", "error", "info"]).default("success"),+ monitorGroupId: z.number().nullable().optional(),+ order: z.number().default(0).optional(),+ groupOrder: z.number().default(0).optional(),+});++const trackersSchema = z+ .array(+ z.discriminatedUnion("type", [+ z.object({+ type: z.literal("monitor"),+ monitor: selectPublicMonitorWithStatusSchema,+ order: z.number(),+ }),+ z.object({+ type: z.literal("group"),+ groupId: z.number(),+ groupName: z.string(),+ monitors: z.array(selectPublicMonitorWithStatusSchema),status: z.enum(["success", "degraded", "error", "info"]).default("success"),- })- .array(),+ order: z.number(),+ }),+ ]),+ )+ .default([]);++export const selectPublicPageSchemaWithRelation = selectPageSchema+ .extend({+ monitorGroups: selectMonitorGroupSchema.array().default([]),+ // TODO: include status of the monitor+ monitors: selectPublicMonitorWithStatusSchema.array(),+ trackers: trackersSchema,lastEvents: z.array(z.object({id: z.number(),