Openstatus www.openstatus.dev

⌚ Add created at for every table (#634)

* ⌚ Add created at for every table

* 😭 fix migration

* 😭 fix migration

authored by

Thibault Le Ouay and committed by
GitHub
5044f04f ebcc8560

+1486 -1
+5
packages/db/drizzle/0017_loose_maggott.sql
··· 1 + ALTER TABLE status_report_to_monitors ADD `created_at` integer DEFAULT (strftime('%s', 'now')); --> statement-breakpoint 2 + ALTER TABLE status_reports_to_pages ADD `created_at` integer DEFAULT (strftime('%s', 'now')); --> statement-breakpoint 3 + ALTER TABLE monitors_to_pages ADD `created_at` integer DEFAULT (strftime('%s', 'now')); --> statement-breakpoint 4 + ALTER TABLE users_to_workspaces ADD `created_at` integer DEFAULT (strftime('%s', 'now')); --> statement-breakpoint 5 + ALTER TABLE notifications_to_monitors ADD `created_at` integer DEFAULT (strftime('%s', 'now'));
+1458
packages/db/drizzle/meta/0017_snapshot.json
··· 1 + { 2 + "version": "5", 3 + "dialect": "sqlite", 4 + "id": "bbc87c20-bc65-4132-913c-65154793a027", 5 + "prevId": "d3626cd5-956f-4a64-9c70-02e5ee44cde0", 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 + } 69 + }, 70 + "uniqueConstraints": {} 71 + }, 72 + "status_reports_to_pages": { 73 + "name": "status_reports_to_pages", 74 + "columns": { 75 + "page_id": { 76 + "name": "page_id", 77 + "type": "integer", 78 + "primaryKey": false, 79 + "notNull": true, 80 + "autoincrement": false 81 + }, 82 + "status_report_id": { 83 + "name": "status_report_id", 84 + "type": "integer", 85 + "primaryKey": false, 86 + "notNull": true, 87 + "autoincrement": false 88 + }, 89 + "created_at": { 90 + "name": "created_at", 91 + "type": "integer", 92 + "primaryKey": false, 93 + "notNull": false, 94 + "autoincrement": false, 95 + "default": "(strftime('%s', 'now'))" 96 + } 97 + }, 98 + "indexes": {}, 99 + "foreignKeys": { 100 + "status_reports_to_pages_page_id_page_id_fk": { 101 + "name": "status_reports_to_pages_page_id_page_id_fk", 102 + "tableFrom": "status_reports_to_pages", 103 + "tableTo": "page", 104 + "columnsFrom": [ 105 + "page_id" 106 + ], 107 + "columnsTo": [ 108 + "id" 109 + ], 110 + "onDelete": "cascade", 111 + "onUpdate": "no action" 112 + }, 113 + "status_reports_to_pages_status_report_id_status_report_id_fk": { 114 + "name": "status_reports_to_pages_status_report_id_status_report_id_fk", 115 + "tableFrom": "status_reports_to_pages", 116 + "tableTo": "status_report", 117 + "columnsFrom": [ 118 + "status_report_id" 119 + ], 120 + "columnsTo": [ 121 + "id" 122 + ], 123 + "onDelete": "cascade", 124 + "onUpdate": "no action" 125 + } 126 + }, 127 + "compositePrimaryKeys": { 128 + "status_reports_to_pages_page_id_status_report_id_pk": { 129 + "columns": [ 130 + "page_id", 131 + "status_report_id" 132 + ] 133 + } 134 + }, 135 + "uniqueConstraints": {} 136 + }, 137 + "status_report": { 138 + "name": "status_report", 139 + "columns": { 140 + "id": { 141 + "name": "id", 142 + "type": "integer", 143 + "primaryKey": true, 144 + "notNull": true, 145 + "autoincrement": false 146 + }, 147 + "status": { 148 + "name": "status", 149 + "type": "text", 150 + "primaryKey": false, 151 + "notNull": true, 152 + "autoincrement": false 153 + }, 154 + "title": { 155 + "name": "title", 156 + "type": "text(256)", 157 + "primaryKey": false, 158 + "notNull": true, 159 + "autoincrement": false 160 + }, 161 + "workspace_id": { 162 + "name": "workspace_id", 163 + "type": "integer", 164 + "primaryKey": false, 165 + "notNull": false, 166 + "autoincrement": false 167 + }, 168 + "created_at": { 169 + "name": "created_at", 170 + "type": "integer", 171 + "primaryKey": false, 172 + "notNull": false, 173 + "autoincrement": false, 174 + "default": "(strftime('%s', 'now'))" 175 + }, 176 + "updated_at": { 177 + "name": "updated_at", 178 + "type": "integer", 179 + "primaryKey": false, 180 + "notNull": false, 181 + "autoincrement": false, 182 + "default": "(strftime('%s', 'now'))" 183 + } 184 + }, 185 + "indexes": {}, 186 + "foreignKeys": { 187 + "status_report_workspace_id_workspace_id_fk": { 188 + "name": "status_report_workspace_id_workspace_id_fk", 189 + "tableFrom": "status_report", 190 + "tableTo": "workspace", 191 + "columnsFrom": [ 192 + "workspace_id" 193 + ], 194 + "columnsTo": [ 195 + "id" 196 + ], 197 + "onDelete": "no action", 198 + "onUpdate": "no action" 199 + } 200 + }, 201 + "compositePrimaryKeys": {}, 202 + "uniqueConstraints": {} 203 + }, 204 + "status_report_update": { 205 + "name": "status_report_update", 206 + "columns": { 207 + "id": { 208 + "name": "id", 209 + "type": "integer", 210 + "primaryKey": true, 211 + "notNull": true, 212 + "autoincrement": false 213 + }, 214 + "status": { 215 + "name": "status", 216 + "type": "text(4)", 217 + "primaryKey": false, 218 + "notNull": true, 219 + "autoincrement": false 220 + }, 221 + "date": { 222 + "name": "date", 223 + "type": "integer", 224 + "primaryKey": false, 225 + "notNull": true, 226 + "autoincrement": false 227 + }, 228 + "message": { 229 + "name": "message", 230 + "type": "text", 231 + "primaryKey": false, 232 + "notNull": true, 233 + "autoincrement": false 234 + }, 235 + "status_report_id": { 236 + "name": "status_report_id", 237 + "type": "integer", 238 + "primaryKey": false, 239 + "notNull": true, 240 + "autoincrement": false 241 + }, 242 + "created_at": { 243 + "name": "created_at", 244 + "type": "integer", 245 + "primaryKey": false, 246 + "notNull": false, 247 + "autoincrement": false, 248 + "default": "(strftime('%s', 'now'))" 249 + }, 250 + "updated_at": { 251 + "name": "updated_at", 252 + "type": "integer", 253 + "primaryKey": false, 254 + "notNull": false, 255 + "autoincrement": false, 256 + "default": "(strftime('%s', 'now'))" 257 + } 258 + }, 259 + "indexes": {}, 260 + "foreignKeys": { 261 + "status_report_update_status_report_id_status_report_id_fk": { 262 + "name": "status_report_update_status_report_id_status_report_id_fk", 263 + "tableFrom": "status_report_update", 264 + "tableTo": "status_report", 265 + "columnsFrom": [ 266 + "status_report_id" 267 + ], 268 + "columnsTo": [ 269 + "id" 270 + ], 271 + "onDelete": "cascade", 272 + "onUpdate": "no action" 273 + } 274 + }, 275 + "compositePrimaryKeys": {}, 276 + "uniqueConstraints": {} 277 + }, 278 + "integration": { 279 + "name": "integration", 280 + "columns": { 281 + "id": { 282 + "name": "id", 283 + "type": "integer", 284 + "primaryKey": true, 285 + "notNull": true, 286 + "autoincrement": false 287 + }, 288 + "name": { 289 + "name": "name", 290 + "type": "text(256)", 291 + "primaryKey": false, 292 + "notNull": true, 293 + "autoincrement": false 294 + }, 295 + "workspace_id": { 296 + "name": "workspace_id", 297 + "type": "integer", 298 + "primaryKey": false, 299 + "notNull": false, 300 + "autoincrement": false 301 + }, 302 + "credential": { 303 + "name": "credential", 304 + "type": "text", 305 + "primaryKey": false, 306 + "notNull": false, 307 + "autoincrement": false 308 + }, 309 + "external_id": { 310 + "name": "external_id", 311 + "type": "text", 312 + "primaryKey": false, 313 + "notNull": true, 314 + "autoincrement": false 315 + }, 316 + "created_at": { 317 + "name": "created_at", 318 + "type": "integer", 319 + "primaryKey": false, 320 + "notNull": false, 321 + "autoincrement": false, 322 + "default": "(strftime('%s', 'now'))" 323 + }, 324 + "updated_at": { 325 + "name": "updated_at", 326 + "type": "integer", 327 + "primaryKey": false, 328 + "notNull": false, 329 + "autoincrement": false, 330 + "default": "(strftime('%s', 'now'))" 331 + }, 332 + "data": { 333 + "name": "data", 334 + "type": "text", 335 + "primaryKey": false, 336 + "notNull": true, 337 + "autoincrement": false 338 + } 339 + }, 340 + "indexes": {}, 341 + "foreignKeys": { 342 + "integration_workspace_id_workspace_id_fk": { 343 + "name": "integration_workspace_id_workspace_id_fk", 344 + "tableFrom": "integration", 345 + "tableTo": "workspace", 346 + "columnsFrom": [ 347 + "workspace_id" 348 + ], 349 + "columnsTo": [ 350 + "id" 351 + ], 352 + "onDelete": "no action", 353 + "onUpdate": "no action" 354 + } 355 + }, 356 + "compositePrimaryKeys": {}, 357 + "uniqueConstraints": {} 358 + }, 359 + "page": { 360 + "name": "page", 361 + "columns": { 362 + "id": { 363 + "name": "id", 364 + "type": "integer", 365 + "primaryKey": true, 366 + "notNull": true, 367 + "autoincrement": false 368 + }, 369 + "workspace_id": { 370 + "name": "workspace_id", 371 + "type": "integer", 372 + "primaryKey": false, 373 + "notNull": true, 374 + "autoincrement": false 375 + }, 376 + "title": { 377 + "name": "title", 378 + "type": "text", 379 + "primaryKey": false, 380 + "notNull": true, 381 + "autoincrement": false 382 + }, 383 + "description": { 384 + "name": "description", 385 + "type": "text", 386 + "primaryKey": false, 387 + "notNull": true, 388 + "autoincrement": false 389 + }, 390 + "icon": { 391 + "name": "icon", 392 + "type": "text(256)", 393 + "primaryKey": false, 394 + "notNull": false, 395 + "autoincrement": false, 396 + "default": "''" 397 + }, 398 + "slug": { 399 + "name": "slug", 400 + "type": "text(256)", 401 + "primaryKey": false, 402 + "notNull": true, 403 + "autoincrement": false 404 + }, 405 + "custom_domain": { 406 + "name": "custom_domain", 407 + "type": "text(256)", 408 + "primaryKey": false, 409 + "notNull": true, 410 + "autoincrement": false 411 + }, 412 + "published": { 413 + "name": "published", 414 + "type": "integer", 415 + "primaryKey": false, 416 + "notNull": false, 417 + "autoincrement": false, 418 + "default": false 419 + }, 420 + "created_at": { 421 + "name": "created_at", 422 + "type": "integer", 423 + "primaryKey": false, 424 + "notNull": false, 425 + "autoincrement": false, 426 + "default": "(strftime('%s', 'now'))" 427 + }, 428 + "updated_at": { 429 + "name": "updated_at", 430 + "type": "integer", 431 + "primaryKey": false, 432 + "notNull": false, 433 + "autoincrement": false, 434 + "default": "(strftime('%s', 'now'))" 435 + } 436 + }, 437 + "indexes": { 438 + "page_slug_unique": { 439 + "name": "page_slug_unique", 440 + "columns": [ 441 + "slug" 442 + ], 443 + "isUnique": true 444 + } 445 + }, 446 + "foreignKeys": { 447 + "page_workspace_id_workspace_id_fk": { 448 + "name": "page_workspace_id_workspace_id_fk", 449 + "tableFrom": "page", 450 + "tableTo": "workspace", 451 + "columnsFrom": [ 452 + "workspace_id" 453 + ], 454 + "columnsTo": [ 455 + "id" 456 + ], 457 + "onDelete": "cascade", 458 + "onUpdate": "no action" 459 + } 460 + }, 461 + "compositePrimaryKeys": {}, 462 + "uniqueConstraints": {} 463 + }, 464 + "monitor": { 465 + "name": "monitor", 466 + "columns": { 467 + "id": { 468 + "name": "id", 469 + "type": "integer", 470 + "primaryKey": true, 471 + "notNull": true, 472 + "autoincrement": false 473 + }, 474 + "job_type": { 475 + "name": "job_type", 476 + "type": "text", 477 + "primaryKey": false, 478 + "notNull": true, 479 + "autoincrement": false, 480 + "default": "'other'" 481 + }, 482 + "periodicity": { 483 + "name": "periodicity", 484 + "type": "text", 485 + "primaryKey": false, 486 + "notNull": true, 487 + "autoincrement": false, 488 + "default": "'other'" 489 + }, 490 + "status": { 491 + "name": "status", 492 + "type": "text", 493 + "primaryKey": false, 494 + "notNull": true, 495 + "autoincrement": false, 496 + "default": "'active'" 497 + }, 498 + "active": { 499 + "name": "active", 500 + "type": "integer", 501 + "primaryKey": false, 502 + "notNull": false, 503 + "autoincrement": false, 504 + "default": false 505 + }, 506 + "regions": { 507 + "name": "regions", 508 + "type": "text", 509 + "primaryKey": false, 510 + "notNull": true, 511 + "autoincrement": false, 512 + "default": "''" 513 + }, 514 + "url": { 515 + "name": "url", 516 + "type": "text(2048)", 517 + "primaryKey": false, 518 + "notNull": true, 519 + "autoincrement": false 520 + }, 521 + "name": { 522 + "name": "name", 523 + "type": "text(256)", 524 + "primaryKey": false, 525 + "notNull": true, 526 + "autoincrement": false, 527 + "default": "''" 528 + }, 529 + "description": { 530 + "name": "description", 531 + "type": "text", 532 + "primaryKey": false, 533 + "notNull": true, 534 + "autoincrement": false, 535 + "default": "''" 536 + }, 537 + "headers": { 538 + "name": "headers", 539 + "type": "text", 540 + "primaryKey": false, 541 + "notNull": false, 542 + "autoincrement": false, 543 + "default": "''" 544 + }, 545 + "body": { 546 + "name": "body", 547 + "type": "text", 548 + "primaryKey": false, 549 + "notNull": false, 550 + "autoincrement": false, 551 + "default": "''" 552 + }, 553 + "method": { 554 + "name": "method", 555 + "type": "text", 556 + "primaryKey": false, 557 + "notNull": false, 558 + "autoincrement": false, 559 + "default": "'GET'" 560 + }, 561 + "workspace_id": { 562 + "name": "workspace_id", 563 + "type": "integer", 564 + "primaryKey": false, 565 + "notNull": false, 566 + "autoincrement": false 567 + }, 568 + "created_at": { 569 + "name": "created_at", 570 + "type": "integer", 571 + "primaryKey": false, 572 + "notNull": false, 573 + "autoincrement": false, 574 + "default": "(strftime('%s', 'now'))" 575 + }, 576 + "updated_at": { 577 + "name": "updated_at", 578 + "type": "integer", 579 + "primaryKey": false, 580 + "notNull": false, 581 + "autoincrement": false, 582 + "default": "(strftime('%s', 'now'))" 583 + } 584 + }, 585 + "indexes": {}, 586 + "foreignKeys": { 587 + "monitor_workspace_id_workspace_id_fk": { 588 + "name": "monitor_workspace_id_workspace_id_fk", 589 + "tableFrom": "monitor", 590 + "tableTo": "workspace", 591 + "columnsFrom": [ 592 + "workspace_id" 593 + ], 594 + "columnsTo": [ 595 + "id" 596 + ], 597 + "onDelete": "no action", 598 + "onUpdate": "no action" 599 + } 600 + }, 601 + "compositePrimaryKeys": {}, 602 + "uniqueConstraints": {} 603 + }, 604 + "monitors_to_pages": { 605 + "name": "monitors_to_pages", 606 + "columns": { 607 + "monitor_id": { 608 + "name": "monitor_id", 609 + "type": "integer", 610 + "primaryKey": false, 611 + "notNull": true, 612 + "autoincrement": false 613 + }, 614 + "page_id": { 615 + "name": "page_id", 616 + "type": "integer", 617 + "primaryKey": false, 618 + "notNull": true, 619 + "autoincrement": false 620 + }, 621 + "created_at": { 622 + "name": "created_at", 623 + "type": "integer", 624 + "primaryKey": false, 625 + "notNull": false, 626 + "autoincrement": false, 627 + "default": "(strftime('%s', 'now'))" 628 + } 629 + }, 630 + "indexes": {}, 631 + "foreignKeys": { 632 + "monitors_to_pages_monitor_id_monitor_id_fk": { 633 + "name": "monitors_to_pages_monitor_id_monitor_id_fk", 634 + "tableFrom": "monitors_to_pages", 635 + "tableTo": "monitor", 636 + "columnsFrom": [ 637 + "monitor_id" 638 + ], 639 + "columnsTo": [ 640 + "id" 641 + ], 642 + "onDelete": "cascade", 643 + "onUpdate": "no action" 644 + }, 645 + "monitors_to_pages_page_id_page_id_fk": { 646 + "name": "monitors_to_pages_page_id_page_id_fk", 647 + "tableFrom": "monitors_to_pages", 648 + "tableTo": "page", 649 + "columnsFrom": [ 650 + "page_id" 651 + ], 652 + "columnsTo": [ 653 + "id" 654 + ], 655 + "onDelete": "cascade", 656 + "onUpdate": "no action" 657 + } 658 + }, 659 + "compositePrimaryKeys": { 660 + "monitors_to_pages_monitor_id_page_id_pk": { 661 + "columns": [ 662 + "monitor_id", 663 + "page_id" 664 + ] 665 + } 666 + }, 667 + "uniqueConstraints": {} 668 + }, 669 + "user": { 670 + "name": "user", 671 + "columns": { 672 + "id": { 673 + "name": "id", 674 + "type": "integer", 675 + "primaryKey": true, 676 + "notNull": true, 677 + "autoincrement": false 678 + }, 679 + "tenant_id": { 680 + "name": "tenant_id", 681 + "type": "text(256)", 682 + "primaryKey": false, 683 + "notNull": false, 684 + "autoincrement": false 685 + }, 686 + "first_name": { 687 + "name": "first_name", 688 + "type": "text", 689 + "primaryKey": false, 690 + "notNull": false, 691 + "autoincrement": false, 692 + "default": "''" 693 + }, 694 + "last_name": { 695 + "name": "last_name", 696 + "type": "text", 697 + "primaryKey": false, 698 + "notNull": false, 699 + "autoincrement": false, 700 + "default": "''" 701 + }, 702 + "email": { 703 + "name": "email", 704 + "type": "text", 705 + "primaryKey": false, 706 + "notNull": false, 707 + "autoincrement": false, 708 + "default": "''" 709 + }, 710 + "photo_url": { 711 + "name": "photo_url", 712 + "type": "text", 713 + "primaryKey": false, 714 + "notNull": false, 715 + "autoincrement": false, 716 + "default": "''" 717 + }, 718 + "created_at": { 719 + "name": "created_at", 720 + "type": "integer", 721 + "primaryKey": false, 722 + "notNull": false, 723 + "autoincrement": false, 724 + "default": "(strftime('%s', 'now'))" 725 + }, 726 + "updated_at": { 727 + "name": "updated_at", 728 + "type": "integer", 729 + "primaryKey": false, 730 + "notNull": false, 731 + "autoincrement": false, 732 + "default": "(strftime('%s', 'now'))" 733 + } 734 + }, 735 + "indexes": { 736 + "user_tenant_id_unique": { 737 + "name": "user_tenant_id_unique", 738 + "columns": [ 739 + "tenant_id" 740 + ], 741 + "isUnique": true 742 + } 743 + }, 744 + "foreignKeys": {}, 745 + "compositePrimaryKeys": {}, 746 + "uniqueConstraints": {} 747 + }, 748 + "users_to_workspaces": { 749 + "name": "users_to_workspaces", 750 + "columns": { 751 + "user_id": { 752 + "name": "user_id", 753 + "type": "integer", 754 + "primaryKey": false, 755 + "notNull": true, 756 + "autoincrement": false 757 + }, 758 + "workspace_id": { 759 + "name": "workspace_id", 760 + "type": "integer", 761 + "primaryKey": false, 762 + "notNull": true, 763 + "autoincrement": false 764 + }, 765 + "role": { 766 + "name": "role", 767 + "type": "text", 768 + "primaryKey": false, 769 + "notNull": true, 770 + "autoincrement": false, 771 + "default": "'member'" 772 + }, 773 + "created_at": { 774 + "name": "created_at", 775 + "type": "integer", 776 + "primaryKey": false, 777 + "notNull": false, 778 + "autoincrement": false, 779 + "default": "(strftime('%s', 'now'))" 780 + } 781 + }, 782 + "indexes": {}, 783 + "foreignKeys": { 784 + "users_to_workspaces_user_id_user_id_fk": { 785 + "name": "users_to_workspaces_user_id_user_id_fk", 786 + "tableFrom": "users_to_workspaces", 787 + "tableTo": "user", 788 + "columnsFrom": [ 789 + "user_id" 790 + ], 791 + "columnsTo": [ 792 + "id" 793 + ], 794 + "onDelete": "no action", 795 + "onUpdate": "no action" 796 + }, 797 + "users_to_workspaces_workspace_id_workspace_id_fk": { 798 + "name": "users_to_workspaces_workspace_id_workspace_id_fk", 799 + "tableFrom": "users_to_workspaces", 800 + "tableTo": "workspace", 801 + "columnsFrom": [ 802 + "workspace_id" 803 + ], 804 + "columnsTo": [ 805 + "id" 806 + ], 807 + "onDelete": "no action", 808 + "onUpdate": "no action" 809 + } 810 + }, 811 + "compositePrimaryKeys": { 812 + "users_to_workspaces_user_id_workspace_id_pk": { 813 + "columns": [ 814 + "user_id", 815 + "workspace_id" 816 + ] 817 + } 818 + }, 819 + "uniqueConstraints": {} 820 + }, 821 + "page_subscriber": { 822 + "name": "page_subscriber", 823 + "columns": { 824 + "id": { 825 + "name": "id", 826 + "type": "integer", 827 + "primaryKey": true, 828 + "notNull": true, 829 + "autoincrement": false 830 + }, 831 + "email": { 832 + "name": "email", 833 + "type": "text", 834 + "primaryKey": false, 835 + "notNull": true, 836 + "autoincrement": false 837 + }, 838 + "page_id": { 839 + "name": "page_id", 840 + "type": "integer", 841 + "primaryKey": false, 842 + "notNull": true, 843 + "autoincrement": false 844 + }, 845 + "token": { 846 + "name": "token", 847 + "type": "text", 848 + "primaryKey": false, 849 + "notNull": false, 850 + "autoincrement": false 851 + }, 852 + "accepted_at": { 853 + "name": "accepted_at", 854 + "type": "integer", 855 + "primaryKey": false, 856 + "notNull": false, 857 + "autoincrement": false 858 + }, 859 + "expires_at": { 860 + "name": "expires_at", 861 + "type": "integer", 862 + "primaryKey": false, 863 + "notNull": false, 864 + "autoincrement": false 865 + }, 866 + "created_at": { 867 + "name": "created_at", 868 + "type": "integer", 869 + "primaryKey": false, 870 + "notNull": false, 871 + "autoincrement": false, 872 + "default": "(strftime('%s', 'now'))" 873 + }, 874 + "updated_at": { 875 + "name": "updated_at", 876 + "type": "integer", 877 + "primaryKey": false, 878 + "notNull": false, 879 + "autoincrement": false, 880 + "default": "(strftime('%s', 'now'))" 881 + } 882 + }, 883 + "indexes": {}, 884 + "foreignKeys": { 885 + "page_subscriber_page_id_page_id_fk": { 886 + "name": "page_subscriber_page_id_page_id_fk", 887 + "tableFrom": "page_subscriber", 888 + "tableTo": "page", 889 + "columnsFrom": [ 890 + "page_id" 891 + ], 892 + "columnsTo": [ 893 + "id" 894 + ], 895 + "onDelete": "no action", 896 + "onUpdate": "no action" 897 + } 898 + }, 899 + "compositePrimaryKeys": {}, 900 + "uniqueConstraints": {} 901 + }, 902 + "workspace": { 903 + "name": "workspace", 904 + "columns": { 905 + "id": { 906 + "name": "id", 907 + "type": "integer", 908 + "primaryKey": true, 909 + "notNull": true, 910 + "autoincrement": false 911 + }, 912 + "slug": { 913 + "name": "slug", 914 + "type": "text", 915 + "primaryKey": false, 916 + "notNull": true, 917 + "autoincrement": false 918 + }, 919 + "name": { 920 + "name": "name", 921 + "type": "text", 922 + "primaryKey": false, 923 + "notNull": false, 924 + "autoincrement": false 925 + }, 926 + "stripe_id": { 927 + "name": "stripe_id", 928 + "type": "text(256)", 929 + "primaryKey": false, 930 + "notNull": false, 931 + "autoincrement": false 932 + }, 933 + "subscription_id": { 934 + "name": "subscription_id", 935 + "type": "text", 936 + "primaryKey": false, 937 + "notNull": false, 938 + "autoincrement": false 939 + }, 940 + "plan": { 941 + "name": "plan", 942 + "type": "text", 943 + "primaryKey": false, 944 + "notNull": false, 945 + "autoincrement": false 946 + }, 947 + "ends_at": { 948 + "name": "ends_at", 949 + "type": "integer", 950 + "primaryKey": false, 951 + "notNull": false, 952 + "autoincrement": false 953 + }, 954 + "paid_until": { 955 + "name": "paid_until", 956 + "type": "integer", 957 + "primaryKey": false, 958 + "notNull": false, 959 + "autoincrement": false 960 + }, 961 + "created_at": { 962 + "name": "created_at", 963 + "type": "integer", 964 + "primaryKey": false, 965 + "notNull": false, 966 + "autoincrement": false, 967 + "default": "(strftime('%s', 'now'))" 968 + }, 969 + "updated_at": { 970 + "name": "updated_at", 971 + "type": "integer", 972 + "primaryKey": false, 973 + "notNull": false, 974 + "autoincrement": false, 975 + "default": "(strftime('%s', 'now'))" 976 + } 977 + }, 978 + "indexes": { 979 + "workspace_slug_unique": { 980 + "name": "workspace_slug_unique", 981 + "columns": [ 982 + "slug" 983 + ], 984 + "isUnique": true 985 + }, 986 + "workspace_stripe_id_unique": { 987 + "name": "workspace_stripe_id_unique", 988 + "columns": [ 989 + "stripe_id" 990 + ], 991 + "isUnique": true 992 + } 993 + }, 994 + "foreignKeys": {}, 995 + "compositePrimaryKeys": {}, 996 + "uniqueConstraints": {} 997 + }, 998 + "notification": { 999 + "name": "notification", 1000 + "columns": { 1001 + "id": { 1002 + "name": "id", 1003 + "type": "integer", 1004 + "primaryKey": true, 1005 + "notNull": true, 1006 + "autoincrement": false 1007 + }, 1008 + "name": { 1009 + "name": "name", 1010 + "type": "text", 1011 + "primaryKey": false, 1012 + "notNull": true, 1013 + "autoincrement": false 1014 + }, 1015 + "provider": { 1016 + "name": "provider", 1017 + "type": "text", 1018 + "primaryKey": false, 1019 + "notNull": true, 1020 + "autoincrement": false 1021 + }, 1022 + "data": { 1023 + "name": "data", 1024 + "type": "text", 1025 + "primaryKey": false, 1026 + "notNull": false, 1027 + "autoincrement": false, 1028 + "default": "'{}'" 1029 + }, 1030 + "workspace_id": { 1031 + "name": "workspace_id", 1032 + "type": "integer", 1033 + "primaryKey": false, 1034 + "notNull": false, 1035 + "autoincrement": false 1036 + }, 1037 + "created_at": { 1038 + "name": "created_at", 1039 + "type": "integer", 1040 + "primaryKey": false, 1041 + "notNull": false, 1042 + "autoincrement": false, 1043 + "default": "(strftime('%s', 'now'))" 1044 + }, 1045 + "updated_at": { 1046 + "name": "updated_at", 1047 + "type": "integer", 1048 + "primaryKey": false, 1049 + "notNull": false, 1050 + "autoincrement": false, 1051 + "default": "(strftime('%s', 'now'))" 1052 + } 1053 + }, 1054 + "indexes": {}, 1055 + "foreignKeys": { 1056 + "notification_workspace_id_workspace_id_fk": { 1057 + "name": "notification_workspace_id_workspace_id_fk", 1058 + "tableFrom": "notification", 1059 + "tableTo": "workspace", 1060 + "columnsFrom": [ 1061 + "workspace_id" 1062 + ], 1063 + "columnsTo": [ 1064 + "id" 1065 + ], 1066 + "onDelete": "no action", 1067 + "onUpdate": "no action" 1068 + } 1069 + }, 1070 + "compositePrimaryKeys": {}, 1071 + "uniqueConstraints": {} 1072 + }, 1073 + "notifications_to_monitors": { 1074 + "name": "notifications_to_monitors", 1075 + "columns": { 1076 + "monitor_id": { 1077 + "name": "monitor_id", 1078 + "type": "integer", 1079 + "primaryKey": false, 1080 + "notNull": true, 1081 + "autoincrement": false 1082 + }, 1083 + "notification_id": { 1084 + "name": "notification_id", 1085 + "type": "integer", 1086 + "primaryKey": false, 1087 + "notNull": true, 1088 + "autoincrement": false 1089 + }, 1090 + "created_at": { 1091 + "name": "created_at", 1092 + "type": "integer", 1093 + "primaryKey": false, 1094 + "notNull": false, 1095 + "autoincrement": false, 1096 + "default": "(strftime('%s', 'now'))" 1097 + } 1098 + }, 1099 + "indexes": {}, 1100 + "foreignKeys": { 1101 + "notifications_to_monitors_monitor_id_monitor_id_fk": { 1102 + "name": "notifications_to_monitors_monitor_id_monitor_id_fk", 1103 + "tableFrom": "notifications_to_monitors", 1104 + "tableTo": "monitor", 1105 + "columnsFrom": [ 1106 + "monitor_id" 1107 + ], 1108 + "columnsTo": [ 1109 + "id" 1110 + ], 1111 + "onDelete": "cascade", 1112 + "onUpdate": "no action" 1113 + }, 1114 + "notifications_to_monitors_notification_id_notification_id_fk": { 1115 + "name": "notifications_to_monitors_notification_id_notification_id_fk", 1116 + "tableFrom": "notifications_to_monitors", 1117 + "tableTo": "notification", 1118 + "columnsFrom": [ 1119 + "notification_id" 1120 + ], 1121 + "columnsTo": [ 1122 + "id" 1123 + ], 1124 + "onDelete": "cascade", 1125 + "onUpdate": "no action" 1126 + } 1127 + }, 1128 + "compositePrimaryKeys": { 1129 + "notifications_to_monitors_monitor_id_notification_id_pk": { 1130 + "columns": [ 1131 + "monitor_id", 1132 + "notification_id" 1133 + ] 1134 + } 1135 + }, 1136 + "uniqueConstraints": {} 1137 + }, 1138 + "monitor_status": { 1139 + "name": "monitor_status", 1140 + "columns": { 1141 + "monitor_id": { 1142 + "name": "monitor_id", 1143 + "type": "integer", 1144 + "primaryKey": false, 1145 + "notNull": true, 1146 + "autoincrement": false 1147 + }, 1148 + "region": { 1149 + "name": "region", 1150 + "type": "text", 1151 + "primaryKey": false, 1152 + "notNull": true, 1153 + "autoincrement": false, 1154 + "default": "''" 1155 + }, 1156 + "status": { 1157 + "name": "status", 1158 + "type": "text", 1159 + "primaryKey": false, 1160 + "notNull": true, 1161 + "autoincrement": false, 1162 + "default": "'active'" 1163 + }, 1164 + "created_at": { 1165 + "name": "created_at", 1166 + "type": "integer", 1167 + "primaryKey": false, 1168 + "notNull": false, 1169 + "autoincrement": false, 1170 + "default": "(strftime('%s', 'now'))" 1171 + }, 1172 + "updated_at": { 1173 + "name": "updated_at", 1174 + "type": "integer", 1175 + "primaryKey": false, 1176 + "notNull": false, 1177 + "autoincrement": false, 1178 + "default": "(strftime('%s', 'now'))" 1179 + } 1180 + }, 1181 + "indexes": { 1182 + "monitor_status_idx": { 1183 + "name": "monitor_status_idx", 1184 + "columns": [ 1185 + "monitor_id", 1186 + "region" 1187 + ], 1188 + "isUnique": false 1189 + } 1190 + }, 1191 + "foreignKeys": { 1192 + "monitor_status_monitor_id_monitor_id_fk": { 1193 + "name": "monitor_status_monitor_id_monitor_id_fk", 1194 + "tableFrom": "monitor_status", 1195 + "tableTo": "monitor", 1196 + "columnsFrom": [ 1197 + "monitor_id" 1198 + ], 1199 + "columnsTo": [ 1200 + "id" 1201 + ], 1202 + "onDelete": "cascade", 1203 + "onUpdate": "no action" 1204 + } 1205 + }, 1206 + "compositePrimaryKeys": { 1207 + "monitor_status_monitor_id_region_pk": { 1208 + "columns": [ 1209 + "monitor_id", 1210 + "region" 1211 + ] 1212 + } 1213 + }, 1214 + "uniqueConstraints": {} 1215 + }, 1216 + "invitation": { 1217 + "name": "invitation", 1218 + "columns": { 1219 + "id": { 1220 + "name": "id", 1221 + "type": "integer", 1222 + "primaryKey": true, 1223 + "notNull": true, 1224 + "autoincrement": false 1225 + }, 1226 + "email": { 1227 + "name": "email", 1228 + "type": "text", 1229 + "primaryKey": false, 1230 + "notNull": true, 1231 + "autoincrement": false 1232 + }, 1233 + "role": { 1234 + "name": "role", 1235 + "type": "text", 1236 + "primaryKey": false, 1237 + "notNull": true, 1238 + "autoincrement": false, 1239 + "default": "'member'" 1240 + }, 1241 + "workspace_id": { 1242 + "name": "workspace_id", 1243 + "type": "integer", 1244 + "primaryKey": false, 1245 + "notNull": true, 1246 + "autoincrement": false 1247 + }, 1248 + "token": { 1249 + "name": "token", 1250 + "type": "text", 1251 + "primaryKey": false, 1252 + "notNull": true, 1253 + "autoincrement": false 1254 + }, 1255 + "expires_at": { 1256 + "name": "expires_at", 1257 + "type": "integer", 1258 + "primaryKey": false, 1259 + "notNull": true, 1260 + "autoincrement": false 1261 + }, 1262 + "created_at": { 1263 + "name": "created_at", 1264 + "type": "integer", 1265 + "primaryKey": false, 1266 + "notNull": false, 1267 + "autoincrement": false, 1268 + "default": "(strftime('%s', 'now'))" 1269 + }, 1270 + "accepted_at": { 1271 + "name": "accepted_at", 1272 + "type": "integer", 1273 + "primaryKey": false, 1274 + "notNull": false, 1275 + "autoincrement": false 1276 + } 1277 + }, 1278 + "indexes": {}, 1279 + "foreignKeys": {}, 1280 + "compositePrimaryKeys": {}, 1281 + "uniqueConstraints": {} 1282 + }, 1283 + "incident": { 1284 + "name": "incident", 1285 + "columns": { 1286 + "id": { 1287 + "name": "id", 1288 + "type": "integer", 1289 + "primaryKey": true, 1290 + "notNull": true, 1291 + "autoincrement": false 1292 + }, 1293 + "title": { 1294 + "name": "title", 1295 + "type": "text", 1296 + "primaryKey": false, 1297 + "notNull": true, 1298 + "autoincrement": false, 1299 + "default": "''" 1300 + }, 1301 + "summary": { 1302 + "name": "summary", 1303 + "type": "text", 1304 + "primaryKey": false, 1305 + "notNull": true, 1306 + "autoincrement": false, 1307 + "default": "''" 1308 + }, 1309 + "status": { 1310 + "name": "status", 1311 + "type": "text", 1312 + "primaryKey": false, 1313 + "notNull": true, 1314 + "autoincrement": false, 1315 + "default": "'triage'" 1316 + }, 1317 + "monitor_id": { 1318 + "name": "monitor_id", 1319 + "type": "integer", 1320 + "primaryKey": false, 1321 + "notNull": false, 1322 + "autoincrement": false 1323 + }, 1324 + "workspace_id": { 1325 + "name": "workspace_id", 1326 + "type": "integer", 1327 + "primaryKey": false, 1328 + "notNull": false, 1329 + "autoincrement": false 1330 + }, 1331 + "started_at": { 1332 + "name": "started_at", 1333 + "type": "integer", 1334 + "primaryKey": false, 1335 + "notNull": true, 1336 + "autoincrement": false, 1337 + "default": "(strftime('%s', 'now'))" 1338 + }, 1339 + "acknowledged_at": { 1340 + "name": "acknowledged_at", 1341 + "type": "integer", 1342 + "primaryKey": false, 1343 + "notNull": false, 1344 + "autoincrement": false 1345 + }, 1346 + "acknowledged_by": { 1347 + "name": "acknowledged_by", 1348 + "type": "integer", 1349 + "primaryKey": false, 1350 + "notNull": false, 1351 + "autoincrement": false 1352 + }, 1353 + "resolved_at": { 1354 + "name": "resolved_at", 1355 + "type": "integer", 1356 + "primaryKey": false, 1357 + "notNull": false, 1358 + "autoincrement": false 1359 + }, 1360 + "resolved_by": { 1361 + "name": "resolved_by", 1362 + "type": "integer", 1363 + "primaryKey": false, 1364 + "notNull": false, 1365 + "autoincrement": false 1366 + }, 1367 + "created_at": { 1368 + "name": "created_at", 1369 + "type": "integer", 1370 + "primaryKey": false, 1371 + "notNull": false, 1372 + "autoincrement": false, 1373 + "default": "(strftime('%s', 'now'))" 1374 + }, 1375 + "updated_at": { 1376 + "name": "updated_at", 1377 + "type": "integer", 1378 + "primaryKey": false, 1379 + "notNull": false, 1380 + "autoincrement": false, 1381 + "default": "(strftime('%s', 'now'))" 1382 + } 1383 + }, 1384 + "indexes": { 1385 + "incident_monitor_id_started_at_unique": { 1386 + "name": "incident_monitor_id_started_at_unique", 1387 + "columns": [ 1388 + "monitor_id", 1389 + "started_at" 1390 + ], 1391 + "isUnique": true 1392 + } 1393 + }, 1394 + "foreignKeys": { 1395 + "incident_monitor_id_monitor_id_fk": { 1396 + "name": "incident_monitor_id_monitor_id_fk", 1397 + "tableFrom": "incident", 1398 + "tableTo": "monitor", 1399 + "columnsFrom": [ 1400 + "monitor_id" 1401 + ], 1402 + "columnsTo": [ 1403 + "id" 1404 + ], 1405 + "onDelete": "set default", 1406 + "onUpdate": "no action" 1407 + }, 1408 + "incident_workspace_id_workspace_id_fk": { 1409 + "name": "incident_workspace_id_workspace_id_fk", 1410 + "tableFrom": "incident", 1411 + "tableTo": "workspace", 1412 + "columnsFrom": [ 1413 + "workspace_id" 1414 + ], 1415 + "columnsTo": [ 1416 + "id" 1417 + ], 1418 + "onDelete": "no action", 1419 + "onUpdate": "no action" 1420 + }, 1421 + "incident_acknowledged_by_user_id_fk": { 1422 + "name": "incident_acknowledged_by_user_id_fk", 1423 + "tableFrom": "incident", 1424 + "tableTo": "user", 1425 + "columnsFrom": [ 1426 + "acknowledged_by" 1427 + ], 1428 + "columnsTo": [ 1429 + "id" 1430 + ], 1431 + "onDelete": "no action", 1432 + "onUpdate": "no action" 1433 + }, 1434 + "incident_resolved_by_user_id_fk": { 1435 + "name": "incident_resolved_by_user_id_fk", 1436 + "tableFrom": "incident", 1437 + "tableTo": "user", 1438 + "columnsFrom": [ 1439 + "resolved_by" 1440 + ], 1441 + "columnsTo": [ 1442 + "id" 1443 + ], 1444 + "onDelete": "no action", 1445 + "onUpdate": "no action" 1446 + } 1447 + }, 1448 + "compositePrimaryKeys": {}, 1449 + "uniqueConstraints": {} 1450 + } 1451 + }, 1452 + "enums": {}, 1453 + "_meta": { 1454 + "schemas": {}, 1455 + "tables": {}, 1456 + "columns": {} 1457 + } 1458 + }
+8 -1
packages/db/drizzle/meta/_journal.json
··· 120 120 "when": 1706111184826, 121 121 "tag": "0016_certain_praxagora", 122 122 "breakpoints": true 123 + }, 124 + { 125 + "idx": 17, 126 + "version": "5", 127 + "when": 1707411900987, 128 + "tag": "0017_loose_maggott", 129 + "breakpoints": true 123 130 } 124 131 ] 125 - } 132 + }
+3
packages/db/src/schema/monitors/monitor.ts
··· 67 67 pageId: integer("page_id") 68 68 .notNull() 69 69 .references(() => page.id, { onDelete: "cascade" }), 70 + createdAt: integer("created_at", { mode: "timestamp" }).default( 71 + sql`(strftime('%s', 'now'))`, 72 + ), 70 73 }, 71 74 (t) => ({ 72 75 pk: primaryKey(t.monitorId, t.pageId),
+3
packages/db/src/schema/notifications/notification.ts
··· 33 33 notificationId: integer("notification_id") 34 34 .notNull() 35 35 .references(() => notification.id, { onDelete: "cascade" }), 36 + createdAt: integer("created_at", { mode: "timestamp" }).default( 37 + sql`(strftime('%s', 'now'))`, 38 + ), 36 39 }, 37 40 (t) => ({ 38 41 pk: primaryKey(t.monitorId, t.notificationId),
+6
packages/db/src/schema/status_reports/status_reports.ts
··· 82 82 statusReportId: integer("status_report_id") 83 83 .notNull() 84 84 .references(() => statusReport.id, { onDelete: "cascade" }), 85 + createdAt: integer("created_at", { mode: "timestamp" }).default( 86 + sql`(strftime('%s', 'now'))`, 87 + ), 85 88 }, 86 89 (t) => ({ 87 90 pk: primaryKey(t.monitorId, t.statusReportId), ··· 111 114 statusReportId: integer("status_report_id") 112 115 .notNull() 113 116 .references(() => statusReport.id, { onDelete: "cascade" }), 117 + createdAt: integer("created_at", { mode: "timestamp" }).default( 118 + sql`(strftime('%s', 'now'))`, 119 + ), 114 120 }, 115 121 (t) => ({ 116 122 pk: primaryKey(t.pageId, t.statusReportId),
+3
packages/db/src/schema/users/user.ts
··· 39 39 .notNull() 40 40 .references(() => workspace.id), 41 41 role: text("role", { enum: workspaceRole }).notNull().default("member"), 42 + createdAt: integer("created_at", { mode: "timestamp" }).default( 43 + sql`(strftime('%s', 'now'))`, 44 + ), 42 45 }, 43 46 (t) => ({ 44 47 pk: primaryKey(t.userId, t.workspaceId),