Openstatus www.openstatus.dev

๐Ÿ› notification trigger (#1215)

authored by

Thibault Le Ouay and committed by
GitHub
74c6746a 7b1409f8

+2493 -28
-1
apps/docs/src/components/Head.astro
··· 3 3 4 4 const title = Astro.locals.starlightRoute.title; 5 5 const { siteTitle } = Astro.locals.starlightRoute; 6 - console.log(Astro.locals); 7 6 8 7 const url = `https://openstatus.dev/api/og?title=${siteTitle}&description=${title}`; 9 8 ---
+26
apps/workflows/src/checker/alerting.ts
··· 1 1 import { db, eq, schema } from "@openstatus/db"; 2 2 import type { MonitorStatus } from "@openstatus/db/src/schema"; 3 3 import { 4 + monitor, 4 5 selectMonitorSchema, 5 6 selectNotificationSchema, 6 7 } from "@openstatus/db/src/schema"; ··· 50 51 `๐Ÿ’Œ sending notification for ${monitorId} and chanel ${notif.notification.provider} for ${notifType}`, 51 52 ); 52 53 const monitor = selectMonitorSchema.parse(notif.monitor); 54 + try { 55 + await insertNotificationTrigger({ 56 + monitorId: monitor.id, 57 + notificationId: notif.notification.id, 58 + cronTimestamp: cronTimestamp, 59 + }); 60 + } catch (e) { 61 + console.log("notification trigger already exists dont send again"); 62 + continue; 63 + } 53 64 switch (notifType) { 54 65 case "alert": 55 66 await providerToFunction[notif.notification.provider].sendAlert({ ··· 96 107 }); 97 108 // 98 109 } 110 + }; 111 + 112 + const insertNotificationTrigger = async ({ 113 + monitorId, 114 + notificationId, 115 + cronTimestamp, 116 + }: { monitorId: number; notificationId: number; cronTimestamp: number }) => { 117 + await db 118 + .insert(schema.notificationTrigger) 119 + .values({ 120 + monitorId: Number(monitorId), 121 + notificationId: notificationId, 122 + cronTimestamp: cronTimestamp, 123 + }) 124 + .returning(); 99 125 }; 100 126 101 127 export const upsertMonitorStatus = async ({
+19 -24
apps/workflows/src/checker/index.ts
··· 96 96 if (affectedRegion.count >= numberOfRegions / 2 || numberOfRegions === 1) { 97 97 switch (status) { 98 98 case "active": { 99 - 100 - if(monitor.status!== 'active') { 99 + if (monitor.status !== "active") { 101 100 await db 102 101 .update(schema.monitor) 103 102 .set({ status: "active" }) ··· 134 133 }) 135 134 .where(eq(incidentTable.id, incident.id)) 136 135 .run(); 137 - 138 - 139 136 140 137 await triggerNotifications({ 141 138 monitorId, ··· 186 183 }); 187 184 break; 188 185 case "error": 189 - 190 - if(monitor.status !== 'error') { 191 - await db 192 - .update(schema.monitor) 193 - .set({ status: "error" }) 194 - .where(eq(schema.monitor.id, monitor.id)); 195 - 196 - } 186 + if (monitor.status !== "error") { 187 + await db 188 + .update(schema.monitor) 189 + .set({ status: "error" }) 190 + .where(eq(schema.monitor.id, monitor.id)); 191 + } 197 192 try { 198 193 const incident = await db 199 - .select() 200 - .from(incidentTable) 201 - .where( 202 - and( 203 - eq(incidentTable.monitorId, Number(monitorId)), 204 - isNull(incidentTable.resolvedAt), 205 - isNull(incidentTable.acknowledgedAt), 206 - ), 207 - ) 208 - .get(); 209 - if(incident) { 210 - console.log('we are already in incident') 194 + .select() 195 + .from(incidentTable) 196 + .where( 197 + and( 198 + eq(incidentTable.monitorId, Number(monitorId)), 199 + isNull(incidentTable.resolvedAt), 200 + isNull(incidentTable.acknowledgedAt), 201 + ), 202 + ) 203 + .get(); 204 + if (incident) { 205 + console.log("we are already in incident"); 211 206 break; 212 207 } 213 208 const newIncident = await db
+28
packages/db/drizzle/0041_nasty_jigsaw.sql
··· 1 + CREATE TABLE `notification_trigger` ( 2 + `id` integer PRIMARY KEY NOT NULL, 3 + `monitor_id` integer, 4 + `notification_id` integer, 5 + `cron_timestamp` integer NOT NULL, 6 + FOREIGN KEY (`monitor_id`) REFERENCES `monitor`(`id`) ON UPDATE no action ON DELETE no action, 7 + FOREIGN KEY (`notification_id`) REFERENCES `notification`(`id`) ON UPDATE no action ON DELETE no action 8 + ); 9 + --> statement-breakpoint 10 + CREATE UNIQUE INDEX `notification_id_monitor_id_crontimestampe` ON `notification_trigger` (`notification_id`,`monitor_id`,`cron_timestamp`);--> statement-breakpoint 11 + DROP INDEX IF EXISTS "page_slug_unique";--> statement-breakpoint 12 + DROP INDEX IF EXISTS "workspace_slug_unique";--> statement-breakpoint 13 + DROP INDEX IF EXISTS "workspace_stripe_id_unique";--> statement-breakpoint 14 + DROP INDEX IF EXISTS "workspace_id_dsn_unique";--> statement-breakpoint 15 + DROP INDEX IF EXISTS "user_tenant_id_unique";--> statement-breakpoint 16 + DROP INDEX IF EXISTS "notification_id_monitor_id_crontimestampe";--> statement-breakpoint 17 + DROP INDEX IF EXISTS "monitor_status_idx";--> statement-breakpoint 18 + DROP INDEX IF EXISTS "incident_monitor_id_started_at_unique";--> statement-breakpoint 19 + DROP INDEX IF EXISTS "application_dsn_unique";--> statement-breakpoint 20 + ALTER TABLE `status_report_update` ALTER COLUMN "status" TO "status" text NOT NULL;--> statement-breakpoint 21 + CREATE UNIQUE INDEX `page_slug_unique` ON `page` (`slug`);--> statement-breakpoint 22 + CREATE UNIQUE INDEX `workspace_slug_unique` ON `workspace` (`slug`);--> statement-breakpoint 23 + CREATE UNIQUE INDEX `workspace_stripe_id_unique` ON `workspace` (`stripe_id`);--> statement-breakpoint 24 + CREATE UNIQUE INDEX `workspace_id_dsn_unique` ON `workspace` (`id`,`dsn`);--> statement-breakpoint 25 + CREATE UNIQUE INDEX `user_tenant_id_unique` ON `user` (`tenant_id`);--> statement-breakpoint 26 + CREATE INDEX `monitor_status_idx` ON `monitor_status` (`monitor_id`,`region`);--> statement-breakpoint 27 + CREATE UNIQUE INDEX `incident_monitor_id_started_at_unique` ON `incident` (`monitor_id`,`started_at`);--> statement-breakpoint 28 + CREATE UNIQUE INDEX `application_dsn_unique` ON `application` (`dsn`);
+2393
packages/db/drizzle/meta/0041_snapshot.json
··· 1 + { 2 + "version": "6", 3 + "dialect": "sqlite", 4 + "id": "3c04b245-907b-4ae3-bd0b-73e1ecfc1526", 5 + "prevId": "377a6822-a9c1-48a8-b07a-c18130fa682c", 6 + "tables": { 7 + "status_report_to_monitors": { 8 + "name": "status_report_to_monitors", 9 + "columns": { 10 + "monitor_id": { 11 + "name": "monitor_id", 12 + "type": "integer", 13 + "primaryKey": false, 14 + "notNull": true, 15 + "autoincrement": false 16 + }, 17 + "status_report_id": { 18 + "name": "status_report_id", 19 + "type": "integer", 20 + "primaryKey": false, 21 + "notNull": true, 22 + "autoincrement": false 23 + }, 24 + "created_at": { 25 + "name": "created_at", 26 + "type": "integer", 27 + "primaryKey": false, 28 + "notNull": false, 29 + "autoincrement": false, 30 + "default": "(strftime('%s', 'now'))" 31 + } 32 + }, 33 + "indexes": {}, 34 + "foreignKeys": { 35 + "status_report_to_monitors_monitor_id_monitor_id_fk": { 36 + "name": "status_report_to_monitors_monitor_id_monitor_id_fk", 37 + "tableFrom": "status_report_to_monitors", 38 + "tableTo": "monitor", 39 + "columnsFrom": [ 40 + "monitor_id" 41 + ], 42 + "columnsTo": [ 43 + "id" 44 + ], 45 + "onDelete": "cascade", 46 + "onUpdate": "no action" 47 + }, 48 + "status_report_to_monitors_status_report_id_status_report_id_fk": { 49 + "name": "status_report_to_monitors_status_report_id_status_report_id_fk", 50 + "tableFrom": "status_report_to_monitors", 51 + "tableTo": "status_report", 52 + "columnsFrom": [ 53 + "status_report_id" 54 + ], 55 + "columnsTo": [ 56 + "id" 57 + ], 58 + "onDelete": "cascade", 59 + "onUpdate": "no action" 60 + } 61 + }, 62 + "compositePrimaryKeys": { 63 + "status_report_to_monitors_monitor_id_status_report_id_pk": { 64 + "columns": [ 65 + "monitor_id", 66 + "status_report_id" 67 + ], 68 + "name": "status_report_to_monitors_monitor_id_status_report_id_pk" 69 + } 70 + }, 71 + "uniqueConstraints": {}, 72 + "checkConstraints": {} 73 + }, 74 + "status_report": { 75 + "name": "status_report", 76 + "columns": { 77 + "id": { 78 + "name": "id", 79 + "type": "integer", 80 + "primaryKey": true, 81 + "notNull": true, 82 + "autoincrement": false 83 + }, 84 + "status": { 85 + "name": "status", 86 + "type": "text", 87 + "primaryKey": false, 88 + "notNull": true, 89 + "autoincrement": false 90 + }, 91 + "title": { 92 + "name": "title", 93 + "type": "text(256)", 94 + "primaryKey": false, 95 + "notNull": true, 96 + "autoincrement": false 97 + }, 98 + "workspace_id": { 99 + "name": "workspace_id", 100 + "type": "integer", 101 + "primaryKey": false, 102 + "notNull": false, 103 + "autoincrement": false 104 + }, 105 + "page_id": { 106 + "name": "page_id", 107 + "type": "integer", 108 + "primaryKey": false, 109 + "notNull": false, 110 + "autoincrement": false 111 + }, 112 + "created_at": { 113 + "name": "created_at", 114 + "type": "integer", 115 + "primaryKey": false, 116 + "notNull": false, 117 + "autoincrement": false, 118 + "default": "(strftime('%s', 'now'))" 119 + }, 120 + "updated_at": { 121 + "name": "updated_at", 122 + "type": "integer", 123 + "primaryKey": false, 124 + "notNull": false, 125 + "autoincrement": false, 126 + "default": "(strftime('%s', 'now'))" 127 + } 128 + }, 129 + "indexes": {}, 130 + "foreignKeys": { 131 + "status_report_workspace_id_workspace_id_fk": { 132 + "name": "status_report_workspace_id_workspace_id_fk", 133 + "tableFrom": "status_report", 134 + "tableTo": "workspace", 135 + "columnsFrom": [ 136 + "workspace_id" 137 + ], 138 + "columnsTo": [ 139 + "id" 140 + ], 141 + "onDelete": "no action", 142 + "onUpdate": "no action" 143 + }, 144 + "status_report_page_id_page_id_fk": { 145 + "name": "status_report_page_id_page_id_fk", 146 + "tableFrom": "status_report", 147 + "tableTo": "page", 148 + "columnsFrom": [ 149 + "page_id" 150 + ], 151 + "columnsTo": [ 152 + "id" 153 + ], 154 + "onDelete": "no action", 155 + "onUpdate": "no action" 156 + } 157 + }, 158 + "compositePrimaryKeys": {}, 159 + "uniqueConstraints": {}, 160 + "checkConstraints": {} 161 + }, 162 + "status_report_update": { 163 + "name": "status_report_update", 164 + "columns": { 165 + "id": { 166 + "name": "id", 167 + "type": "integer", 168 + "primaryKey": true, 169 + "notNull": true, 170 + "autoincrement": false 171 + }, 172 + "status": { 173 + "name": "status", 174 + "type": "text", 175 + "primaryKey": false, 176 + "notNull": true, 177 + "autoincrement": false 178 + }, 179 + "date": { 180 + "name": "date", 181 + "type": "integer", 182 + "primaryKey": false, 183 + "notNull": true, 184 + "autoincrement": false 185 + }, 186 + "message": { 187 + "name": "message", 188 + "type": "text", 189 + "primaryKey": false, 190 + "notNull": true, 191 + "autoincrement": false 192 + }, 193 + "status_report_id": { 194 + "name": "status_report_id", 195 + "type": "integer", 196 + "primaryKey": false, 197 + "notNull": true, 198 + "autoincrement": false 199 + }, 200 + "created_at": { 201 + "name": "created_at", 202 + "type": "integer", 203 + "primaryKey": false, 204 + "notNull": false, 205 + "autoincrement": false, 206 + "default": "(strftime('%s', 'now'))" 207 + }, 208 + "updated_at": { 209 + "name": "updated_at", 210 + "type": "integer", 211 + "primaryKey": false, 212 + "notNull": false, 213 + "autoincrement": false, 214 + "default": "(strftime('%s', 'now'))" 215 + } 216 + }, 217 + "indexes": {}, 218 + "foreignKeys": { 219 + "status_report_update_status_report_id_status_report_id_fk": { 220 + "name": "status_report_update_status_report_id_status_report_id_fk", 221 + "tableFrom": "status_report_update", 222 + "tableTo": "status_report", 223 + "columnsFrom": [ 224 + "status_report_id" 225 + ], 226 + "columnsTo": [ 227 + "id" 228 + ], 229 + "onDelete": "cascade", 230 + "onUpdate": "no action" 231 + } 232 + }, 233 + "compositePrimaryKeys": {}, 234 + "uniqueConstraints": {}, 235 + "checkConstraints": {} 236 + }, 237 + "integration": { 238 + "name": "integration", 239 + "columns": { 240 + "id": { 241 + "name": "id", 242 + "type": "integer", 243 + "primaryKey": true, 244 + "notNull": true, 245 + "autoincrement": false 246 + }, 247 + "name": { 248 + "name": "name", 249 + "type": "text(256)", 250 + "primaryKey": false, 251 + "notNull": true, 252 + "autoincrement": false 253 + }, 254 + "workspace_id": { 255 + "name": "workspace_id", 256 + "type": "integer", 257 + "primaryKey": false, 258 + "notNull": false, 259 + "autoincrement": false 260 + }, 261 + "credential": { 262 + "name": "credential", 263 + "type": "text", 264 + "primaryKey": false, 265 + "notNull": false, 266 + "autoincrement": false 267 + }, 268 + "external_id": { 269 + "name": "external_id", 270 + "type": "text", 271 + "primaryKey": false, 272 + "notNull": true, 273 + "autoincrement": false 274 + }, 275 + "created_at": { 276 + "name": "created_at", 277 + "type": "integer", 278 + "primaryKey": false, 279 + "notNull": false, 280 + "autoincrement": false, 281 + "default": "(strftime('%s', 'now'))" 282 + }, 283 + "updated_at": { 284 + "name": "updated_at", 285 + "type": "integer", 286 + "primaryKey": false, 287 + "notNull": false, 288 + "autoincrement": false, 289 + "default": "(strftime('%s', 'now'))" 290 + }, 291 + "data": { 292 + "name": "data", 293 + "type": "text", 294 + "primaryKey": false, 295 + "notNull": true, 296 + "autoincrement": false 297 + } 298 + }, 299 + "indexes": {}, 300 + "foreignKeys": { 301 + "integration_workspace_id_workspace_id_fk": { 302 + "name": "integration_workspace_id_workspace_id_fk", 303 + "tableFrom": "integration", 304 + "tableTo": "workspace", 305 + "columnsFrom": [ 306 + "workspace_id" 307 + ], 308 + "columnsTo": [ 309 + "id" 310 + ], 311 + "onDelete": "no action", 312 + "onUpdate": "no action" 313 + } 314 + }, 315 + "compositePrimaryKeys": {}, 316 + "uniqueConstraints": {}, 317 + "checkConstraints": {} 318 + }, 319 + "page": { 320 + "name": "page", 321 + "columns": { 322 + "id": { 323 + "name": "id", 324 + "type": "integer", 325 + "primaryKey": true, 326 + "notNull": true, 327 + "autoincrement": false 328 + }, 329 + "workspace_id": { 330 + "name": "workspace_id", 331 + "type": "integer", 332 + "primaryKey": false, 333 + "notNull": true, 334 + "autoincrement": false 335 + }, 336 + "title": { 337 + "name": "title", 338 + "type": "text", 339 + "primaryKey": false, 340 + "notNull": true, 341 + "autoincrement": false 342 + }, 343 + "description": { 344 + "name": "description", 345 + "type": "text", 346 + "primaryKey": false, 347 + "notNull": true, 348 + "autoincrement": false 349 + }, 350 + "icon": { 351 + "name": "icon", 352 + "type": "text(256)", 353 + "primaryKey": false, 354 + "notNull": false, 355 + "autoincrement": false, 356 + "default": "''" 357 + }, 358 + "slug": { 359 + "name": "slug", 360 + "type": "text(256)", 361 + "primaryKey": false, 362 + "notNull": true, 363 + "autoincrement": false 364 + }, 365 + "custom_domain": { 366 + "name": "custom_domain", 367 + "type": "text(256)", 368 + "primaryKey": false, 369 + "notNull": true, 370 + "autoincrement": false 371 + }, 372 + "published": { 373 + "name": "published", 374 + "type": "integer", 375 + "primaryKey": false, 376 + "notNull": false, 377 + "autoincrement": false, 378 + "default": false 379 + }, 380 + "password": { 381 + "name": "password", 382 + "type": "text(256)", 383 + "primaryKey": false, 384 + "notNull": false, 385 + "autoincrement": false 386 + }, 387 + "password_protected": { 388 + "name": "password_protected", 389 + "type": "integer", 390 + "primaryKey": false, 391 + "notNull": false, 392 + "autoincrement": false, 393 + "default": false 394 + }, 395 + "show_monitor_values": { 396 + "name": "show_monitor_values", 397 + "type": "integer", 398 + "primaryKey": false, 399 + "notNull": false, 400 + "autoincrement": false, 401 + "default": true 402 + }, 403 + "created_at": { 404 + "name": "created_at", 405 + "type": "integer", 406 + "primaryKey": false, 407 + "notNull": false, 408 + "autoincrement": false, 409 + "default": "(strftime('%s', 'now'))" 410 + }, 411 + "updated_at": { 412 + "name": "updated_at", 413 + "type": "integer", 414 + "primaryKey": false, 415 + "notNull": false, 416 + "autoincrement": false, 417 + "default": "(strftime('%s', 'now'))" 418 + } 419 + }, 420 + "indexes": { 421 + "page_slug_unique": { 422 + "name": "page_slug_unique", 423 + "columns": [ 424 + "slug" 425 + ], 426 + "isUnique": true 427 + } 428 + }, 429 + "foreignKeys": { 430 + "page_workspace_id_workspace_id_fk": { 431 + "name": "page_workspace_id_workspace_id_fk", 432 + "tableFrom": "page", 433 + "tableTo": "workspace", 434 + "columnsFrom": [ 435 + "workspace_id" 436 + ], 437 + "columnsTo": [ 438 + "id" 439 + ], 440 + "onDelete": "cascade", 441 + "onUpdate": "no action" 442 + } 443 + }, 444 + "compositePrimaryKeys": {}, 445 + "uniqueConstraints": {}, 446 + "checkConstraints": {} 447 + }, 448 + "monitor": { 449 + "name": "monitor", 450 + "columns": { 451 + "id": { 452 + "name": "id", 453 + "type": "integer", 454 + "primaryKey": true, 455 + "notNull": true, 456 + "autoincrement": false 457 + }, 458 + "job_type": { 459 + "name": "job_type", 460 + "type": "text", 461 + "primaryKey": false, 462 + "notNull": true, 463 + "autoincrement": false, 464 + "default": "'http'" 465 + }, 466 + "periodicity": { 467 + "name": "periodicity", 468 + "type": "text", 469 + "primaryKey": false, 470 + "notNull": true, 471 + "autoincrement": false, 472 + "default": "'other'" 473 + }, 474 + "status": { 475 + "name": "status", 476 + "type": "text", 477 + "primaryKey": false, 478 + "notNull": true, 479 + "autoincrement": false, 480 + "default": "'active'" 481 + }, 482 + "active": { 483 + "name": "active", 484 + "type": "integer", 485 + "primaryKey": false, 486 + "notNull": false, 487 + "autoincrement": false, 488 + "default": false 489 + }, 490 + "regions": { 491 + "name": "regions", 492 + "type": "text", 493 + "primaryKey": false, 494 + "notNull": true, 495 + "autoincrement": false, 496 + "default": "''" 497 + }, 498 + "url": { 499 + "name": "url", 500 + "type": "text(2048)", 501 + "primaryKey": false, 502 + "notNull": true, 503 + "autoincrement": false 504 + }, 505 + "name": { 506 + "name": "name", 507 + "type": "text(256)", 508 + "primaryKey": false, 509 + "notNull": true, 510 + "autoincrement": false, 511 + "default": "''" 512 + }, 513 + "description": { 514 + "name": "description", 515 + "type": "text", 516 + "primaryKey": false, 517 + "notNull": true, 518 + "autoincrement": false, 519 + "default": "''" 520 + }, 521 + "headers": { 522 + "name": "headers", 523 + "type": "text", 524 + "primaryKey": false, 525 + "notNull": false, 526 + "autoincrement": false, 527 + "default": "''" 528 + }, 529 + "body": { 530 + "name": "body", 531 + "type": "text", 532 + "primaryKey": false, 533 + "notNull": false, 534 + "autoincrement": false, 535 + "default": "''" 536 + }, 537 + "method": { 538 + "name": "method", 539 + "type": "text", 540 + "primaryKey": false, 541 + "notNull": false, 542 + "autoincrement": false, 543 + "default": "'GET'" 544 + }, 545 + "workspace_id": { 546 + "name": "workspace_id", 547 + "type": "integer", 548 + "primaryKey": false, 549 + "notNull": false, 550 + "autoincrement": false 551 + }, 552 + "timeout": { 553 + "name": "timeout", 554 + "type": "integer", 555 + "primaryKey": false, 556 + "notNull": true, 557 + "autoincrement": false, 558 + "default": 45000 559 + }, 560 + "degraded_after": { 561 + "name": "degraded_after", 562 + "type": "integer", 563 + "primaryKey": false, 564 + "notNull": false, 565 + "autoincrement": false 566 + }, 567 + "assertions": { 568 + "name": "assertions", 569 + "type": "text", 570 + "primaryKey": false, 571 + "notNull": false, 572 + "autoincrement": false 573 + }, 574 + "otel_endpoint": { 575 + "name": "otel_endpoint", 576 + "type": "text", 577 + "primaryKey": false, 578 + "notNull": false, 579 + "autoincrement": false 580 + }, 581 + "otel_headers": { 582 + "name": "otel_headers", 583 + "type": "text", 584 + "primaryKey": false, 585 + "notNull": false, 586 + "autoincrement": false 587 + }, 588 + "public": { 589 + "name": "public", 590 + "type": "integer", 591 + "primaryKey": false, 592 + "notNull": false, 593 + "autoincrement": false, 594 + "default": false 595 + }, 596 + "created_at": { 597 + "name": "created_at", 598 + "type": "integer", 599 + "primaryKey": false, 600 + "notNull": false, 601 + "autoincrement": false, 602 + "default": "(strftime('%s', 'now'))" 603 + }, 604 + "updated_at": { 605 + "name": "updated_at", 606 + "type": "integer", 607 + "primaryKey": false, 608 + "notNull": false, 609 + "autoincrement": false, 610 + "default": "(strftime('%s', 'now'))" 611 + }, 612 + "deleted_at": { 613 + "name": "deleted_at", 614 + "type": "integer", 615 + "primaryKey": false, 616 + "notNull": false, 617 + "autoincrement": false 618 + } 619 + }, 620 + "indexes": {}, 621 + "foreignKeys": { 622 + "monitor_workspace_id_workspace_id_fk": { 623 + "name": "monitor_workspace_id_workspace_id_fk", 624 + "tableFrom": "monitor", 625 + "tableTo": "workspace", 626 + "columnsFrom": [ 627 + "workspace_id" 628 + ], 629 + "columnsTo": [ 630 + "id" 631 + ], 632 + "onDelete": "no action", 633 + "onUpdate": "no action" 634 + } 635 + }, 636 + "compositePrimaryKeys": {}, 637 + "uniqueConstraints": {}, 638 + "checkConstraints": {} 639 + }, 640 + "monitors_to_pages": { 641 + "name": "monitors_to_pages", 642 + "columns": { 643 + "monitor_id": { 644 + "name": "monitor_id", 645 + "type": "integer", 646 + "primaryKey": false, 647 + "notNull": true, 648 + "autoincrement": false 649 + }, 650 + "page_id": { 651 + "name": "page_id", 652 + "type": "integer", 653 + "primaryKey": false, 654 + "notNull": true, 655 + "autoincrement": false 656 + }, 657 + "created_at": { 658 + "name": "created_at", 659 + "type": "integer", 660 + "primaryKey": false, 661 + "notNull": false, 662 + "autoincrement": false, 663 + "default": "(strftime('%s', 'now'))" 664 + }, 665 + "order": { 666 + "name": "order", 667 + "type": "integer", 668 + "primaryKey": false, 669 + "notNull": false, 670 + "autoincrement": false, 671 + "default": 0 672 + } 673 + }, 674 + "indexes": {}, 675 + "foreignKeys": { 676 + "monitors_to_pages_monitor_id_monitor_id_fk": { 677 + "name": "monitors_to_pages_monitor_id_monitor_id_fk", 678 + "tableFrom": "monitors_to_pages", 679 + "tableTo": "monitor", 680 + "columnsFrom": [ 681 + "monitor_id" 682 + ], 683 + "columnsTo": [ 684 + "id" 685 + ], 686 + "onDelete": "cascade", 687 + "onUpdate": "no action" 688 + }, 689 + "monitors_to_pages_page_id_page_id_fk": { 690 + "name": "monitors_to_pages_page_id_page_id_fk", 691 + "tableFrom": "monitors_to_pages", 692 + "tableTo": "page", 693 + "columnsFrom": [ 694 + "page_id" 695 + ], 696 + "columnsTo": [ 697 + "id" 698 + ], 699 + "onDelete": "cascade", 700 + "onUpdate": "no action" 701 + } 702 + }, 703 + "compositePrimaryKeys": { 704 + "monitors_to_pages_monitor_id_page_id_pk": { 705 + "columns": [ 706 + "monitor_id", 707 + "page_id" 708 + ], 709 + "name": "monitors_to_pages_monitor_id_page_id_pk" 710 + } 711 + }, 712 + "uniqueConstraints": {}, 713 + "checkConstraints": {} 714 + }, 715 + "workspace": { 716 + "name": "workspace", 717 + "columns": { 718 + "id": { 719 + "name": "id", 720 + "type": "integer", 721 + "primaryKey": true, 722 + "notNull": true, 723 + "autoincrement": false 724 + }, 725 + "slug": { 726 + "name": "slug", 727 + "type": "text", 728 + "primaryKey": false, 729 + "notNull": true, 730 + "autoincrement": false 731 + }, 732 + "name": { 733 + "name": "name", 734 + "type": "text", 735 + "primaryKey": false, 736 + "notNull": false, 737 + "autoincrement": false 738 + }, 739 + "stripe_id": { 740 + "name": "stripe_id", 741 + "type": "text(256)", 742 + "primaryKey": false, 743 + "notNull": false, 744 + "autoincrement": false 745 + }, 746 + "subscription_id": { 747 + "name": "subscription_id", 748 + "type": "text", 749 + "primaryKey": false, 750 + "notNull": false, 751 + "autoincrement": false 752 + }, 753 + "plan": { 754 + "name": "plan", 755 + "type": "text", 756 + "primaryKey": false, 757 + "notNull": false, 758 + "autoincrement": false 759 + }, 760 + "ends_at": { 761 + "name": "ends_at", 762 + "type": "integer", 763 + "primaryKey": false, 764 + "notNull": false, 765 + "autoincrement": false 766 + }, 767 + "paid_until": { 768 + "name": "paid_until", 769 + "type": "integer", 770 + "primaryKey": false, 771 + "notNull": false, 772 + "autoincrement": false 773 + }, 774 + "limits": { 775 + "name": "limits", 776 + "type": "text", 777 + "primaryKey": false, 778 + "notNull": true, 779 + "autoincrement": false, 780 + "default": "'{}'" 781 + }, 782 + "created_at": { 783 + "name": "created_at", 784 + "type": "integer", 785 + "primaryKey": false, 786 + "notNull": false, 787 + "autoincrement": false, 788 + "default": "(strftime('%s', 'now'))" 789 + }, 790 + "updated_at": { 791 + "name": "updated_at", 792 + "type": "integer", 793 + "primaryKey": false, 794 + "notNull": false, 795 + "autoincrement": false, 796 + "default": "(strftime('%s', 'now'))" 797 + }, 798 + "dsn": { 799 + "name": "dsn", 800 + "type": "text", 801 + "primaryKey": false, 802 + "notNull": false, 803 + "autoincrement": false 804 + } 805 + }, 806 + "indexes": { 807 + "workspace_slug_unique": { 808 + "name": "workspace_slug_unique", 809 + "columns": [ 810 + "slug" 811 + ], 812 + "isUnique": true 813 + }, 814 + "workspace_stripe_id_unique": { 815 + "name": "workspace_stripe_id_unique", 816 + "columns": [ 817 + "stripe_id" 818 + ], 819 + "isUnique": true 820 + }, 821 + "workspace_id_dsn_unique": { 822 + "name": "workspace_id_dsn_unique", 823 + "columns": [ 824 + "id", 825 + "dsn" 826 + ], 827 + "isUnique": true 828 + } 829 + }, 830 + "foreignKeys": {}, 831 + "compositePrimaryKeys": {}, 832 + "uniqueConstraints": {}, 833 + "checkConstraints": {} 834 + }, 835 + "account": { 836 + "name": "account", 837 + "columns": { 838 + "user_id": { 839 + "name": "user_id", 840 + "type": "integer", 841 + "primaryKey": false, 842 + "notNull": true, 843 + "autoincrement": false 844 + }, 845 + "type": { 846 + "name": "type", 847 + "type": "text", 848 + "primaryKey": false, 849 + "notNull": true, 850 + "autoincrement": false 851 + }, 852 + "provider": { 853 + "name": "provider", 854 + "type": "text", 855 + "primaryKey": false, 856 + "notNull": true, 857 + "autoincrement": false 858 + }, 859 + "provider_account_id": { 860 + "name": "provider_account_id", 861 + "type": "text", 862 + "primaryKey": false, 863 + "notNull": true, 864 + "autoincrement": false 865 + }, 866 + "refresh_token": { 867 + "name": "refresh_token", 868 + "type": "text", 869 + "primaryKey": false, 870 + "notNull": false, 871 + "autoincrement": false 872 + }, 873 + "access_token": { 874 + "name": "access_token", 875 + "type": "text", 876 + "primaryKey": false, 877 + "notNull": false, 878 + "autoincrement": false 879 + }, 880 + "expires_at": { 881 + "name": "expires_at", 882 + "type": "integer", 883 + "primaryKey": false, 884 + "notNull": false, 885 + "autoincrement": false 886 + }, 887 + "token_type": { 888 + "name": "token_type", 889 + "type": "text", 890 + "primaryKey": false, 891 + "notNull": false, 892 + "autoincrement": false 893 + }, 894 + "scope": { 895 + "name": "scope", 896 + "type": "text", 897 + "primaryKey": false, 898 + "notNull": false, 899 + "autoincrement": false 900 + }, 901 + "id_token": { 902 + "name": "id_token", 903 + "type": "text", 904 + "primaryKey": false, 905 + "notNull": false, 906 + "autoincrement": false 907 + }, 908 + "session_state": { 909 + "name": "session_state", 910 + "type": "text", 911 + "primaryKey": false, 912 + "notNull": false, 913 + "autoincrement": false 914 + } 915 + }, 916 + "indexes": {}, 917 + "foreignKeys": { 918 + "account_user_id_user_id_fk": { 919 + "name": "account_user_id_user_id_fk", 920 + "tableFrom": "account", 921 + "tableTo": "user", 922 + "columnsFrom": [ 923 + "user_id" 924 + ], 925 + "columnsTo": [ 926 + "id" 927 + ], 928 + "onDelete": "cascade", 929 + "onUpdate": "no action" 930 + } 931 + }, 932 + "compositePrimaryKeys": { 933 + "account_provider_provider_account_id_pk": { 934 + "columns": [ 935 + "provider", 936 + "provider_account_id" 937 + ], 938 + "name": "account_provider_provider_account_id_pk" 939 + } 940 + }, 941 + "uniqueConstraints": {}, 942 + "checkConstraints": {} 943 + }, 944 + "session": { 945 + "name": "session", 946 + "columns": { 947 + "session_token": { 948 + "name": "session_token", 949 + "type": "text", 950 + "primaryKey": true, 951 + "notNull": true, 952 + "autoincrement": false 953 + }, 954 + "user_id": { 955 + "name": "user_id", 956 + "type": "integer", 957 + "primaryKey": false, 958 + "notNull": true, 959 + "autoincrement": false 960 + }, 961 + "expires": { 962 + "name": "expires", 963 + "type": "integer", 964 + "primaryKey": false, 965 + "notNull": true, 966 + "autoincrement": false 967 + } 968 + }, 969 + "indexes": {}, 970 + "foreignKeys": { 971 + "session_user_id_user_id_fk": { 972 + "name": "session_user_id_user_id_fk", 973 + "tableFrom": "session", 974 + "tableTo": "user", 975 + "columnsFrom": [ 976 + "user_id" 977 + ], 978 + "columnsTo": [ 979 + "id" 980 + ], 981 + "onDelete": "cascade", 982 + "onUpdate": "no action" 983 + } 984 + }, 985 + "compositePrimaryKeys": {}, 986 + "uniqueConstraints": {}, 987 + "checkConstraints": {} 988 + }, 989 + "user": { 990 + "name": "user", 991 + "columns": { 992 + "id": { 993 + "name": "id", 994 + "type": "integer", 995 + "primaryKey": true, 996 + "notNull": true, 997 + "autoincrement": false 998 + }, 999 + "tenant_id": { 1000 + "name": "tenant_id", 1001 + "type": "text(256)", 1002 + "primaryKey": false, 1003 + "notNull": false, 1004 + "autoincrement": false 1005 + }, 1006 + "first_name": { 1007 + "name": "first_name", 1008 + "type": "text", 1009 + "primaryKey": false, 1010 + "notNull": false, 1011 + "autoincrement": false, 1012 + "default": "''" 1013 + }, 1014 + "last_name": { 1015 + "name": "last_name", 1016 + "type": "text", 1017 + "primaryKey": false, 1018 + "notNull": false, 1019 + "autoincrement": false, 1020 + "default": "''" 1021 + }, 1022 + "photo_url": { 1023 + "name": "photo_url", 1024 + "type": "text", 1025 + "primaryKey": false, 1026 + "notNull": false, 1027 + "autoincrement": false, 1028 + "default": "''" 1029 + }, 1030 + "name": { 1031 + "name": "name", 1032 + "type": "text", 1033 + "primaryKey": false, 1034 + "notNull": false, 1035 + "autoincrement": false 1036 + }, 1037 + "email": { 1038 + "name": "email", 1039 + "type": "text", 1040 + "primaryKey": false, 1041 + "notNull": false, 1042 + "autoincrement": false, 1043 + "default": "''" 1044 + }, 1045 + "emailVerified": { 1046 + "name": "emailVerified", 1047 + "type": "integer", 1048 + "primaryKey": false, 1049 + "notNull": false, 1050 + "autoincrement": false 1051 + }, 1052 + "created_at": { 1053 + "name": "created_at", 1054 + "type": "integer", 1055 + "primaryKey": false, 1056 + "notNull": false, 1057 + "autoincrement": false, 1058 + "default": "(strftime('%s', 'now'))" 1059 + }, 1060 + "updated_at": { 1061 + "name": "updated_at", 1062 + "type": "integer", 1063 + "primaryKey": false, 1064 + "notNull": false, 1065 + "autoincrement": false, 1066 + "default": "(strftime('%s', 'now'))" 1067 + } 1068 + }, 1069 + "indexes": { 1070 + "user_tenant_id_unique": { 1071 + "name": "user_tenant_id_unique", 1072 + "columns": [ 1073 + "tenant_id" 1074 + ], 1075 + "isUnique": true 1076 + } 1077 + }, 1078 + "foreignKeys": {}, 1079 + "compositePrimaryKeys": {}, 1080 + "uniqueConstraints": {}, 1081 + "checkConstraints": {} 1082 + }, 1083 + "users_to_workspaces": { 1084 + "name": "users_to_workspaces", 1085 + "columns": { 1086 + "user_id": { 1087 + "name": "user_id", 1088 + "type": "integer", 1089 + "primaryKey": false, 1090 + "notNull": true, 1091 + "autoincrement": false 1092 + }, 1093 + "workspace_id": { 1094 + "name": "workspace_id", 1095 + "type": "integer", 1096 + "primaryKey": false, 1097 + "notNull": true, 1098 + "autoincrement": false 1099 + }, 1100 + "role": { 1101 + "name": "role", 1102 + "type": "text", 1103 + "primaryKey": false, 1104 + "notNull": true, 1105 + "autoincrement": false, 1106 + "default": "'member'" 1107 + }, 1108 + "created_at": { 1109 + "name": "created_at", 1110 + "type": "integer", 1111 + "primaryKey": false, 1112 + "notNull": false, 1113 + "autoincrement": false, 1114 + "default": "(strftime('%s', 'now'))" 1115 + } 1116 + }, 1117 + "indexes": {}, 1118 + "foreignKeys": { 1119 + "users_to_workspaces_user_id_user_id_fk": { 1120 + "name": "users_to_workspaces_user_id_user_id_fk", 1121 + "tableFrom": "users_to_workspaces", 1122 + "tableTo": "user", 1123 + "columnsFrom": [ 1124 + "user_id" 1125 + ], 1126 + "columnsTo": [ 1127 + "id" 1128 + ], 1129 + "onDelete": "no action", 1130 + "onUpdate": "no action" 1131 + }, 1132 + "users_to_workspaces_workspace_id_workspace_id_fk": { 1133 + "name": "users_to_workspaces_workspace_id_workspace_id_fk", 1134 + "tableFrom": "users_to_workspaces", 1135 + "tableTo": "workspace", 1136 + "columnsFrom": [ 1137 + "workspace_id" 1138 + ], 1139 + "columnsTo": [ 1140 + "id" 1141 + ], 1142 + "onDelete": "no action", 1143 + "onUpdate": "no action" 1144 + } 1145 + }, 1146 + "compositePrimaryKeys": { 1147 + "users_to_workspaces_user_id_workspace_id_pk": { 1148 + "columns": [ 1149 + "user_id", 1150 + "workspace_id" 1151 + ], 1152 + "name": "users_to_workspaces_user_id_workspace_id_pk" 1153 + } 1154 + }, 1155 + "uniqueConstraints": {}, 1156 + "checkConstraints": {} 1157 + }, 1158 + "verification_token": { 1159 + "name": "verification_token", 1160 + "columns": { 1161 + "identifier": { 1162 + "name": "identifier", 1163 + "type": "text", 1164 + "primaryKey": false, 1165 + "notNull": true, 1166 + "autoincrement": false 1167 + }, 1168 + "token": { 1169 + "name": "token", 1170 + "type": "text", 1171 + "primaryKey": false, 1172 + "notNull": true, 1173 + "autoincrement": false 1174 + }, 1175 + "expires": { 1176 + "name": "expires", 1177 + "type": "integer", 1178 + "primaryKey": false, 1179 + "notNull": true, 1180 + "autoincrement": false 1181 + } 1182 + }, 1183 + "indexes": {}, 1184 + "foreignKeys": {}, 1185 + "compositePrimaryKeys": { 1186 + "verification_token_identifier_token_pk": { 1187 + "columns": [ 1188 + "identifier", 1189 + "token" 1190 + ], 1191 + "name": "verification_token_identifier_token_pk" 1192 + } 1193 + }, 1194 + "uniqueConstraints": {}, 1195 + "checkConstraints": {} 1196 + }, 1197 + "page_subscriber": { 1198 + "name": "page_subscriber", 1199 + "columns": { 1200 + "id": { 1201 + "name": "id", 1202 + "type": "integer", 1203 + "primaryKey": true, 1204 + "notNull": true, 1205 + "autoincrement": false 1206 + }, 1207 + "email": { 1208 + "name": "email", 1209 + "type": "text", 1210 + "primaryKey": false, 1211 + "notNull": true, 1212 + "autoincrement": false 1213 + }, 1214 + "page_id": { 1215 + "name": "page_id", 1216 + "type": "integer", 1217 + "primaryKey": false, 1218 + "notNull": true, 1219 + "autoincrement": false 1220 + }, 1221 + "token": { 1222 + "name": "token", 1223 + "type": "text", 1224 + "primaryKey": false, 1225 + "notNull": false, 1226 + "autoincrement": false 1227 + }, 1228 + "accepted_at": { 1229 + "name": "accepted_at", 1230 + "type": "integer", 1231 + "primaryKey": false, 1232 + "notNull": false, 1233 + "autoincrement": false 1234 + }, 1235 + "expires_at": { 1236 + "name": "expires_at", 1237 + "type": "integer", 1238 + "primaryKey": false, 1239 + "notNull": false, 1240 + "autoincrement": false 1241 + }, 1242 + "created_at": { 1243 + "name": "created_at", 1244 + "type": "integer", 1245 + "primaryKey": false, 1246 + "notNull": false, 1247 + "autoincrement": false, 1248 + "default": "(strftime('%s', 'now'))" 1249 + }, 1250 + "updated_at": { 1251 + "name": "updated_at", 1252 + "type": "integer", 1253 + "primaryKey": false, 1254 + "notNull": false, 1255 + "autoincrement": false, 1256 + "default": "(strftime('%s', 'now'))" 1257 + } 1258 + }, 1259 + "indexes": {}, 1260 + "foreignKeys": { 1261 + "page_subscriber_page_id_page_id_fk": { 1262 + "name": "page_subscriber_page_id_page_id_fk", 1263 + "tableFrom": "page_subscriber", 1264 + "tableTo": "page", 1265 + "columnsFrom": [ 1266 + "page_id" 1267 + ], 1268 + "columnsTo": [ 1269 + "id" 1270 + ], 1271 + "onDelete": "cascade", 1272 + "onUpdate": "no action" 1273 + } 1274 + }, 1275 + "compositePrimaryKeys": {}, 1276 + "uniqueConstraints": {}, 1277 + "checkConstraints": {} 1278 + }, 1279 + "notification": { 1280 + "name": "notification", 1281 + "columns": { 1282 + "id": { 1283 + "name": "id", 1284 + "type": "integer", 1285 + "primaryKey": true, 1286 + "notNull": true, 1287 + "autoincrement": false 1288 + }, 1289 + "name": { 1290 + "name": "name", 1291 + "type": "text", 1292 + "primaryKey": false, 1293 + "notNull": true, 1294 + "autoincrement": false 1295 + }, 1296 + "provider": { 1297 + "name": "provider", 1298 + "type": "text", 1299 + "primaryKey": false, 1300 + "notNull": true, 1301 + "autoincrement": false 1302 + }, 1303 + "data": { 1304 + "name": "data", 1305 + "type": "text", 1306 + "primaryKey": false, 1307 + "notNull": false, 1308 + "autoincrement": false, 1309 + "default": "'{}'" 1310 + }, 1311 + "workspace_id": { 1312 + "name": "workspace_id", 1313 + "type": "integer", 1314 + "primaryKey": false, 1315 + "notNull": false, 1316 + "autoincrement": false 1317 + }, 1318 + "created_at": { 1319 + "name": "created_at", 1320 + "type": "integer", 1321 + "primaryKey": false, 1322 + "notNull": false, 1323 + "autoincrement": false, 1324 + "default": "(strftime('%s', 'now'))" 1325 + }, 1326 + "updated_at": { 1327 + "name": "updated_at", 1328 + "type": "integer", 1329 + "primaryKey": false, 1330 + "notNull": false, 1331 + "autoincrement": false, 1332 + "default": "(strftime('%s', 'now'))" 1333 + } 1334 + }, 1335 + "indexes": {}, 1336 + "foreignKeys": { 1337 + "notification_workspace_id_workspace_id_fk": { 1338 + "name": "notification_workspace_id_workspace_id_fk", 1339 + "tableFrom": "notification", 1340 + "tableTo": "workspace", 1341 + "columnsFrom": [ 1342 + "workspace_id" 1343 + ], 1344 + "columnsTo": [ 1345 + "id" 1346 + ], 1347 + "onDelete": "no action", 1348 + "onUpdate": "no action" 1349 + } 1350 + }, 1351 + "compositePrimaryKeys": {}, 1352 + "uniqueConstraints": {}, 1353 + "checkConstraints": {} 1354 + }, 1355 + "notification_trigger": { 1356 + "name": "notification_trigger", 1357 + "columns": { 1358 + "id": { 1359 + "name": "id", 1360 + "type": "integer", 1361 + "primaryKey": true, 1362 + "notNull": true, 1363 + "autoincrement": false 1364 + }, 1365 + "monitor_id": { 1366 + "name": "monitor_id", 1367 + "type": "integer", 1368 + "primaryKey": false, 1369 + "notNull": false, 1370 + "autoincrement": false 1371 + }, 1372 + "notification_id": { 1373 + "name": "notification_id", 1374 + "type": "integer", 1375 + "primaryKey": false, 1376 + "notNull": false, 1377 + "autoincrement": false 1378 + }, 1379 + "cron_timestamp": { 1380 + "name": "cron_timestamp", 1381 + "type": "integer", 1382 + "primaryKey": false, 1383 + "notNull": true, 1384 + "autoincrement": false 1385 + } 1386 + }, 1387 + "indexes": { 1388 + "notification_id_monitor_id_crontimestampe": { 1389 + "name": "notification_id_monitor_id_crontimestampe", 1390 + "columns": [ 1391 + "notification_id", 1392 + "monitor_id", 1393 + "cron_timestamp" 1394 + ], 1395 + "isUnique": true 1396 + } 1397 + }, 1398 + "foreignKeys": { 1399 + "notification_trigger_monitor_id_monitor_id_fk": { 1400 + "name": "notification_trigger_monitor_id_monitor_id_fk", 1401 + "tableFrom": "notification_trigger", 1402 + "tableTo": "monitor", 1403 + "columnsFrom": [ 1404 + "monitor_id" 1405 + ], 1406 + "columnsTo": [ 1407 + "id" 1408 + ], 1409 + "onDelete": "no action", 1410 + "onUpdate": "no action" 1411 + }, 1412 + "notification_trigger_notification_id_notification_id_fk": { 1413 + "name": "notification_trigger_notification_id_notification_id_fk", 1414 + "tableFrom": "notification_trigger", 1415 + "tableTo": "notification", 1416 + "columnsFrom": [ 1417 + "notification_id" 1418 + ], 1419 + "columnsTo": [ 1420 + "id" 1421 + ], 1422 + "onDelete": "no action", 1423 + "onUpdate": "no action" 1424 + } 1425 + }, 1426 + "compositePrimaryKeys": {}, 1427 + "uniqueConstraints": {}, 1428 + "checkConstraints": {} 1429 + }, 1430 + "notifications_to_monitors": { 1431 + "name": "notifications_to_monitors", 1432 + "columns": { 1433 + "monitor_id": { 1434 + "name": "monitor_id", 1435 + "type": "integer", 1436 + "primaryKey": false, 1437 + "notNull": true, 1438 + "autoincrement": false 1439 + }, 1440 + "notification_id": { 1441 + "name": "notification_id", 1442 + "type": "integer", 1443 + "primaryKey": false, 1444 + "notNull": true, 1445 + "autoincrement": false 1446 + }, 1447 + "created_at": { 1448 + "name": "created_at", 1449 + "type": "integer", 1450 + "primaryKey": false, 1451 + "notNull": false, 1452 + "autoincrement": false, 1453 + "default": "(strftime('%s', 'now'))" 1454 + } 1455 + }, 1456 + "indexes": {}, 1457 + "foreignKeys": { 1458 + "notifications_to_monitors_monitor_id_monitor_id_fk": { 1459 + "name": "notifications_to_monitors_monitor_id_monitor_id_fk", 1460 + "tableFrom": "notifications_to_monitors", 1461 + "tableTo": "monitor", 1462 + "columnsFrom": [ 1463 + "monitor_id" 1464 + ], 1465 + "columnsTo": [ 1466 + "id" 1467 + ], 1468 + "onDelete": "cascade", 1469 + "onUpdate": "no action" 1470 + }, 1471 + "notifications_to_monitors_notification_id_notification_id_fk": { 1472 + "name": "notifications_to_monitors_notification_id_notification_id_fk", 1473 + "tableFrom": "notifications_to_monitors", 1474 + "tableTo": "notification", 1475 + "columnsFrom": [ 1476 + "notification_id" 1477 + ], 1478 + "columnsTo": [ 1479 + "id" 1480 + ], 1481 + "onDelete": "cascade", 1482 + "onUpdate": "no action" 1483 + } 1484 + }, 1485 + "compositePrimaryKeys": { 1486 + "notifications_to_monitors_monitor_id_notification_id_pk": { 1487 + "columns": [ 1488 + "monitor_id", 1489 + "notification_id" 1490 + ], 1491 + "name": "notifications_to_monitors_monitor_id_notification_id_pk" 1492 + } 1493 + }, 1494 + "uniqueConstraints": {}, 1495 + "checkConstraints": {} 1496 + }, 1497 + "monitor_status": { 1498 + "name": "monitor_status", 1499 + "columns": { 1500 + "monitor_id": { 1501 + "name": "monitor_id", 1502 + "type": "integer", 1503 + "primaryKey": false, 1504 + "notNull": true, 1505 + "autoincrement": false 1506 + }, 1507 + "region": { 1508 + "name": "region", 1509 + "type": "text", 1510 + "primaryKey": false, 1511 + "notNull": true, 1512 + "autoincrement": false, 1513 + "default": "''" 1514 + }, 1515 + "status": { 1516 + "name": "status", 1517 + "type": "text", 1518 + "primaryKey": false, 1519 + "notNull": true, 1520 + "autoincrement": false, 1521 + "default": "'active'" 1522 + }, 1523 + "created_at": { 1524 + "name": "created_at", 1525 + "type": "integer", 1526 + "primaryKey": false, 1527 + "notNull": false, 1528 + "autoincrement": false, 1529 + "default": "(strftime('%s', 'now'))" 1530 + }, 1531 + "updated_at": { 1532 + "name": "updated_at", 1533 + "type": "integer", 1534 + "primaryKey": false, 1535 + "notNull": false, 1536 + "autoincrement": false, 1537 + "default": "(strftime('%s', 'now'))" 1538 + } 1539 + }, 1540 + "indexes": { 1541 + "monitor_status_idx": { 1542 + "name": "monitor_status_idx", 1543 + "columns": [ 1544 + "monitor_id", 1545 + "region" 1546 + ], 1547 + "isUnique": false 1548 + } 1549 + }, 1550 + "foreignKeys": { 1551 + "monitor_status_monitor_id_monitor_id_fk": { 1552 + "name": "monitor_status_monitor_id_monitor_id_fk", 1553 + "tableFrom": "monitor_status", 1554 + "tableTo": "monitor", 1555 + "columnsFrom": [ 1556 + "monitor_id" 1557 + ], 1558 + "columnsTo": [ 1559 + "id" 1560 + ], 1561 + "onDelete": "cascade", 1562 + "onUpdate": "no action" 1563 + } 1564 + }, 1565 + "compositePrimaryKeys": { 1566 + "monitor_status_monitor_id_region_pk": { 1567 + "columns": [ 1568 + "monitor_id", 1569 + "region" 1570 + ], 1571 + "name": "monitor_status_monitor_id_region_pk" 1572 + } 1573 + }, 1574 + "uniqueConstraints": {}, 1575 + "checkConstraints": {} 1576 + }, 1577 + "invitation": { 1578 + "name": "invitation", 1579 + "columns": { 1580 + "id": { 1581 + "name": "id", 1582 + "type": "integer", 1583 + "primaryKey": true, 1584 + "notNull": true, 1585 + "autoincrement": false 1586 + }, 1587 + "email": { 1588 + "name": "email", 1589 + "type": "text", 1590 + "primaryKey": false, 1591 + "notNull": true, 1592 + "autoincrement": false 1593 + }, 1594 + "role": { 1595 + "name": "role", 1596 + "type": "text", 1597 + "primaryKey": false, 1598 + "notNull": true, 1599 + "autoincrement": false, 1600 + "default": "'member'" 1601 + }, 1602 + "workspace_id": { 1603 + "name": "workspace_id", 1604 + "type": "integer", 1605 + "primaryKey": false, 1606 + "notNull": true, 1607 + "autoincrement": false 1608 + }, 1609 + "token": { 1610 + "name": "token", 1611 + "type": "text", 1612 + "primaryKey": false, 1613 + "notNull": true, 1614 + "autoincrement": false 1615 + }, 1616 + "expires_at": { 1617 + "name": "expires_at", 1618 + "type": "integer", 1619 + "primaryKey": false, 1620 + "notNull": true, 1621 + "autoincrement": false 1622 + }, 1623 + "created_at": { 1624 + "name": "created_at", 1625 + "type": "integer", 1626 + "primaryKey": false, 1627 + "notNull": false, 1628 + "autoincrement": false, 1629 + "default": "(strftime('%s', 'now'))" 1630 + }, 1631 + "accepted_at": { 1632 + "name": "accepted_at", 1633 + "type": "integer", 1634 + "primaryKey": false, 1635 + "notNull": false, 1636 + "autoincrement": false 1637 + } 1638 + }, 1639 + "indexes": {}, 1640 + "foreignKeys": {}, 1641 + "compositePrimaryKeys": {}, 1642 + "uniqueConstraints": {}, 1643 + "checkConstraints": {} 1644 + }, 1645 + "incident": { 1646 + "name": "incident", 1647 + "columns": { 1648 + "id": { 1649 + "name": "id", 1650 + "type": "integer", 1651 + "primaryKey": true, 1652 + "notNull": true, 1653 + "autoincrement": false 1654 + }, 1655 + "title": { 1656 + "name": "title", 1657 + "type": "text", 1658 + "primaryKey": false, 1659 + "notNull": true, 1660 + "autoincrement": false, 1661 + "default": "''" 1662 + }, 1663 + "summary": { 1664 + "name": "summary", 1665 + "type": "text", 1666 + "primaryKey": false, 1667 + "notNull": true, 1668 + "autoincrement": false, 1669 + "default": "''" 1670 + }, 1671 + "status": { 1672 + "name": "status", 1673 + "type": "text", 1674 + "primaryKey": false, 1675 + "notNull": true, 1676 + "autoincrement": false, 1677 + "default": "'triage'" 1678 + }, 1679 + "monitor_id": { 1680 + "name": "monitor_id", 1681 + "type": "integer", 1682 + "primaryKey": false, 1683 + "notNull": false, 1684 + "autoincrement": false 1685 + }, 1686 + "workspace_id": { 1687 + "name": "workspace_id", 1688 + "type": "integer", 1689 + "primaryKey": false, 1690 + "notNull": false, 1691 + "autoincrement": false 1692 + }, 1693 + "started_at": { 1694 + "name": "started_at", 1695 + "type": "integer", 1696 + "primaryKey": false, 1697 + "notNull": true, 1698 + "autoincrement": false, 1699 + "default": "(strftime('%s', 'now'))" 1700 + }, 1701 + "acknowledged_at": { 1702 + "name": "acknowledged_at", 1703 + "type": "integer", 1704 + "primaryKey": false, 1705 + "notNull": false, 1706 + "autoincrement": false 1707 + }, 1708 + "acknowledged_by": { 1709 + "name": "acknowledged_by", 1710 + "type": "integer", 1711 + "primaryKey": false, 1712 + "notNull": false, 1713 + "autoincrement": false 1714 + }, 1715 + "resolved_at": { 1716 + "name": "resolved_at", 1717 + "type": "integer", 1718 + "primaryKey": false, 1719 + "notNull": false, 1720 + "autoincrement": false 1721 + }, 1722 + "resolved_by": { 1723 + "name": "resolved_by", 1724 + "type": "integer", 1725 + "primaryKey": false, 1726 + "notNull": false, 1727 + "autoincrement": false 1728 + }, 1729 + "incident_screenshot_url": { 1730 + "name": "incident_screenshot_url", 1731 + "type": "text", 1732 + "primaryKey": false, 1733 + "notNull": false, 1734 + "autoincrement": false 1735 + }, 1736 + "recovery_screenshot_url": { 1737 + "name": "recovery_screenshot_url", 1738 + "type": "text", 1739 + "primaryKey": false, 1740 + "notNull": false, 1741 + "autoincrement": false 1742 + }, 1743 + "auto_resolved": { 1744 + "name": "auto_resolved", 1745 + "type": "integer", 1746 + "primaryKey": false, 1747 + "notNull": false, 1748 + "autoincrement": false, 1749 + "default": false 1750 + }, 1751 + "created_at": { 1752 + "name": "created_at", 1753 + "type": "integer", 1754 + "primaryKey": false, 1755 + "notNull": false, 1756 + "autoincrement": false, 1757 + "default": "(strftime('%s', 'now'))" 1758 + }, 1759 + "updated_at": { 1760 + "name": "updated_at", 1761 + "type": "integer", 1762 + "primaryKey": false, 1763 + "notNull": false, 1764 + "autoincrement": false, 1765 + "default": "(strftime('%s', 'now'))" 1766 + } 1767 + }, 1768 + "indexes": { 1769 + "incident_monitor_id_started_at_unique": { 1770 + "name": "incident_monitor_id_started_at_unique", 1771 + "columns": [ 1772 + "monitor_id", 1773 + "started_at" 1774 + ], 1775 + "isUnique": true 1776 + } 1777 + }, 1778 + "foreignKeys": { 1779 + "incident_monitor_id_monitor_id_fk": { 1780 + "name": "incident_monitor_id_monitor_id_fk", 1781 + "tableFrom": "incident", 1782 + "tableTo": "monitor", 1783 + "columnsFrom": [ 1784 + "monitor_id" 1785 + ], 1786 + "columnsTo": [ 1787 + "id" 1788 + ], 1789 + "onDelete": "set default", 1790 + "onUpdate": "no action" 1791 + }, 1792 + "incident_workspace_id_workspace_id_fk": { 1793 + "name": "incident_workspace_id_workspace_id_fk", 1794 + "tableFrom": "incident", 1795 + "tableTo": "workspace", 1796 + "columnsFrom": [ 1797 + "workspace_id" 1798 + ], 1799 + "columnsTo": [ 1800 + "id" 1801 + ], 1802 + "onDelete": "no action", 1803 + "onUpdate": "no action" 1804 + }, 1805 + "incident_acknowledged_by_user_id_fk": { 1806 + "name": "incident_acknowledged_by_user_id_fk", 1807 + "tableFrom": "incident", 1808 + "tableTo": "user", 1809 + "columnsFrom": [ 1810 + "acknowledged_by" 1811 + ], 1812 + "columnsTo": [ 1813 + "id" 1814 + ], 1815 + "onDelete": "no action", 1816 + "onUpdate": "no action" 1817 + }, 1818 + "incident_resolved_by_user_id_fk": { 1819 + "name": "incident_resolved_by_user_id_fk", 1820 + "tableFrom": "incident", 1821 + "tableTo": "user", 1822 + "columnsFrom": [ 1823 + "resolved_by" 1824 + ], 1825 + "columnsTo": [ 1826 + "id" 1827 + ], 1828 + "onDelete": "no action", 1829 + "onUpdate": "no action" 1830 + } 1831 + }, 1832 + "compositePrimaryKeys": {}, 1833 + "uniqueConstraints": {}, 1834 + "checkConstraints": {} 1835 + }, 1836 + "monitor_tag": { 1837 + "name": "monitor_tag", 1838 + "columns": { 1839 + "id": { 1840 + "name": "id", 1841 + "type": "integer", 1842 + "primaryKey": true, 1843 + "notNull": true, 1844 + "autoincrement": false 1845 + }, 1846 + "workspace_id": { 1847 + "name": "workspace_id", 1848 + "type": "integer", 1849 + "primaryKey": false, 1850 + "notNull": true, 1851 + "autoincrement": false 1852 + }, 1853 + "name": { 1854 + "name": "name", 1855 + "type": "text", 1856 + "primaryKey": false, 1857 + "notNull": true, 1858 + "autoincrement": false 1859 + }, 1860 + "color": { 1861 + "name": "color", 1862 + "type": "text", 1863 + "primaryKey": false, 1864 + "notNull": true, 1865 + "autoincrement": false 1866 + }, 1867 + "created_at": { 1868 + "name": "created_at", 1869 + "type": "integer", 1870 + "primaryKey": false, 1871 + "notNull": false, 1872 + "autoincrement": false, 1873 + "default": "(strftime('%s', 'now'))" 1874 + }, 1875 + "updated_at": { 1876 + "name": "updated_at", 1877 + "type": "integer", 1878 + "primaryKey": false, 1879 + "notNull": false, 1880 + "autoincrement": false, 1881 + "default": "(strftime('%s', 'now'))" 1882 + } 1883 + }, 1884 + "indexes": {}, 1885 + "foreignKeys": { 1886 + "monitor_tag_workspace_id_workspace_id_fk": { 1887 + "name": "monitor_tag_workspace_id_workspace_id_fk", 1888 + "tableFrom": "monitor_tag", 1889 + "tableTo": "workspace", 1890 + "columnsFrom": [ 1891 + "workspace_id" 1892 + ], 1893 + "columnsTo": [ 1894 + "id" 1895 + ], 1896 + "onDelete": "cascade", 1897 + "onUpdate": "no action" 1898 + } 1899 + }, 1900 + "compositePrimaryKeys": {}, 1901 + "uniqueConstraints": {}, 1902 + "checkConstraints": {} 1903 + }, 1904 + "monitor_tag_to_monitor": { 1905 + "name": "monitor_tag_to_monitor", 1906 + "columns": { 1907 + "monitor_id": { 1908 + "name": "monitor_id", 1909 + "type": "integer", 1910 + "primaryKey": false, 1911 + "notNull": true, 1912 + "autoincrement": false 1913 + }, 1914 + "monitor_tag_id": { 1915 + "name": "monitor_tag_id", 1916 + "type": "integer", 1917 + "primaryKey": false, 1918 + "notNull": true, 1919 + "autoincrement": false 1920 + }, 1921 + "created_at": { 1922 + "name": "created_at", 1923 + "type": "integer", 1924 + "primaryKey": false, 1925 + "notNull": false, 1926 + "autoincrement": false, 1927 + "default": "(strftime('%s', 'now'))" 1928 + } 1929 + }, 1930 + "indexes": {}, 1931 + "foreignKeys": { 1932 + "monitor_tag_to_monitor_monitor_id_monitor_id_fk": { 1933 + "name": "monitor_tag_to_monitor_monitor_id_monitor_id_fk", 1934 + "tableFrom": "monitor_tag_to_monitor", 1935 + "tableTo": "monitor", 1936 + "columnsFrom": [ 1937 + "monitor_id" 1938 + ], 1939 + "columnsTo": [ 1940 + "id" 1941 + ], 1942 + "onDelete": "cascade", 1943 + "onUpdate": "no action" 1944 + }, 1945 + "monitor_tag_to_monitor_monitor_tag_id_monitor_tag_id_fk": { 1946 + "name": "monitor_tag_to_monitor_monitor_tag_id_monitor_tag_id_fk", 1947 + "tableFrom": "monitor_tag_to_monitor", 1948 + "tableTo": "monitor_tag", 1949 + "columnsFrom": [ 1950 + "monitor_tag_id" 1951 + ], 1952 + "columnsTo": [ 1953 + "id" 1954 + ], 1955 + "onDelete": "cascade", 1956 + "onUpdate": "no action" 1957 + } 1958 + }, 1959 + "compositePrimaryKeys": { 1960 + "monitor_tag_to_monitor_monitor_id_monitor_tag_id_pk": { 1961 + "columns": [ 1962 + "monitor_id", 1963 + "monitor_tag_id" 1964 + ], 1965 + "name": "monitor_tag_to_monitor_monitor_id_monitor_tag_id_pk" 1966 + } 1967 + }, 1968 + "uniqueConstraints": {}, 1969 + "checkConstraints": {} 1970 + }, 1971 + "application": { 1972 + "name": "application", 1973 + "columns": { 1974 + "id": { 1975 + "name": "id", 1976 + "type": "integer", 1977 + "primaryKey": true, 1978 + "notNull": true, 1979 + "autoincrement": false 1980 + }, 1981 + "name": { 1982 + "name": "name", 1983 + "type": "text", 1984 + "primaryKey": false, 1985 + "notNull": false, 1986 + "autoincrement": false 1987 + }, 1988 + "dsn": { 1989 + "name": "dsn", 1990 + "type": "text", 1991 + "primaryKey": false, 1992 + "notNull": false, 1993 + "autoincrement": false 1994 + }, 1995 + "workspace_id": { 1996 + "name": "workspace_id", 1997 + "type": "integer", 1998 + "primaryKey": false, 1999 + "notNull": false, 2000 + "autoincrement": false 2001 + }, 2002 + "created_at": { 2003 + "name": "created_at", 2004 + "type": "integer", 2005 + "primaryKey": false, 2006 + "notNull": false, 2007 + "autoincrement": false, 2008 + "default": "(strftime('%s', 'now'))" 2009 + }, 2010 + "updated_at": { 2011 + "name": "updated_at", 2012 + "type": "integer", 2013 + "primaryKey": false, 2014 + "notNull": false, 2015 + "autoincrement": false, 2016 + "default": "(strftime('%s', 'now'))" 2017 + } 2018 + }, 2019 + "indexes": { 2020 + "application_dsn_unique": { 2021 + "name": "application_dsn_unique", 2022 + "columns": [ 2023 + "dsn" 2024 + ], 2025 + "isUnique": true 2026 + } 2027 + }, 2028 + "foreignKeys": { 2029 + "application_workspace_id_workspace_id_fk": { 2030 + "name": "application_workspace_id_workspace_id_fk", 2031 + "tableFrom": "application", 2032 + "tableTo": "workspace", 2033 + "columnsFrom": [ 2034 + "workspace_id" 2035 + ], 2036 + "columnsTo": [ 2037 + "id" 2038 + ], 2039 + "onDelete": "no action", 2040 + "onUpdate": "no action" 2041 + } 2042 + }, 2043 + "compositePrimaryKeys": {}, 2044 + "uniqueConstraints": {}, 2045 + "checkConstraints": {} 2046 + }, 2047 + "maintenance": { 2048 + "name": "maintenance", 2049 + "columns": { 2050 + "id": { 2051 + "name": "id", 2052 + "type": "integer", 2053 + "primaryKey": true, 2054 + "notNull": true, 2055 + "autoincrement": false 2056 + }, 2057 + "title": { 2058 + "name": "title", 2059 + "type": "text(256)", 2060 + "primaryKey": false, 2061 + "notNull": true, 2062 + "autoincrement": false 2063 + }, 2064 + "message": { 2065 + "name": "message", 2066 + "type": "text", 2067 + "primaryKey": false, 2068 + "notNull": true, 2069 + "autoincrement": false 2070 + }, 2071 + "from": { 2072 + "name": "from", 2073 + "type": "integer", 2074 + "primaryKey": false, 2075 + "notNull": true, 2076 + "autoincrement": false 2077 + }, 2078 + "to": { 2079 + "name": "to", 2080 + "type": "integer", 2081 + "primaryKey": false, 2082 + "notNull": true, 2083 + "autoincrement": false 2084 + }, 2085 + "workspace_id": { 2086 + "name": "workspace_id", 2087 + "type": "integer", 2088 + "primaryKey": false, 2089 + "notNull": false, 2090 + "autoincrement": false 2091 + }, 2092 + "page_id": { 2093 + "name": "page_id", 2094 + "type": "integer", 2095 + "primaryKey": false, 2096 + "notNull": false, 2097 + "autoincrement": false 2098 + }, 2099 + "created_at": { 2100 + "name": "created_at", 2101 + "type": "integer", 2102 + "primaryKey": false, 2103 + "notNull": false, 2104 + "autoincrement": false, 2105 + "default": "(strftime('%s', 'now'))" 2106 + }, 2107 + "updated_at": { 2108 + "name": "updated_at", 2109 + "type": "integer", 2110 + "primaryKey": false, 2111 + "notNull": false, 2112 + "autoincrement": false, 2113 + "default": "(strftime('%s', 'now'))" 2114 + } 2115 + }, 2116 + "indexes": {}, 2117 + "foreignKeys": { 2118 + "maintenance_workspace_id_workspace_id_fk": { 2119 + "name": "maintenance_workspace_id_workspace_id_fk", 2120 + "tableFrom": "maintenance", 2121 + "tableTo": "workspace", 2122 + "columnsFrom": [ 2123 + "workspace_id" 2124 + ], 2125 + "columnsTo": [ 2126 + "id" 2127 + ], 2128 + "onDelete": "no action", 2129 + "onUpdate": "no action" 2130 + }, 2131 + "maintenance_page_id_page_id_fk": { 2132 + "name": "maintenance_page_id_page_id_fk", 2133 + "tableFrom": "maintenance", 2134 + "tableTo": "page", 2135 + "columnsFrom": [ 2136 + "page_id" 2137 + ], 2138 + "columnsTo": [ 2139 + "id" 2140 + ], 2141 + "onDelete": "no action", 2142 + "onUpdate": "no action" 2143 + } 2144 + }, 2145 + "compositePrimaryKeys": {}, 2146 + "uniqueConstraints": {}, 2147 + "checkConstraints": {} 2148 + }, 2149 + "maintenance_to_monitor": { 2150 + "name": "maintenance_to_monitor", 2151 + "columns": { 2152 + "maintenance_id": { 2153 + "name": "maintenance_id", 2154 + "type": "integer", 2155 + "primaryKey": false, 2156 + "notNull": true, 2157 + "autoincrement": false 2158 + }, 2159 + "monitor_id": { 2160 + "name": "monitor_id", 2161 + "type": "integer", 2162 + "primaryKey": false, 2163 + "notNull": true, 2164 + "autoincrement": false 2165 + }, 2166 + "created_at": { 2167 + "name": "created_at", 2168 + "type": "integer", 2169 + "primaryKey": false, 2170 + "notNull": false, 2171 + "autoincrement": false, 2172 + "default": "(strftime('%s', 'now'))" 2173 + } 2174 + }, 2175 + "indexes": {}, 2176 + "foreignKeys": { 2177 + "maintenance_to_monitor_maintenance_id_maintenance_id_fk": { 2178 + "name": "maintenance_to_monitor_maintenance_id_maintenance_id_fk", 2179 + "tableFrom": "maintenance_to_monitor", 2180 + "tableTo": "maintenance", 2181 + "columnsFrom": [ 2182 + "maintenance_id" 2183 + ], 2184 + "columnsTo": [ 2185 + "id" 2186 + ], 2187 + "onDelete": "cascade", 2188 + "onUpdate": "no action" 2189 + }, 2190 + "maintenance_to_monitor_monitor_id_monitor_id_fk": { 2191 + "name": "maintenance_to_monitor_monitor_id_monitor_id_fk", 2192 + "tableFrom": "maintenance_to_monitor", 2193 + "tableTo": "monitor", 2194 + "columnsFrom": [ 2195 + "monitor_id" 2196 + ], 2197 + "columnsTo": [ 2198 + "id" 2199 + ], 2200 + "onDelete": "cascade", 2201 + "onUpdate": "no action" 2202 + } 2203 + }, 2204 + "compositePrimaryKeys": { 2205 + "maintenance_to_monitor_maintenance_id_monitor_id_pk": { 2206 + "columns": [ 2207 + "maintenance_id", 2208 + "monitor_id" 2209 + ], 2210 + "name": "maintenance_to_monitor_maintenance_id_monitor_id_pk" 2211 + } 2212 + }, 2213 + "uniqueConstraints": {}, 2214 + "checkConstraints": {} 2215 + }, 2216 + "check": { 2217 + "name": "check", 2218 + "columns": { 2219 + "id": { 2220 + "name": "id", 2221 + "type": "integer", 2222 + "primaryKey": true, 2223 + "notNull": true, 2224 + "autoincrement": true 2225 + }, 2226 + "regions": { 2227 + "name": "regions", 2228 + "type": "text", 2229 + "primaryKey": false, 2230 + "notNull": true, 2231 + "autoincrement": false, 2232 + "default": "''" 2233 + }, 2234 + "url": { 2235 + "name": "url", 2236 + "type": "text(4096)", 2237 + "primaryKey": false, 2238 + "notNull": true, 2239 + "autoincrement": false 2240 + }, 2241 + "headers": { 2242 + "name": "headers", 2243 + "type": "text", 2244 + "primaryKey": false, 2245 + "notNull": false, 2246 + "autoincrement": false, 2247 + "default": "''" 2248 + }, 2249 + "body": { 2250 + "name": "body", 2251 + "type": "text", 2252 + "primaryKey": false, 2253 + "notNull": false, 2254 + "autoincrement": false, 2255 + "default": "''" 2256 + }, 2257 + "method": { 2258 + "name": "method", 2259 + "type": "text", 2260 + "primaryKey": false, 2261 + "notNull": false, 2262 + "autoincrement": false, 2263 + "default": "'GET'" 2264 + }, 2265 + "count_requests": { 2266 + "name": "count_requests", 2267 + "type": "integer", 2268 + "primaryKey": false, 2269 + "notNull": false, 2270 + "autoincrement": false, 2271 + "default": 1 2272 + }, 2273 + "workspace_id": { 2274 + "name": "workspace_id", 2275 + "type": "integer", 2276 + "primaryKey": false, 2277 + "notNull": false, 2278 + "autoincrement": false 2279 + }, 2280 + "created_at": { 2281 + "name": "created_at", 2282 + "type": "integer", 2283 + "primaryKey": false, 2284 + "notNull": false, 2285 + "autoincrement": false, 2286 + "default": "(strftime('%s', 'now'))" 2287 + } 2288 + }, 2289 + "indexes": {}, 2290 + "foreignKeys": { 2291 + "check_workspace_id_workspace_id_fk": { 2292 + "name": "check_workspace_id_workspace_id_fk", 2293 + "tableFrom": "check", 2294 + "tableTo": "workspace", 2295 + "columnsFrom": [ 2296 + "workspace_id" 2297 + ], 2298 + "columnsTo": [ 2299 + "id" 2300 + ], 2301 + "onDelete": "no action", 2302 + "onUpdate": "no action" 2303 + } 2304 + }, 2305 + "compositePrimaryKeys": {}, 2306 + "uniqueConstraints": {}, 2307 + "checkConstraints": {} 2308 + }, 2309 + "monitor_run": { 2310 + "name": "monitor_run", 2311 + "columns": { 2312 + "id": { 2313 + "name": "id", 2314 + "type": "integer", 2315 + "primaryKey": true, 2316 + "notNull": true, 2317 + "autoincrement": false 2318 + }, 2319 + "workspace_id": { 2320 + "name": "workspace_id", 2321 + "type": "integer", 2322 + "primaryKey": false, 2323 + "notNull": false, 2324 + "autoincrement": false 2325 + }, 2326 + "monitor_id": { 2327 + "name": "monitor_id", 2328 + "type": "integer", 2329 + "primaryKey": false, 2330 + "notNull": false, 2331 + "autoincrement": false 2332 + }, 2333 + "runned_at": { 2334 + "name": "runned_at", 2335 + "type": "integer", 2336 + "primaryKey": false, 2337 + "notNull": false, 2338 + "autoincrement": false 2339 + }, 2340 + "created_at": { 2341 + "name": "created_at", 2342 + "type": "integer", 2343 + "primaryKey": false, 2344 + "notNull": false, 2345 + "autoincrement": false, 2346 + "default": "(strftime('%s', 'now'))" 2347 + } 2348 + }, 2349 + "indexes": {}, 2350 + "foreignKeys": { 2351 + "monitor_run_workspace_id_workspace_id_fk": { 2352 + "name": "monitor_run_workspace_id_workspace_id_fk", 2353 + "tableFrom": "monitor_run", 2354 + "tableTo": "workspace", 2355 + "columnsFrom": [ 2356 + "workspace_id" 2357 + ], 2358 + "columnsTo": [ 2359 + "id" 2360 + ], 2361 + "onDelete": "no action", 2362 + "onUpdate": "no action" 2363 + }, 2364 + "monitor_run_monitor_id_monitor_id_fk": { 2365 + "name": "monitor_run_monitor_id_monitor_id_fk", 2366 + "tableFrom": "monitor_run", 2367 + "tableTo": "monitor", 2368 + "columnsFrom": [ 2369 + "monitor_id" 2370 + ], 2371 + "columnsTo": [ 2372 + "id" 2373 + ], 2374 + "onDelete": "no action", 2375 + "onUpdate": "no action" 2376 + } 2377 + }, 2378 + "compositePrimaryKeys": {}, 2379 + "uniqueConstraints": {}, 2380 + "checkConstraints": {} 2381 + } 2382 + }, 2383 + "views": {}, 2384 + "enums": {}, 2385 + "_meta": { 2386 + "schemas": {}, 2387 + "tables": {}, 2388 + "columns": {} 2389 + }, 2390 + "internal": { 2391 + "indexes": {} 2392 + } 2393 + }
+7
packages/db/drizzle/meta/_journal.json
··· 288 288 "when": 1740684132626, 289 289 "tag": "0040_narrow_anthem", 290 290 "breakpoints": true 291 + }, 292 + { 293 + "idx": 41, 294 + "version": "6", 295 + "when": 1741936835660, 296 + "tag": "0041_nasty_jigsaw", 297 + "breakpoints": true 291 298 } 292 299 ] 293 300 }
+20
packages/db/src/schema/notifications/notification.ts
··· 4 4 primaryKey, 5 5 sqliteTable, 6 6 text, 7 + uniqueIndex, 7 8 } from "drizzle-orm/sqlite-core"; 8 9 9 10 import { monitor } from "../monitors"; ··· 23 24 sql`(strftime('%s', 'now'))`, 24 25 ), 25 26 }); 27 + 28 + export const notificationTrigger = sqliteTable( 29 + "notification_trigger", 30 + { 31 + id: integer("id").primaryKey(), 32 + monitorId: integer("monitor_id").references(() => monitor.id), 33 + notificationId: integer("notification_id").references( 34 + () => notification.id, 35 + ), 36 + cronTimestamp: integer("cron_timestamp").notNull(), 37 + }, 38 + (table) => ({ 39 + unique: uniqueIndex("notification_id_monitor_id_crontimestampe").on( 40 + table.notificationId, 41 + table.monitorId, 42 + table.cronTimestamp, 43 + ), 44 + }), 45 + ); 26 46 27 47 export const notificationsToMonitors = sqliteTable( 28 48 "notifications_to_monitors",
-2
packages/notifications/opsgenie/src/index.ts
··· 106 106 export const sendRecovery = async ({ 107 107 monitor, 108 108 notification, 109 - // biome-ignore lint/correctness/noUnusedVariables: <explanation> 110 109 statusCode, 111 - // biome-ignore lint/correctness/noUnusedVariables: <explanation> 112 110 message, 113 111 incidentId, 114 112 }: {
-1
packages/notifications/pagerduty/src/index.ts
··· 152 152 }) => { 153 153 console.log("Sending test alert to PagerDuty"); 154 154 try { 155 - // biome-ignore lint/correctness/noUnusedVariables: <explanation> 156 155 const event = triggerEventPayloadSchema.parse({ 157 156 routing_key: integrationKey, 158 157 dedup_key: "openstatus-test",