WIP! A BB-style forum, on the ATmosphere! We're still working... we'll be back soon when we have something to show off!
node typescript hono htmx atproto

feat(db): add themes, theme_policies, theme_policy_available_themes tables

Generate Postgres (0013) and SQLite (0001) migrations for the three new
theme tables. Build @atbb/db to verify schema compiles correctly.

+3113
+35
apps/appview/drizzle-sqlite/0001_add_theme_tables.sql
···
··· 1 + CREATE TABLE `theme_policies` ( 2 + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, 3 + `did` text NOT NULL, 4 + `rkey` text NOT NULL, 5 + `cid` text NOT NULL, 6 + `default_light_theme_uri` text NOT NULL, 7 + `default_dark_theme_uri` text NOT NULL, 8 + `allow_user_choice` integer NOT NULL, 9 + `indexed_at` integer NOT NULL 10 + ); 11 + --> statement-breakpoint 12 + CREATE UNIQUE INDEX `theme_policies_did_rkey_idx` ON `theme_policies` (`did`,`rkey`);--> statement-breakpoint 13 + CREATE TABLE `theme_policy_available_themes` ( 14 + `policy_id` integer NOT NULL, 15 + `theme_uri` text NOT NULL, 16 + `theme_cid` text NOT NULL, 17 + PRIMARY KEY(`policy_id`, `theme_uri`), 18 + FOREIGN KEY (`policy_id`) REFERENCES `theme_policies`(`id`) ON UPDATE no action ON DELETE cascade 19 + ); 20 + --> statement-breakpoint 21 + CREATE TABLE `themes` ( 22 + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, 23 + `did` text NOT NULL, 24 + `rkey` text NOT NULL, 25 + `cid` text NOT NULL, 26 + `name` text NOT NULL, 27 + `color_scheme` text NOT NULL, 28 + `tokens` text NOT NULL, 29 + `css_overrides` text, 30 + `font_urls` text, 31 + `created_at` integer NOT NULL, 32 + `indexed_at` integer NOT NULL 33 + ); 34 + --> statement-breakpoint 35 + CREATE UNIQUE INDEX `themes_did_rkey_idx` ON `themes` (`did`,`rkey`);
+1396
apps/appview/drizzle-sqlite/meta/0001_snapshot.json
···
··· 1 + { 2 + "version": "6", 3 + "dialect": "sqlite", 4 + "id": "8aa48416-5eb6-492c-8206-e1f32f752f5a", 5 + "prevId": "84f6d742-677b-4159-86e3-9c5abadccec5", 6 + "tables": { 7 + "backfill_errors": { 8 + "name": "backfill_errors", 9 + "columns": { 10 + "id": { 11 + "name": "id", 12 + "type": "integer", 13 + "primaryKey": true, 14 + "notNull": true, 15 + "autoincrement": true 16 + }, 17 + "backfill_id": { 18 + "name": "backfill_id", 19 + "type": "integer", 20 + "primaryKey": false, 21 + "notNull": true, 22 + "autoincrement": false 23 + }, 24 + "did": { 25 + "name": "did", 26 + "type": "text", 27 + "primaryKey": false, 28 + "notNull": true, 29 + "autoincrement": false 30 + }, 31 + "collection": { 32 + "name": "collection", 33 + "type": "text", 34 + "primaryKey": false, 35 + "notNull": true, 36 + "autoincrement": false 37 + }, 38 + "error_message": { 39 + "name": "error_message", 40 + "type": "text", 41 + "primaryKey": false, 42 + "notNull": true, 43 + "autoincrement": false 44 + }, 45 + "created_at": { 46 + "name": "created_at", 47 + "type": "integer", 48 + "primaryKey": false, 49 + "notNull": true, 50 + "autoincrement": false 51 + } 52 + }, 53 + "indexes": { 54 + "backfill_errors_backfill_id_idx": { 55 + "name": "backfill_errors_backfill_id_idx", 56 + "columns": [ 57 + "backfill_id" 58 + ], 59 + "isUnique": false 60 + } 61 + }, 62 + "foreignKeys": { 63 + "backfill_errors_backfill_id_backfill_progress_id_fk": { 64 + "name": "backfill_errors_backfill_id_backfill_progress_id_fk", 65 + "tableFrom": "backfill_errors", 66 + "tableTo": "backfill_progress", 67 + "columnsFrom": [ 68 + "backfill_id" 69 + ], 70 + "columnsTo": [ 71 + "id" 72 + ], 73 + "onDelete": "no action", 74 + "onUpdate": "no action" 75 + } 76 + }, 77 + "compositePrimaryKeys": {}, 78 + "uniqueConstraints": {}, 79 + "checkConstraints": {} 80 + }, 81 + "backfill_progress": { 82 + "name": "backfill_progress", 83 + "columns": { 84 + "id": { 85 + "name": "id", 86 + "type": "integer", 87 + "primaryKey": true, 88 + "notNull": true, 89 + "autoincrement": true 90 + }, 91 + "status": { 92 + "name": "status", 93 + "type": "text", 94 + "primaryKey": false, 95 + "notNull": true, 96 + "autoincrement": false 97 + }, 98 + "backfill_type": { 99 + "name": "backfill_type", 100 + "type": "text", 101 + "primaryKey": false, 102 + "notNull": true, 103 + "autoincrement": false 104 + }, 105 + "last_processed_did": { 106 + "name": "last_processed_did", 107 + "type": "text", 108 + "primaryKey": false, 109 + "notNull": false, 110 + "autoincrement": false 111 + }, 112 + "dids_total": { 113 + "name": "dids_total", 114 + "type": "integer", 115 + "primaryKey": false, 116 + "notNull": true, 117 + "autoincrement": false, 118 + "default": 0 119 + }, 120 + "dids_processed": { 121 + "name": "dids_processed", 122 + "type": "integer", 123 + "primaryKey": false, 124 + "notNull": true, 125 + "autoincrement": false, 126 + "default": 0 127 + }, 128 + "records_indexed": { 129 + "name": "records_indexed", 130 + "type": "integer", 131 + "primaryKey": false, 132 + "notNull": true, 133 + "autoincrement": false, 134 + "default": 0 135 + }, 136 + "started_at": { 137 + "name": "started_at", 138 + "type": "integer", 139 + "primaryKey": false, 140 + "notNull": true, 141 + "autoincrement": false 142 + }, 143 + "completed_at": { 144 + "name": "completed_at", 145 + "type": "integer", 146 + "primaryKey": false, 147 + "notNull": false, 148 + "autoincrement": false 149 + }, 150 + "error_message": { 151 + "name": "error_message", 152 + "type": "text", 153 + "primaryKey": false, 154 + "notNull": false, 155 + "autoincrement": false 156 + } 157 + }, 158 + "indexes": {}, 159 + "foreignKeys": {}, 160 + "compositePrimaryKeys": {}, 161 + "uniqueConstraints": {}, 162 + "checkConstraints": {} 163 + }, 164 + "boards": { 165 + "name": "boards", 166 + "columns": { 167 + "id": { 168 + "name": "id", 169 + "type": "integer", 170 + "primaryKey": true, 171 + "notNull": true, 172 + "autoincrement": true 173 + }, 174 + "did": { 175 + "name": "did", 176 + "type": "text", 177 + "primaryKey": false, 178 + "notNull": true, 179 + "autoincrement": false 180 + }, 181 + "rkey": { 182 + "name": "rkey", 183 + "type": "text", 184 + "primaryKey": false, 185 + "notNull": true, 186 + "autoincrement": false 187 + }, 188 + "cid": { 189 + "name": "cid", 190 + "type": "text", 191 + "primaryKey": false, 192 + "notNull": true, 193 + "autoincrement": false 194 + }, 195 + "name": { 196 + "name": "name", 197 + "type": "text", 198 + "primaryKey": false, 199 + "notNull": true, 200 + "autoincrement": false 201 + }, 202 + "description": { 203 + "name": "description", 204 + "type": "text", 205 + "primaryKey": false, 206 + "notNull": false, 207 + "autoincrement": false 208 + }, 209 + "slug": { 210 + "name": "slug", 211 + "type": "text", 212 + "primaryKey": false, 213 + "notNull": false, 214 + "autoincrement": false 215 + }, 216 + "sort_order": { 217 + "name": "sort_order", 218 + "type": "integer", 219 + "primaryKey": false, 220 + "notNull": false, 221 + "autoincrement": false 222 + }, 223 + "category_id": { 224 + "name": "category_id", 225 + "type": "integer", 226 + "primaryKey": false, 227 + "notNull": false, 228 + "autoincrement": false 229 + }, 230 + "category_uri": { 231 + "name": "category_uri", 232 + "type": "text", 233 + "primaryKey": false, 234 + "notNull": true, 235 + "autoincrement": false 236 + }, 237 + "created_at": { 238 + "name": "created_at", 239 + "type": "integer", 240 + "primaryKey": false, 241 + "notNull": true, 242 + "autoincrement": false 243 + }, 244 + "indexed_at": { 245 + "name": "indexed_at", 246 + "type": "integer", 247 + "primaryKey": false, 248 + "notNull": true, 249 + "autoincrement": false 250 + } 251 + }, 252 + "indexes": { 253 + "boards_did_rkey_idx": { 254 + "name": "boards_did_rkey_idx", 255 + "columns": [ 256 + "did", 257 + "rkey" 258 + ], 259 + "isUnique": true 260 + }, 261 + "boards_category_id_idx": { 262 + "name": "boards_category_id_idx", 263 + "columns": [ 264 + "category_id" 265 + ], 266 + "isUnique": false 267 + } 268 + }, 269 + "foreignKeys": { 270 + "boards_category_id_categories_id_fk": { 271 + "name": "boards_category_id_categories_id_fk", 272 + "tableFrom": "boards", 273 + "tableTo": "categories", 274 + "columnsFrom": [ 275 + "category_id" 276 + ], 277 + "columnsTo": [ 278 + "id" 279 + ], 280 + "onDelete": "no action", 281 + "onUpdate": "no action" 282 + } 283 + }, 284 + "compositePrimaryKeys": {}, 285 + "uniqueConstraints": {}, 286 + "checkConstraints": {} 287 + }, 288 + "categories": { 289 + "name": "categories", 290 + "columns": { 291 + "id": { 292 + "name": "id", 293 + "type": "integer", 294 + "primaryKey": true, 295 + "notNull": true, 296 + "autoincrement": true 297 + }, 298 + "did": { 299 + "name": "did", 300 + "type": "text", 301 + "primaryKey": false, 302 + "notNull": true, 303 + "autoincrement": false 304 + }, 305 + "rkey": { 306 + "name": "rkey", 307 + "type": "text", 308 + "primaryKey": false, 309 + "notNull": true, 310 + "autoincrement": false 311 + }, 312 + "cid": { 313 + "name": "cid", 314 + "type": "text", 315 + "primaryKey": false, 316 + "notNull": true, 317 + "autoincrement": false 318 + }, 319 + "name": { 320 + "name": "name", 321 + "type": "text", 322 + "primaryKey": false, 323 + "notNull": true, 324 + "autoincrement": false 325 + }, 326 + "description": { 327 + "name": "description", 328 + "type": "text", 329 + "primaryKey": false, 330 + "notNull": false, 331 + "autoincrement": false 332 + }, 333 + "slug": { 334 + "name": "slug", 335 + "type": "text", 336 + "primaryKey": false, 337 + "notNull": false, 338 + "autoincrement": false 339 + }, 340 + "sort_order": { 341 + "name": "sort_order", 342 + "type": "integer", 343 + "primaryKey": false, 344 + "notNull": false, 345 + "autoincrement": false 346 + }, 347 + "forum_id": { 348 + "name": "forum_id", 349 + "type": "integer", 350 + "primaryKey": false, 351 + "notNull": false, 352 + "autoincrement": false 353 + }, 354 + "created_at": { 355 + "name": "created_at", 356 + "type": "integer", 357 + "primaryKey": false, 358 + "notNull": true, 359 + "autoincrement": false 360 + }, 361 + "indexed_at": { 362 + "name": "indexed_at", 363 + "type": "integer", 364 + "primaryKey": false, 365 + "notNull": true, 366 + "autoincrement": false 367 + } 368 + }, 369 + "indexes": { 370 + "categories_did_rkey_idx": { 371 + "name": "categories_did_rkey_idx", 372 + "columns": [ 373 + "did", 374 + "rkey" 375 + ], 376 + "isUnique": true 377 + } 378 + }, 379 + "foreignKeys": { 380 + "categories_forum_id_forums_id_fk": { 381 + "name": "categories_forum_id_forums_id_fk", 382 + "tableFrom": "categories", 383 + "tableTo": "forums", 384 + "columnsFrom": [ 385 + "forum_id" 386 + ], 387 + "columnsTo": [ 388 + "id" 389 + ], 390 + "onDelete": "no action", 391 + "onUpdate": "no action" 392 + } 393 + }, 394 + "compositePrimaryKeys": {}, 395 + "uniqueConstraints": {}, 396 + "checkConstraints": {} 397 + }, 398 + "firehose_cursor": { 399 + "name": "firehose_cursor", 400 + "columns": { 401 + "service": { 402 + "name": "service", 403 + "type": "text", 404 + "primaryKey": true, 405 + "notNull": true, 406 + "autoincrement": false, 407 + "default": "'jetstream'" 408 + }, 409 + "cursor": { 410 + "name": "cursor", 411 + "type": "integer", 412 + "primaryKey": false, 413 + "notNull": true, 414 + "autoincrement": false 415 + }, 416 + "updated_at": { 417 + "name": "updated_at", 418 + "type": "integer", 419 + "primaryKey": false, 420 + "notNull": true, 421 + "autoincrement": false 422 + } 423 + }, 424 + "indexes": {}, 425 + "foreignKeys": {}, 426 + "compositePrimaryKeys": {}, 427 + "uniqueConstraints": {}, 428 + "checkConstraints": {} 429 + }, 430 + "forums": { 431 + "name": "forums", 432 + "columns": { 433 + "id": { 434 + "name": "id", 435 + "type": "integer", 436 + "primaryKey": true, 437 + "notNull": true, 438 + "autoincrement": true 439 + }, 440 + "did": { 441 + "name": "did", 442 + "type": "text", 443 + "primaryKey": false, 444 + "notNull": true, 445 + "autoincrement": false 446 + }, 447 + "rkey": { 448 + "name": "rkey", 449 + "type": "text", 450 + "primaryKey": false, 451 + "notNull": true, 452 + "autoincrement": false 453 + }, 454 + "cid": { 455 + "name": "cid", 456 + "type": "text", 457 + "primaryKey": false, 458 + "notNull": true, 459 + "autoincrement": false 460 + }, 461 + "name": { 462 + "name": "name", 463 + "type": "text", 464 + "primaryKey": false, 465 + "notNull": true, 466 + "autoincrement": false 467 + }, 468 + "description": { 469 + "name": "description", 470 + "type": "text", 471 + "primaryKey": false, 472 + "notNull": false, 473 + "autoincrement": false 474 + }, 475 + "indexed_at": { 476 + "name": "indexed_at", 477 + "type": "integer", 478 + "primaryKey": false, 479 + "notNull": true, 480 + "autoincrement": false 481 + } 482 + }, 483 + "indexes": { 484 + "forums_did_rkey_idx": { 485 + "name": "forums_did_rkey_idx", 486 + "columns": [ 487 + "did", 488 + "rkey" 489 + ], 490 + "isUnique": true 491 + } 492 + }, 493 + "foreignKeys": {}, 494 + "compositePrimaryKeys": {}, 495 + "uniqueConstraints": {}, 496 + "checkConstraints": {} 497 + }, 498 + "memberships": { 499 + "name": "memberships", 500 + "columns": { 501 + "id": { 502 + "name": "id", 503 + "type": "integer", 504 + "primaryKey": true, 505 + "notNull": true, 506 + "autoincrement": true 507 + }, 508 + "did": { 509 + "name": "did", 510 + "type": "text", 511 + "primaryKey": false, 512 + "notNull": true, 513 + "autoincrement": false 514 + }, 515 + "rkey": { 516 + "name": "rkey", 517 + "type": "text", 518 + "primaryKey": false, 519 + "notNull": true, 520 + "autoincrement": false 521 + }, 522 + "cid": { 523 + "name": "cid", 524 + "type": "text", 525 + "primaryKey": false, 526 + "notNull": true, 527 + "autoincrement": false 528 + }, 529 + "forum_id": { 530 + "name": "forum_id", 531 + "type": "integer", 532 + "primaryKey": false, 533 + "notNull": false, 534 + "autoincrement": false 535 + }, 536 + "forum_uri": { 537 + "name": "forum_uri", 538 + "type": "text", 539 + "primaryKey": false, 540 + "notNull": true, 541 + "autoincrement": false 542 + }, 543 + "role": { 544 + "name": "role", 545 + "type": "text", 546 + "primaryKey": false, 547 + "notNull": false, 548 + "autoincrement": false 549 + }, 550 + "role_uri": { 551 + "name": "role_uri", 552 + "type": "text", 553 + "primaryKey": false, 554 + "notNull": false, 555 + "autoincrement": false 556 + }, 557 + "joined_at": { 558 + "name": "joined_at", 559 + "type": "integer", 560 + "primaryKey": false, 561 + "notNull": false, 562 + "autoincrement": false 563 + }, 564 + "created_at": { 565 + "name": "created_at", 566 + "type": "integer", 567 + "primaryKey": false, 568 + "notNull": true, 569 + "autoincrement": false 570 + }, 571 + "indexed_at": { 572 + "name": "indexed_at", 573 + "type": "integer", 574 + "primaryKey": false, 575 + "notNull": true, 576 + "autoincrement": false 577 + } 578 + }, 579 + "indexes": { 580 + "memberships_did_rkey_idx": { 581 + "name": "memberships_did_rkey_idx", 582 + "columns": [ 583 + "did", 584 + "rkey" 585 + ], 586 + "isUnique": true 587 + }, 588 + "memberships_did_idx": { 589 + "name": "memberships_did_idx", 590 + "columns": [ 591 + "did" 592 + ], 593 + "isUnique": false 594 + } 595 + }, 596 + "foreignKeys": { 597 + "memberships_did_users_did_fk": { 598 + "name": "memberships_did_users_did_fk", 599 + "tableFrom": "memberships", 600 + "tableTo": "users", 601 + "columnsFrom": [ 602 + "did" 603 + ], 604 + "columnsTo": [ 605 + "did" 606 + ], 607 + "onDelete": "no action", 608 + "onUpdate": "no action" 609 + }, 610 + "memberships_forum_id_forums_id_fk": { 611 + "name": "memberships_forum_id_forums_id_fk", 612 + "tableFrom": "memberships", 613 + "tableTo": "forums", 614 + "columnsFrom": [ 615 + "forum_id" 616 + ], 617 + "columnsTo": [ 618 + "id" 619 + ], 620 + "onDelete": "no action", 621 + "onUpdate": "no action" 622 + } 623 + }, 624 + "compositePrimaryKeys": {}, 625 + "uniqueConstraints": {}, 626 + "checkConstraints": {} 627 + }, 628 + "mod_actions": { 629 + "name": "mod_actions", 630 + "columns": { 631 + "id": { 632 + "name": "id", 633 + "type": "integer", 634 + "primaryKey": true, 635 + "notNull": true, 636 + "autoincrement": true 637 + }, 638 + "did": { 639 + "name": "did", 640 + "type": "text", 641 + "primaryKey": false, 642 + "notNull": true, 643 + "autoincrement": false 644 + }, 645 + "rkey": { 646 + "name": "rkey", 647 + "type": "text", 648 + "primaryKey": false, 649 + "notNull": true, 650 + "autoincrement": false 651 + }, 652 + "cid": { 653 + "name": "cid", 654 + "type": "text", 655 + "primaryKey": false, 656 + "notNull": true, 657 + "autoincrement": false 658 + }, 659 + "action": { 660 + "name": "action", 661 + "type": "text", 662 + "primaryKey": false, 663 + "notNull": true, 664 + "autoincrement": false 665 + }, 666 + "subject_did": { 667 + "name": "subject_did", 668 + "type": "text", 669 + "primaryKey": false, 670 + "notNull": false, 671 + "autoincrement": false 672 + }, 673 + "subject_post_uri": { 674 + "name": "subject_post_uri", 675 + "type": "text", 676 + "primaryKey": false, 677 + "notNull": false, 678 + "autoincrement": false 679 + }, 680 + "forum_id": { 681 + "name": "forum_id", 682 + "type": "integer", 683 + "primaryKey": false, 684 + "notNull": false, 685 + "autoincrement": false 686 + }, 687 + "reason": { 688 + "name": "reason", 689 + "type": "text", 690 + "primaryKey": false, 691 + "notNull": false, 692 + "autoincrement": false 693 + }, 694 + "created_by": { 695 + "name": "created_by", 696 + "type": "text", 697 + "primaryKey": false, 698 + "notNull": true, 699 + "autoincrement": false 700 + }, 701 + "expires_at": { 702 + "name": "expires_at", 703 + "type": "integer", 704 + "primaryKey": false, 705 + "notNull": false, 706 + "autoincrement": false 707 + }, 708 + "created_at": { 709 + "name": "created_at", 710 + "type": "integer", 711 + "primaryKey": false, 712 + "notNull": true, 713 + "autoincrement": false 714 + }, 715 + "indexed_at": { 716 + "name": "indexed_at", 717 + "type": "integer", 718 + "primaryKey": false, 719 + "notNull": true, 720 + "autoincrement": false 721 + } 722 + }, 723 + "indexes": { 724 + "mod_actions_did_rkey_idx": { 725 + "name": "mod_actions_did_rkey_idx", 726 + "columns": [ 727 + "did", 728 + "rkey" 729 + ], 730 + "isUnique": true 731 + }, 732 + "mod_actions_subject_did_idx": { 733 + "name": "mod_actions_subject_did_idx", 734 + "columns": [ 735 + "subject_did" 736 + ], 737 + "isUnique": false 738 + }, 739 + "mod_actions_subject_post_uri_idx": { 740 + "name": "mod_actions_subject_post_uri_idx", 741 + "columns": [ 742 + "subject_post_uri" 743 + ], 744 + "isUnique": false 745 + } 746 + }, 747 + "foreignKeys": { 748 + "mod_actions_forum_id_forums_id_fk": { 749 + "name": "mod_actions_forum_id_forums_id_fk", 750 + "tableFrom": "mod_actions", 751 + "tableTo": "forums", 752 + "columnsFrom": [ 753 + "forum_id" 754 + ], 755 + "columnsTo": [ 756 + "id" 757 + ], 758 + "onDelete": "no action", 759 + "onUpdate": "no action" 760 + } 761 + }, 762 + "compositePrimaryKeys": {}, 763 + "uniqueConstraints": {}, 764 + "checkConstraints": {} 765 + }, 766 + "posts": { 767 + "name": "posts", 768 + "columns": { 769 + "id": { 770 + "name": "id", 771 + "type": "integer", 772 + "primaryKey": true, 773 + "notNull": true, 774 + "autoincrement": true 775 + }, 776 + "did": { 777 + "name": "did", 778 + "type": "text", 779 + "primaryKey": false, 780 + "notNull": true, 781 + "autoincrement": false 782 + }, 783 + "rkey": { 784 + "name": "rkey", 785 + "type": "text", 786 + "primaryKey": false, 787 + "notNull": true, 788 + "autoincrement": false 789 + }, 790 + "cid": { 791 + "name": "cid", 792 + "type": "text", 793 + "primaryKey": false, 794 + "notNull": true, 795 + "autoincrement": false 796 + }, 797 + "title": { 798 + "name": "title", 799 + "type": "text", 800 + "primaryKey": false, 801 + "notNull": false, 802 + "autoincrement": false 803 + }, 804 + "text": { 805 + "name": "text", 806 + "type": "text", 807 + "primaryKey": false, 808 + "notNull": true, 809 + "autoincrement": false 810 + }, 811 + "forum_uri": { 812 + "name": "forum_uri", 813 + "type": "text", 814 + "primaryKey": false, 815 + "notNull": false, 816 + "autoincrement": false 817 + }, 818 + "board_uri": { 819 + "name": "board_uri", 820 + "type": "text", 821 + "primaryKey": false, 822 + "notNull": false, 823 + "autoincrement": false 824 + }, 825 + "board_id": { 826 + "name": "board_id", 827 + "type": "integer", 828 + "primaryKey": false, 829 + "notNull": false, 830 + "autoincrement": false 831 + }, 832 + "root_post_id": { 833 + "name": "root_post_id", 834 + "type": "integer", 835 + "primaryKey": false, 836 + "notNull": false, 837 + "autoincrement": false 838 + }, 839 + "parent_post_id": { 840 + "name": "parent_post_id", 841 + "type": "integer", 842 + "primaryKey": false, 843 + "notNull": false, 844 + "autoincrement": false 845 + }, 846 + "root_uri": { 847 + "name": "root_uri", 848 + "type": "text", 849 + "primaryKey": false, 850 + "notNull": false, 851 + "autoincrement": false 852 + }, 853 + "parent_uri": { 854 + "name": "parent_uri", 855 + "type": "text", 856 + "primaryKey": false, 857 + "notNull": false, 858 + "autoincrement": false 859 + }, 860 + "created_at": { 861 + "name": "created_at", 862 + "type": "integer", 863 + "primaryKey": false, 864 + "notNull": true, 865 + "autoincrement": false 866 + }, 867 + "indexed_at": { 868 + "name": "indexed_at", 869 + "type": "integer", 870 + "primaryKey": false, 871 + "notNull": true, 872 + "autoincrement": false 873 + }, 874 + "banned_by_mod": { 875 + "name": "banned_by_mod", 876 + "type": "integer", 877 + "primaryKey": false, 878 + "notNull": true, 879 + "autoincrement": false, 880 + "default": false 881 + }, 882 + "deleted_by_user": { 883 + "name": "deleted_by_user", 884 + "type": "integer", 885 + "primaryKey": false, 886 + "notNull": true, 887 + "autoincrement": false, 888 + "default": false 889 + } 890 + }, 891 + "indexes": { 892 + "posts_did_rkey_idx": { 893 + "name": "posts_did_rkey_idx", 894 + "columns": [ 895 + "did", 896 + "rkey" 897 + ], 898 + "isUnique": true 899 + }, 900 + "posts_forum_uri_idx": { 901 + "name": "posts_forum_uri_idx", 902 + "columns": [ 903 + "forum_uri" 904 + ], 905 + "isUnique": false 906 + }, 907 + "posts_board_id_idx": { 908 + "name": "posts_board_id_idx", 909 + "columns": [ 910 + "board_id" 911 + ], 912 + "isUnique": false 913 + }, 914 + "posts_board_uri_idx": { 915 + "name": "posts_board_uri_idx", 916 + "columns": [ 917 + "board_uri" 918 + ], 919 + "isUnique": false 920 + }, 921 + "posts_root_post_id_idx": { 922 + "name": "posts_root_post_id_idx", 923 + "columns": [ 924 + "root_post_id" 925 + ], 926 + "isUnique": false 927 + } 928 + }, 929 + "foreignKeys": { 930 + "posts_did_users_did_fk": { 931 + "name": "posts_did_users_did_fk", 932 + "tableFrom": "posts", 933 + "tableTo": "users", 934 + "columnsFrom": [ 935 + "did" 936 + ], 937 + "columnsTo": [ 938 + "did" 939 + ], 940 + "onDelete": "no action", 941 + "onUpdate": "no action" 942 + }, 943 + "posts_board_id_boards_id_fk": { 944 + "name": "posts_board_id_boards_id_fk", 945 + "tableFrom": "posts", 946 + "tableTo": "boards", 947 + "columnsFrom": [ 948 + "board_id" 949 + ], 950 + "columnsTo": [ 951 + "id" 952 + ], 953 + "onDelete": "no action", 954 + "onUpdate": "no action" 955 + }, 956 + "posts_root_post_id_posts_id_fk": { 957 + "name": "posts_root_post_id_posts_id_fk", 958 + "tableFrom": "posts", 959 + "tableTo": "posts", 960 + "columnsFrom": [ 961 + "root_post_id" 962 + ], 963 + "columnsTo": [ 964 + "id" 965 + ], 966 + "onDelete": "no action", 967 + "onUpdate": "no action" 968 + }, 969 + "posts_parent_post_id_posts_id_fk": { 970 + "name": "posts_parent_post_id_posts_id_fk", 971 + "tableFrom": "posts", 972 + "tableTo": "posts", 973 + "columnsFrom": [ 974 + "parent_post_id" 975 + ], 976 + "columnsTo": [ 977 + "id" 978 + ], 979 + "onDelete": "no action", 980 + "onUpdate": "no action" 981 + } 982 + }, 983 + "compositePrimaryKeys": {}, 984 + "uniqueConstraints": {}, 985 + "checkConstraints": {} 986 + }, 987 + "role_permissions": { 988 + "name": "role_permissions", 989 + "columns": { 990 + "role_id": { 991 + "name": "role_id", 992 + "type": "integer", 993 + "primaryKey": false, 994 + "notNull": true, 995 + "autoincrement": false 996 + }, 997 + "permission": { 998 + "name": "permission", 999 + "type": "text", 1000 + "primaryKey": false, 1001 + "notNull": true, 1002 + "autoincrement": false 1003 + } 1004 + }, 1005 + "indexes": {}, 1006 + "foreignKeys": { 1007 + "role_permissions_role_id_roles_id_fk": { 1008 + "name": "role_permissions_role_id_roles_id_fk", 1009 + "tableFrom": "role_permissions", 1010 + "tableTo": "roles", 1011 + "columnsFrom": [ 1012 + "role_id" 1013 + ], 1014 + "columnsTo": [ 1015 + "id" 1016 + ], 1017 + "onDelete": "cascade", 1018 + "onUpdate": "no action" 1019 + } 1020 + }, 1021 + "compositePrimaryKeys": { 1022 + "role_permissions_role_id_permission_pk": { 1023 + "columns": [ 1024 + "role_id", 1025 + "permission" 1026 + ], 1027 + "name": "role_permissions_role_id_permission_pk" 1028 + } 1029 + }, 1030 + "uniqueConstraints": {}, 1031 + "checkConstraints": {} 1032 + }, 1033 + "roles": { 1034 + "name": "roles", 1035 + "columns": { 1036 + "id": { 1037 + "name": "id", 1038 + "type": "integer", 1039 + "primaryKey": true, 1040 + "notNull": true, 1041 + "autoincrement": true 1042 + }, 1043 + "did": { 1044 + "name": "did", 1045 + "type": "text", 1046 + "primaryKey": false, 1047 + "notNull": true, 1048 + "autoincrement": false 1049 + }, 1050 + "rkey": { 1051 + "name": "rkey", 1052 + "type": "text", 1053 + "primaryKey": false, 1054 + "notNull": true, 1055 + "autoincrement": false 1056 + }, 1057 + "cid": { 1058 + "name": "cid", 1059 + "type": "text", 1060 + "primaryKey": false, 1061 + "notNull": true, 1062 + "autoincrement": false 1063 + }, 1064 + "name": { 1065 + "name": "name", 1066 + "type": "text", 1067 + "primaryKey": false, 1068 + "notNull": true, 1069 + "autoincrement": false 1070 + }, 1071 + "description": { 1072 + "name": "description", 1073 + "type": "text", 1074 + "primaryKey": false, 1075 + "notNull": false, 1076 + "autoincrement": false 1077 + }, 1078 + "priority": { 1079 + "name": "priority", 1080 + "type": "integer", 1081 + "primaryKey": false, 1082 + "notNull": true, 1083 + "autoincrement": false 1084 + }, 1085 + "created_at": { 1086 + "name": "created_at", 1087 + "type": "integer", 1088 + "primaryKey": false, 1089 + "notNull": true, 1090 + "autoincrement": false 1091 + }, 1092 + "indexed_at": { 1093 + "name": "indexed_at", 1094 + "type": "integer", 1095 + "primaryKey": false, 1096 + "notNull": true, 1097 + "autoincrement": false 1098 + } 1099 + }, 1100 + "indexes": { 1101 + "roles_did_rkey_idx": { 1102 + "name": "roles_did_rkey_idx", 1103 + "columns": [ 1104 + "did", 1105 + "rkey" 1106 + ], 1107 + "isUnique": true 1108 + }, 1109 + "roles_did_idx": { 1110 + "name": "roles_did_idx", 1111 + "columns": [ 1112 + "did" 1113 + ], 1114 + "isUnique": false 1115 + }, 1116 + "roles_did_name_idx": { 1117 + "name": "roles_did_name_idx", 1118 + "columns": [ 1119 + "did", 1120 + "name" 1121 + ], 1122 + "isUnique": false 1123 + } 1124 + }, 1125 + "foreignKeys": {}, 1126 + "compositePrimaryKeys": {}, 1127 + "uniqueConstraints": {}, 1128 + "checkConstraints": {} 1129 + }, 1130 + "theme_policies": { 1131 + "name": "theme_policies", 1132 + "columns": { 1133 + "id": { 1134 + "name": "id", 1135 + "type": "integer", 1136 + "primaryKey": true, 1137 + "notNull": true, 1138 + "autoincrement": true 1139 + }, 1140 + "did": { 1141 + "name": "did", 1142 + "type": "text", 1143 + "primaryKey": false, 1144 + "notNull": true, 1145 + "autoincrement": false 1146 + }, 1147 + "rkey": { 1148 + "name": "rkey", 1149 + "type": "text", 1150 + "primaryKey": false, 1151 + "notNull": true, 1152 + "autoincrement": false 1153 + }, 1154 + "cid": { 1155 + "name": "cid", 1156 + "type": "text", 1157 + "primaryKey": false, 1158 + "notNull": true, 1159 + "autoincrement": false 1160 + }, 1161 + "default_light_theme_uri": { 1162 + "name": "default_light_theme_uri", 1163 + "type": "text", 1164 + "primaryKey": false, 1165 + "notNull": true, 1166 + "autoincrement": false 1167 + }, 1168 + "default_dark_theme_uri": { 1169 + "name": "default_dark_theme_uri", 1170 + "type": "text", 1171 + "primaryKey": false, 1172 + "notNull": true, 1173 + "autoincrement": false 1174 + }, 1175 + "allow_user_choice": { 1176 + "name": "allow_user_choice", 1177 + "type": "integer", 1178 + "primaryKey": false, 1179 + "notNull": true, 1180 + "autoincrement": false 1181 + }, 1182 + "indexed_at": { 1183 + "name": "indexed_at", 1184 + "type": "integer", 1185 + "primaryKey": false, 1186 + "notNull": true, 1187 + "autoincrement": false 1188 + } 1189 + }, 1190 + "indexes": { 1191 + "theme_policies_did_rkey_idx": { 1192 + "name": "theme_policies_did_rkey_idx", 1193 + "columns": [ 1194 + "did", 1195 + "rkey" 1196 + ], 1197 + "isUnique": true 1198 + } 1199 + }, 1200 + "foreignKeys": {}, 1201 + "compositePrimaryKeys": {}, 1202 + "uniqueConstraints": {}, 1203 + "checkConstraints": {} 1204 + }, 1205 + "theme_policy_available_themes": { 1206 + "name": "theme_policy_available_themes", 1207 + "columns": { 1208 + "policy_id": { 1209 + "name": "policy_id", 1210 + "type": "integer", 1211 + "primaryKey": false, 1212 + "notNull": true, 1213 + "autoincrement": false 1214 + }, 1215 + "theme_uri": { 1216 + "name": "theme_uri", 1217 + "type": "text", 1218 + "primaryKey": false, 1219 + "notNull": true, 1220 + "autoincrement": false 1221 + }, 1222 + "theme_cid": { 1223 + "name": "theme_cid", 1224 + "type": "text", 1225 + "primaryKey": false, 1226 + "notNull": true, 1227 + "autoincrement": false 1228 + } 1229 + }, 1230 + "indexes": {}, 1231 + "foreignKeys": { 1232 + "theme_policy_available_themes_policy_id_theme_policies_id_fk": { 1233 + "name": "theme_policy_available_themes_policy_id_theme_policies_id_fk", 1234 + "tableFrom": "theme_policy_available_themes", 1235 + "tableTo": "theme_policies", 1236 + "columnsFrom": [ 1237 + "policy_id" 1238 + ], 1239 + "columnsTo": [ 1240 + "id" 1241 + ], 1242 + "onDelete": "cascade", 1243 + "onUpdate": "no action" 1244 + } 1245 + }, 1246 + "compositePrimaryKeys": { 1247 + "theme_policy_available_themes_policy_id_theme_uri_pk": { 1248 + "columns": [ 1249 + "policy_id", 1250 + "theme_uri" 1251 + ], 1252 + "name": "theme_policy_available_themes_policy_id_theme_uri_pk" 1253 + } 1254 + }, 1255 + "uniqueConstraints": {}, 1256 + "checkConstraints": {} 1257 + }, 1258 + "themes": { 1259 + "name": "themes", 1260 + "columns": { 1261 + "id": { 1262 + "name": "id", 1263 + "type": "integer", 1264 + "primaryKey": true, 1265 + "notNull": true, 1266 + "autoincrement": true 1267 + }, 1268 + "did": { 1269 + "name": "did", 1270 + "type": "text", 1271 + "primaryKey": false, 1272 + "notNull": true, 1273 + "autoincrement": false 1274 + }, 1275 + "rkey": { 1276 + "name": "rkey", 1277 + "type": "text", 1278 + "primaryKey": false, 1279 + "notNull": true, 1280 + "autoincrement": false 1281 + }, 1282 + "cid": { 1283 + "name": "cid", 1284 + "type": "text", 1285 + "primaryKey": false, 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 + "color_scheme": { 1297 + "name": "color_scheme", 1298 + "type": "text", 1299 + "primaryKey": false, 1300 + "notNull": true, 1301 + "autoincrement": false 1302 + }, 1303 + "tokens": { 1304 + "name": "tokens", 1305 + "type": "text", 1306 + "primaryKey": false, 1307 + "notNull": true, 1308 + "autoincrement": false 1309 + }, 1310 + "css_overrides": { 1311 + "name": "css_overrides", 1312 + "type": "text", 1313 + "primaryKey": false, 1314 + "notNull": false, 1315 + "autoincrement": false 1316 + }, 1317 + "font_urls": { 1318 + "name": "font_urls", 1319 + "type": "text", 1320 + "primaryKey": false, 1321 + "notNull": false, 1322 + "autoincrement": false 1323 + }, 1324 + "created_at": { 1325 + "name": "created_at", 1326 + "type": "integer", 1327 + "primaryKey": false, 1328 + "notNull": true, 1329 + "autoincrement": false 1330 + }, 1331 + "indexed_at": { 1332 + "name": "indexed_at", 1333 + "type": "integer", 1334 + "primaryKey": false, 1335 + "notNull": true, 1336 + "autoincrement": false 1337 + } 1338 + }, 1339 + "indexes": { 1340 + "themes_did_rkey_idx": { 1341 + "name": "themes_did_rkey_idx", 1342 + "columns": [ 1343 + "did", 1344 + "rkey" 1345 + ], 1346 + "isUnique": true 1347 + } 1348 + }, 1349 + "foreignKeys": {}, 1350 + "compositePrimaryKeys": {}, 1351 + "uniqueConstraints": {}, 1352 + "checkConstraints": {} 1353 + }, 1354 + "users": { 1355 + "name": "users", 1356 + "columns": { 1357 + "did": { 1358 + "name": "did", 1359 + "type": "text", 1360 + "primaryKey": true, 1361 + "notNull": true, 1362 + "autoincrement": false 1363 + }, 1364 + "handle": { 1365 + "name": "handle", 1366 + "type": "text", 1367 + "primaryKey": false, 1368 + "notNull": false, 1369 + "autoincrement": false 1370 + }, 1371 + "indexed_at": { 1372 + "name": "indexed_at", 1373 + "type": "integer", 1374 + "primaryKey": false, 1375 + "notNull": true, 1376 + "autoincrement": false 1377 + } 1378 + }, 1379 + "indexes": {}, 1380 + "foreignKeys": {}, 1381 + "compositePrimaryKeys": {}, 1382 + "uniqueConstraints": {}, 1383 + "checkConstraints": {} 1384 + } 1385 + }, 1386 + "views": {}, 1387 + "enums": {}, 1388 + "_meta": { 1389 + "schemas": {}, 1390 + "tables": {}, 1391 + "columns": {} 1392 + }, 1393 + "internal": { 1394 + "indexes": {} 1395 + } 1396 + }
+7
apps/appview/drizzle-sqlite/meta/_journal.json
··· 8 "when": 1772035997110, 9 "tag": "0000_thankful_mister_fear", 10 "breakpoints": true 11 } 12 ] 13 }
··· 8 "when": 1772035997110, 9 "tag": "0000_thankful_mister_fear", 10 "breakpoints": true 11 + }, 12 + { 13 + "idx": 1, 14 + "version": "6", 15 + "when": 1772482055726, 16 + "tag": "0001_add_theme_tables", 17 + "breakpoints": true 18 } 19 ] 20 }
+35
apps/appview/drizzle/0013_add_theme_tables.sql
···
··· 1 + CREATE TABLE "theme_policies" ( 2 + "id" bigserial PRIMARY KEY NOT NULL, 3 + "did" text NOT NULL, 4 + "rkey" text NOT NULL, 5 + "cid" text NOT NULL, 6 + "default_light_theme_uri" text NOT NULL, 7 + "default_dark_theme_uri" text NOT NULL, 8 + "allow_user_choice" boolean NOT NULL, 9 + "indexed_at" timestamp with time zone NOT NULL 10 + ); 11 + --> statement-breakpoint 12 + CREATE TABLE "theme_policy_available_themes" ( 13 + "policy_id" bigint NOT NULL, 14 + "theme_uri" text NOT NULL, 15 + "theme_cid" text NOT NULL, 16 + CONSTRAINT "theme_policy_available_themes_policy_id_theme_uri_pk" PRIMARY KEY("policy_id","theme_uri") 17 + ); 18 + --> statement-breakpoint 19 + CREATE TABLE "themes" ( 20 + "id" bigserial PRIMARY KEY NOT NULL, 21 + "did" text NOT NULL, 22 + "rkey" text NOT NULL, 23 + "cid" text NOT NULL, 24 + "name" text NOT NULL, 25 + "color_scheme" text NOT NULL, 26 + "tokens" jsonb NOT NULL, 27 + "css_overrides" text, 28 + "font_urls" text[], 29 + "created_at" timestamp with time zone NOT NULL, 30 + "indexed_at" timestamp with time zone NOT NULL 31 + ); 32 + --> statement-breakpoint 33 + ALTER TABLE "theme_policy_available_themes" ADD CONSTRAINT "theme_policy_available_themes_policy_id_theme_policies_id_fk" FOREIGN KEY ("policy_id") REFERENCES "public"."theme_policies"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint 34 + CREATE UNIQUE INDEX "theme_policies_did_rkey_idx" ON "theme_policies" USING btree ("did","rkey");--> statement-breakpoint 35 + CREATE UNIQUE INDEX "themes_did_rkey_idx" ON "themes" USING btree ("did","rkey");
+1526
apps/appview/drizzle/meta/0013_snapshot.json
···
··· 1 + { 2 + "id": "50219693-221b-49a6-8363-f9de0bf6afdd", 3 + "prevId": "0179c1d9-9fbb-4bc8-9606-475e10ba22dc", 4 + "version": "7", 5 + "dialect": "postgresql", 6 + "tables": { 7 + "public.backfill_errors": { 8 + "name": "backfill_errors", 9 + "schema": "", 10 + "columns": { 11 + "id": { 12 + "name": "id", 13 + "type": "bigserial", 14 + "primaryKey": true, 15 + "notNull": true 16 + }, 17 + "backfill_id": { 18 + "name": "backfill_id", 19 + "type": "bigint", 20 + "primaryKey": false, 21 + "notNull": true 22 + }, 23 + "did": { 24 + "name": "did", 25 + "type": "text", 26 + "primaryKey": false, 27 + "notNull": true 28 + }, 29 + "collection": { 30 + "name": "collection", 31 + "type": "text", 32 + "primaryKey": false, 33 + "notNull": true 34 + }, 35 + "error_message": { 36 + "name": "error_message", 37 + "type": "text", 38 + "primaryKey": false, 39 + "notNull": true 40 + }, 41 + "created_at": { 42 + "name": "created_at", 43 + "type": "timestamp with time zone", 44 + "primaryKey": false, 45 + "notNull": true 46 + } 47 + }, 48 + "indexes": { 49 + "backfill_errors_backfill_id_idx": { 50 + "name": "backfill_errors_backfill_id_idx", 51 + "columns": [ 52 + { 53 + "expression": "backfill_id", 54 + "isExpression": false, 55 + "asc": true, 56 + "nulls": "last" 57 + } 58 + ], 59 + "isUnique": false, 60 + "concurrently": false, 61 + "method": "btree", 62 + "with": {} 63 + } 64 + }, 65 + "foreignKeys": { 66 + "backfill_errors_backfill_id_backfill_progress_id_fk": { 67 + "name": "backfill_errors_backfill_id_backfill_progress_id_fk", 68 + "tableFrom": "backfill_errors", 69 + "tableTo": "backfill_progress", 70 + "columnsFrom": [ 71 + "backfill_id" 72 + ], 73 + "columnsTo": [ 74 + "id" 75 + ], 76 + "onDelete": "no action", 77 + "onUpdate": "no action" 78 + } 79 + }, 80 + "compositePrimaryKeys": {}, 81 + "uniqueConstraints": {}, 82 + "policies": {}, 83 + "checkConstraints": {}, 84 + "isRLSEnabled": false 85 + }, 86 + "public.backfill_progress": { 87 + "name": "backfill_progress", 88 + "schema": "", 89 + "columns": { 90 + "id": { 91 + "name": "id", 92 + "type": "bigserial", 93 + "primaryKey": true, 94 + "notNull": true 95 + }, 96 + "status": { 97 + "name": "status", 98 + "type": "text", 99 + "primaryKey": false, 100 + "notNull": true 101 + }, 102 + "backfill_type": { 103 + "name": "backfill_type", 104 + "type": "text", 105 + "primaryKey": false, 106 + "notNull": true 107 + }, 108 + "last_processed_did": { 109 + "name": "last_processed_did", 110 + "type": "text", 111 + "primaryKey": false, 112 + "notNull": false 113 + }, 114 + "dids_total": { 115 + "name": "dids_total", 116 + "type": "integer", 117 + "primaryKey": false, 118 + "notNull": true, 119 + "default": 0 120 + }, 121 + "dids_processed": { 122 + "name": "dids_processed", 123 + "type": "integer", 124 + "primaryKey": false, 125 + "notNull": true, 126 + "default": 0 127 + }, 128 + "records_indexed": { 129 + "name": "records_indexed", 130 + "type": "integer", 131 + "primaryKey": false, 132 + "notNull": true, 133 + "default": 0 134 + }, 135 + "started_at": { 136 + "name": "started_at", 137 + "type": "timestamp with time zone", 138 + "primaryKey": false, 139 + "notNull": true 140 + }, 141 + "completed_at": { 142 + "name": "completed_at", 143 + "type": "timestamp with time zone", 144 + "primaryKey": false, 145 + "notNull": false 146 + }, 147 + "error_message": { 148 + "name": "error_message", 149 + "type": "text", 150 + "primaryKey": false, 151 + "notNull": false 152 + } 153 + }, 154 + "indexes": {}, 155 + "foreignKeys": {}, 156 + "compositePrimaryKeys": {}, 157 + "uniqueConstraints": {}, 158 + "policies": {}, 159 + "checkConstraints": {}, 160 + "isRLSEnabled": false 161 + }, 162 + "public.boards": { 163 + "name": "boards", 164 + "schema": "", 165 + "columns": { 166 + "id": { 167 + "name": "id", 168 + "type": "bigserial", 169 + "primaryKey": true, 170 + "notNull": true 171 + }, 172 + "did": { 173 + "name": "did", 174 + "type": "text", 175 + "primaryKey": false, 176 + "notNull": true 177 + }, 178 + "rkey": { 179 + "name": "rkey", 180 + "type": "text", 181 + "primaryKey": false, 182 + "notNull": true 183 + }, 184 + "cid": { 185 + "name": "cid", 186 + "type": "text", 187 + "primaryKey": false, 188 + "notNull": true 189 + }, 190 + "name": { 191 + "name": "name", 192 + "type": "text", 193 + "primaryKey": false, 194 + "notNull": true 195 + }, 196 + "description": { 197 + "name": "description", 198 + "type": "text", 199 + "primaryKey": false, 200 + "notNull": false 201 + }, 202 + "slug": { 203 + "name": "slug", 204 + "type": "text", 205 + "primaryKey": false, 206 + "notNull": false 207 + }, 208 + "sort_order": { 209 + "name": "sort_order", 210 + "type": "integer", 211 + "primaryKey": false, 212 + "notNull": false 213 + }, 214 + "category_id": { 215 + "name": "category_id", 216 + "type": "bigint", 217 + "primaryKey": false, 218 + "notNull": false 219 + }, 220 + "category_uri": { 221 + "name": "category_uri", 222 + "type": "text", 223 + "primaryKey": false, 224 + "notNull": true 225 + }, 226 + "created_at": { 227 + "name": "created_at", 228 + "type": "timestamp with time zone", 229 + "primaryKey": false, 230 + "notNull": true 231 + }, 232 + "indexed_at": { 233 + "name": "indexed_at", 234 + "type": "timestamp with time zone", 235 + "primaryKey": false, 236 + "notNull": true 237 + } 238 + }, 239 + "indexes": { 240 + "boards_did_rkey_idx": { 241 + "name": "boards_did_rkey_idx", 242 + "columns": [ 243 + { 244 + "expression": "did", 245 + "isExpression": false, 246 + "asc": true, 247 + "nulls": "last" 248 + }, 249 + { 250 + "expression": "rkey", 251 + "isExpression": false, 252 + "asc": true, 253 + "nulls": "last" 254 + } 255 + ], 256 + "isUnique": true, 257 + "concurrently": false, 258 + "method": "btree", 259 + "with": {} 260 + }, 261 + "boards_category_id_idx": { 262 + "name": "boards_category_id_idx", 263 + "columns": [ 264 + { 265 + "expression": "category_id", 266 + "isExpression": false, 267 + "asc": true, 268 + "nulls": "last" 269 + } 270 + ], 271 + "isUnique": false, 272 + "concurrently": false, 273 + "method": "btree", 274 + "with": {} 275 + } 276 + }, 277 + "foreignKeys": { 278 + "boards_category_id_categories_id_fk": { 279 + "name": "boards_category_id_categories_id_fk", 280 + "tableFrom": "boards", 281 + "tableTo": "categories", 282 + "columnsFrom": [ 283 + "category_id" 284 + ], 285 + "columnsTo": [ 286 + "id" 287 + ], 288 + "onDelete": "no action", 289 + "onUpdate": "no action" 290 + } 291 + }, 292 + "compositePrimaryKeys": {}, 293 + "uniqueConstraints": {}, 294 + "policies": {}, 295 + "checkConstraints": {}, 296 + "isRLSEnabled": false 297 + }, 298 + "public.categories": { 299 + "name": "categories", 300 + "schema": "", 301 + "columns": { 302 + "id": { 303 + "name": "id", 304 + "type": "bigserial", 305 + "primaryKey": true, 306 + "notNull": true 307 + }, 308 + "did": { 309 + "name": "did", 310 + "type": "text", 311 + "primaryKey": false, 312 + "notNull": true 313 + }, 314 + "rkey": { 315 + "name": "rkey", 316 + "type": "text", 317 + "primaryKey": false, 318 + "notNull": true 319 + }, 320 + "cid": { 321 + "name": "cid", 322 + "type": "text", 323 + "primaryKey": false, 324 + "notNull": true 325 + }, 326 + "name": { 327 + "name": "name", 328 + "type": "text", 329 + "primaryKey": false, 330 + "notNull": true 331 + }, 332 + "description": { 333 + "name": "description", 334 + "type": "text", 335 + "primaryKey": false, 336 + "notNull": false 337 + }, 338 + "slug": { 339 + "name": "slug", 340 + "type": "text", 341 + "primaryKey": false, 342 + "notNull": false 343 + }, 344 + "sort_order": { 345 + "name": "sort_order", 346 + "type": "integer", 347 + "primaryKey": false, 348 + "notNull": false 349 + }, 350 + "forum_id": { 351 + "name": "forum_id", 352 + "type": "bigint", 353 + "primaryKey": false, 354 + "notNull": false 355 + }, 356 + "created_at": { 357 + "name": "created_at", 358 + "type": "timestamp with time zone", 359 + "primaryKey": false, 360 + "notNull": true 361 + }, 362 + "indexed_at": { 363 + "name": "indexed_at", 364 + "type": "timestamp with time zone", 365 + "primaryKey": false, 366 + "notNull": true 367 + } 368 + }, 369 + "indexes": { 370 + "categories_did_rkey_idx": { 371 + "name": "categories_did_rkey_idx", 372 + "columns": [ 373 + { 374 + "expression": "did", 375 + "isExpression": false, 376 + "asc": true, 377 + "nulls": "last" 378 + }, 379 + { 380 + "expression": "rkey", 381 + "isExpression": false, 382 + "asc": true, 383 + "nulls": "last" 384 + } 385 + ], 386 + "isUnique": true, 387 + "concurrently": false, 388 + "method": "btree", 389 + "with": {} 390 + } 391 + }, 392 + "foreignKeys": { 393 + "categories_forum_id_forums_id_fk": { 394 + "name": "categories_forum_id_forums_id_fk", 395 + "tableFrom": "categories", 396 + "tableTo": "forums", 397 + "columnsFrom": [ 398 + "forum_id" 399 + ], 400 + "columnsTo": [ 401 + "id" 402 + ], 403 + "onDelete": "no action", 404 + "onUpdate": "no action" 405 + } 406 + }, 407 + "compositePrimaryKeys": {}, 408 + "uniqueConstraints": {}, 409 + "policies": {}, 410 + "checkConstraints": {}, 411 + "isRLSEnabled": false 412 + }, 413 + "public.firehose_cursor": { 414 + "name": "firehose_cursor", 415 + "schema": "", 416 + "columns": { 417 + "service": { 418 + "name": "service", 419 + "type": "text", 420 + "primaryKey": true, 421 + "notNull": true, 422 + "default": "'jetstream'" 423 + }, 424 + "cursor": { 425 + "name": "cursor", 426 + "type": "bigint", 427 + "primaryKey": false, 428 + "notNull": true 429 + }, 430 + "updated_at": { 431 + "name": "updated_at", 432 + "type": "timestamp with time zone", 433 + "primaryKey": false, 434 + "notNull": true 435 + } 436 + }, 437 + "indexes": {}, 438 + "foreignKeys": {}, 439 + "compositePrimaryKeys": {}, 440 + "uniqueConstraints": {}, 441 + "policies": {}, 442 + "checkConstraints": {}, 443 + "isRLSEnabled": false 444 + }, 445 + "public.forums": { 446 + "name": "forums", 447 + "schema": "", 448 + "columns": { 449 + "id": { 450 + "name": "id", 451 + "type": "bigserial", 452 + "primaryKey": true, 453 + "notNull": true 454 + }, 455 + "did": { 456 + "name": "did", 457 + "type": "text", 458 + "primaryKey": false, 459 + "notNull": true 460 + }, 461 + "rkey": { 462 + "name": "rkey", 463 + "type": "text", 464 + "primaryKey": false, 465 + "notNull": true 466 + }, 467 + "cid": { 468 + "name": "cid", 469 + "type": "text", 470 + "primaryKey": false, 471 + "notNull": true 472 + }, 473 + "name": { 474 + "name": "name", 475 + "type": "text", 476 + "primaryKey": false, 477 + "notNull": true 478 + }, 479 + "description": { 480 + "name": "description", 481 + "type": "text", 482 + "primaryKey": false, 483 + "notNull": false 484 + }, 485 + "indexed_at": { 486 + "name": "indexed_at", 487 + "type": "timestamp with time zone", 488 + "primaryKey": false, 489 + "notNull": true 490 + } 491 + }, 492 + "indexes": { 493 + "forums_did_rkey_idx": { 494 + "name": "forums_did_rkey_idx", 495 + "columns": [ 496 + { 497 + "expression": "did", 498 + "isExpression": false, 499 + "asc": true, 500 + "nulls": "last" 501 + }, 502 + { 503 + "expression": "rkey", 504 + "isExpression": false, 505 + "asc": true, 506 + "nulls": "last" 507 + } 508 + ], 509 + "isUnique": true, 510 + "concurrently": false, 511 + "method": "btree", 512 + "with": {} 513 + } 514 + }, 515 + "foreignKeys": {}, 516 + "compositePrimaryKeys": {}, 517 + "uniqueConstraints": {}, 518 + "policies": {}, 519 + "checkConstraints": {}, 520 + "isRLSEnabled": false 521 + }, 522 + "public.memberships": { 523 + "name": "memberships", 524 + "schema": "", 525 + "columns": { 526 + "id": { 527 + "name": "id", 528 + "type": "bigserial", 529 + "primaryKey": true, 530 + "notNull": true 531 + }, 532 + "did": { 533 + "name": "did", 534 + "type": "text", 535 + "primaryKey": false, 536 + "notNull": true 537 + }, 538 + "rkey": { 539 + "name": "rkey", 540 + "type": "text", 541 + "primaryKey": false, 542 + "notNull": true 543 + }, 544 + "cid": { 545 + "name": "cid", 546 + "type": "text", 547 + "primaryKey": false, 548 + "notNull": true 549 + }, 550 + "forum_id": { 551 + "name": "forum_id", 552 + "type": "bigint", 553 + "primaryKey": false, 554 + "notNull": false 555 + }, 556 + "forum_uri": { 557 + "name": "forum_uri", 558 + "type": "text", 559 + "primaryKey": false, 560 + "notNull": true 561 + }, 562 + "role": { 563 + "name": "role", 564 + "type": "text", 565 + "primaryKey": false, 566 + "notNull": false 567 + }, 568 + "role_uri": { 569 + "name": "role_uri", 570 + "type": "text", 571 + "primaryKey": false, 572 + "notNull": false 573 + }, 574 + "joined_at": { 575 + "name": "joined_at", 576 + "type": "timestamp with time zone", 577 + "primaryKey": false, 578 + "notNull": false 579 + }, 580 + "created_at": { 581 + "name": "created_at", 582 + "type": "timestamp with time zone", 583 + "primaryKey": false, 584 + "notNull": true 585 + }, 586 + "indexed_at": { 587 + "name": "indexed_at", 588 + "type": "timestamp with time zone", 589 + "primaryKey": false, 590 + "notNull": true 591 + } 592 + }, 593 + "indexes": { 594 + "memberships_did_rkey_idx": { 595 + "name": "memberships_did_rkey_idx", 596 + "columns": [ 597 + { 598 + "expression": "did", 599 + "isExpression": false, 600 + "asc": true, 601 + "nulls": "last" 602 + }, 603 + { 604 + "expression": "rkey", 605 + "isExpression": false, 606 + "asc": true, 607 + "nulls": "last" 608 + } 609 + ], 610 + "isUnique": true, 611 + "concurrently": false, 612 + "method": "btree", 613 + "with": {} 614 + }, 615 + "memberships_did_idx": { 616 + "name": "memberships_did_idx", 617 + "columns": [ 618 + { 619 + "expression": "did", 620 + "isExpression": false, 621 + "asc": true, 622 + "nulls": "last" 623 + } 624 + ], 625 + "isUnique": false, 626 + "concurrently": false, 627 + "method": "btree", 628 + "with": {} 629 + } 630 + }, 631 + "foreignKeys": { 632 + "memberships_did_users_did_fk": { 633 + "name": "memberships_did_users_did_fk", 634 + "tableFrom": "memberships", 635 + "tableTo": "users", 636 + "columnsFrom": [ 637 + "did" 638 + ], 639 + "columnsTo": [ 640 + "did" 641 + ], 642 + "onDelete": "no action", 643 + "onUpdate": "no action" 644 + }, 645 + "memberships_forum_id_forums_id_fk": { 646 + "name": "memberships_forum_id_forums_id_fk", 647 + "tableFrom": "memberships", 648 + "tableTo": "forums", 649 + "columnsFrom": [ 650 + "forum_id" 651 + ], 652 + "columnsTo": [ 653 + "id" 654 + ], 655 + "onDelete": "no action", 656 + "onUpdate": "no action" 657 + } 658 + }, 659 + "compositePrimaryKeys": {}, 660 + "uniqueConstraints": {}, 661 + "policies": {}, 662 + "checkConstraints": {}, 663 + "isRLSEnabled": false 664 + }, 665 + "public.mod_actions": { 666 + "name": "mod_actions", 667 + "schema": "", 668 + "columns": { 669 + "id": { 670 + "name": "id", 671 + "type": "bigserial", 672 + "primaryKey": true, 673 + "notNull": true 674 + }, 675 + "did": { 676 + "name": "did", 677 + "type": "text", 678 + "primaryKey": false, 679 + "notNull": true 680 + }, 681 + "rkey": { 682 + "name": "rkey", 683 + "type": "text", 684 + "primaryKey": false, 685 + "notNull": true 686 + }, 687 + "cid": { 688 + "name": "cid", 689 + "type": "text", 690 + "primaryKey": false, 691 + "notNull": true 692 + }, 693 + "action": { 694 + "name": "action", 695 + "type": "text", 696 + "primaryKey": false, 697 + "notNull": true 698 + }, 699 + "subject_did": { 700 + "name": "subject_did", 701 + "type": "text", 702 + "primaryKey": false, 703 + "notNull": false 704 + }, 705 + "subject_post_uri": { 706 + "name": "subject_post_uri", 707 + "type": "text", 708 + "primaryKey": false, 709 + "notNull": false 710 + }, 711 + "forum_id": { 712 + "name": "forum_id", 713 + "type": "bigint", 714 + "primaryKey": false, 715 + "notNull": false 716 + }, 717 + "reason": { 718 + "name": "reason", 719 + "type": "text", 720 + "primaryKey": false, 721 + "notNull": false 722 + }, 723 + "created_by": { 724 + "name": "created_by", 725 + "type": "text", 726 + "primaryKey": false, 727 + "notNull": true 728 + }, 729 + "expires_at": { 730 + "name": "expires_at", 731 + "type": "timestamp with time zone", 732 + "primaryKey": false, 733 + "notNull": false 734 + }, 735 + "created_at": { 736 + "name": "created_at", 737 + "type": "timestamp with time zone", 738 + "primaryKey": false, 739 + "notNull": true 740 + }, 741 + "indexed_at": { 742 + "name": "indexed_at", 743 + "type": "timestamp with time zone", 744 + "primaryKey": false, 745 + "notNull": true 746 + } 747 + }, 748 + "indexes": { 749 + "mod_actions_did_rkey_idx": { 750 + "name": "mod_actions_did_rkey_idx", 751 + "columns": [ 752 + { 753 + "expression": "did", 754 + "isExpression": false, 755 + "asc": true, 756 + "nulls": "last" 757 + }, 758 + { 759 + "expression": "rkey", 760 + "isExpression": false, 761 + "asc": true, 762 + "nulls": "last" 763 + } 764 + ], 765 + "isUnique": true, 766 + "concurrently": false, 767 + "method": "btree", 768 + "with": {} 769 + }, 770 + "mod_actions_subject_did_idx": { 771 + "name": "mod_actions_subject_did_idx", 772 + "columns": [ 773 + { 774 + "expression": "subject_did", 775 + "isExpression": false, 776 + "asc": true, 777 + "nulls": "last" 778 + } 779 + ], 780 + "isUnique": false, 781 + "concurrently": false, 782 + "method": "btree", 783 + "with": {} 784 + }, 785 + "mod_actions_subject_post_uri_idx": { 786 + "name": "mod_actions_subject_post_uri_idx", 787 + "columns": [ 788 + { 789 + "expression": "subject_post_uri", 790 + "isExpression": false, 791 + "asc": true, 792 + "nulls": "last" 793 + } 794 + ], 795 + "isUnique": false, 796 + "concurrently": false, 797 + "method": "btree", 798 + "with": {} 799 + } 800 + }, 801 + "foreignKeys": { 802 + "mod_actions_forum_id_forums_id_fk": { 803 + "name": "mod_actions_forum_id_forums_id_fk", 804 + "tableFrom": "mod_actions", 805 + "tableTo": "forums", 806 + "columnsFrom": [ 807 + "forum_id" 808 + ], 809 + "columnsTo": [ 810 + "id" 811 + ], 812 + "onDelete": "no action", 813 + "onUpdate": "no action" 814 + } 815 + }, 816 + "compositePrimaryKeys": {}, 817 + "uniqueConstraints": {}, 818 + "policies": {}, 819 + "checkConstraints": {}, 820 + "isRLSEnabled": false 821 + }, 822 + "public.posts": { 823 + "name": "posts", 824 + "schema": "", 825 + "columns": { 826 + "id": { 827 + "name": "id", 828 + "type": "bigserial", 829 + "primaryKey": true, 830 + "notNull": true 831 + }, 832 + "did": { 833 + "name": "did", 834 + "type": "text", 835 + "primaryKey": false, 836 + "notNull": true 837 + }, 838 + "rkey": { 839 + "name": "rkey", 840 + "type": "text", 841 + "primaryKey": false, 842 + "notNull": true 843 + }, 844 + "cid": { 845 + "name": "cid", 846 + "type": "text", 847 + "primaryKey": false, 848 + "notNull": true 849 + }, 850 + "title": { 851 + "name": "title", 852 + "type": "text", 853 + "primaryKey": false, 854 + "notNull": false 855 + }, 856 + "text": { 857 + "name": "text", 858 + "type": "text", 859 + "primaryKey": false, 860 + "notNull": true 861 + }, 862 + "forum_uri": { 863 + "name": "forum_uri", 864 + "type": "text", 865 + "primaryKey": false, 866 + "notNull": false 867 + }, 868 + "board_uri": { 869 + "name": "board_uri", 870 + "type": "text", 871 + "primaryKey": false, 872 + "notNull": false 873 + }, 874 + "board_id": { 875 + "name": "board_id", 876 + "type": "bigint", 877 + "primaryKey": false, 878 + "notNull": false 879 + }, 880 + "root_post_id": { 881 + "name": "root_post_id", 882 + "type": "bigint", 883 + "primaryKey": false, 884 + "notNull": false 885 + }, 886 + "parent_post_id": { 887 + "name": "parent_post_id", 888 + "type": "bigint", 889 + "primaryKey": false, 890 + "notNull": false 891 + }, 892 + "root_uri": { 893 + "name": "root_uri", 894 + "type": "text", 895 + "primaryKey": false, 896 + "notNull": false 897 + }, 898 + "parent_uri": { 899 + "name": "parent_uri", 900 + "type": "text", 901 + "primaryKey": false, 902 + "notNull": false 903 + }, 904 + "created_at": { 905 + "name": "created_at", 906 + "type": "timestamp with time zone", 907 + "primaryKey": false, 908 + "notNull": true 909 + }, 910 + "indexed_at": { 911 + "name": "indexed_at", 912 + "type": "timestamp with time zone", 913 + "primaryKey": false, 914 + "notNull": true 915 + }, 916 + "banned_by_mod": { 917 + "name": "banned_by_mod", 918 + "type": "boolean", 919 + "primaryKey": false, 920 + "notNull": true, 921 + "default": false 922 + }, 923 + "deleted_by_user": { 924 + "name": "deleted_by_user", 925 + "type": "boolean", 926 + "primaryKey": false, 927 + "notNull": true, 928 + "default": false 929 + } 930 + }, 931 + "indexes": { 932 + "posts_did_rkey_idx": { 933 + "name": "posts_did_rkey_idx", 934 + "columns": [ 935 + { 936 + "expression": "did", 937 + "isExpression": false, 938 + "asc": true, 939 + "nulls": "last" 940 + }, 941 + { 942 + "expression": "rkey", 943 + "isExpression": false, 944 + "asc": true, 945 + "nulls": "last" 946 + } 947 + ], 948 + "isUnique": true, 949 + "concurrently": false, 950 + "method": "btree", 951 + "with": {} 952 + }, 953 + "posts_forum_uri_idx": { 954 + "name": "posts_forum_uri_idx", 955 + "columns": [ 956 + { 957 + "expression": "forum_uri", 958 + "isExpression": false, 959 + "asc": true, 960 + "nulls": "last" 961 + } 962 + ], 963 + "isUnique": false, 964 + "concurrently": false, 965 + "method": "btree", 966 + "with": {} 967 + }, 968 + "posts_board_id_idx": { 969 + "name": "posts_board_id_idx", 970 + "columns": [ 971 + { 972 + "expression": "board_id", 973 + "isExpression": false, 974 + "asc": true, 975 + "nulls": "last" 976 + } 977 + ], 978 + "isUnique": false, 979 + "concurrently": false, 980 + "method": "btree", 981 + "with": {} 982 + }, 983 + "posts_board_uri_idx": { 984 + "name": "posts_board_uri_idx", 985 + "columns": [ 986 + { 987 + "expression": "board_uri", 988 + "isExpression": false, 989 + "asc": true, 990 + "nulls": "last" 991 + } 992 + ], 993 + "isUnique": false, 994 + "concurrently": false, 995 + "method": "btree", 996 + "with": {} 997 + }, 998 + "posts_root_post_id_idx": { 999 + "name": "posts_root_post_id_idx", 1000 + "columns": [ 1001 + { 1002 + "expression": "root_post_id", 1003 + "isExpression": false, 1004 + "asc": true, 1005 + "nulls": "last" 1006 + } 1007 + ], 1008 + "isUnique": false, 1009 + "concurrently": false, 1010 + "method": "btree", 1011 + "with": {} 1012 + } 1013 + }, 1014 + "foreignKeys": { 1015 + "posts_did_users_did_fk": { 1016 + "name": "posts_did_users_did_fk", 1017 + "tableFrom": "posts", 1018 + "tableTo": "users", 1019 + "columnsFrom": [ 1020 + "did" 1021 + ], 1022 + "columnsTo": [ 1023 + "did" 1024 + ], 1025 + "onDelete": "no action", 1026 + "onUpdate": "no action" 1027 + }, 1028 + "posts_board_id_boards_id_fk": { 1029 + "name": "posts_board_id_boards_id_fk", 1030 + "tableFrom": "posts", 1031 + "tableTo": "boards", 1032 + "columnsFrom": [ 1033 + "board_id" 1034 + ], 1035 + "columnsTo": [ 1036 + "id" 1037 + ], 1038 + "onDelete": "no action", 1039 + "onUpdate": "no action" 1040 + }, 1041 + "posts_root_post_id_posts_id_fk": { 1042 + "name": "posts_root_post_id_posts_id_fk", 1043 + "tableFrom": "posts", 1044 + "tableTo": "posts", 1045 + "columnsFrom": [ 1046 + "root_post_id" 1047 + ], 1048 + "columnsTo": [ 1049 + "id" 1050 + ], 1051 + "onDelete": "no action", 1052 + "onUpdate": "no action" 1053 + }, 1054 + "posts_parent_post_id_posts_id_fk": { 1055 + "name": "posts_parent_post_id_posts_id_fk", 1056 + "tableFrom": "posts", 1057 + "tableTo": "posts", 1058 + "columnsFrom": [ 1059 + "parent_post_id" 1060 + ], 1061 + "columnsTo": [ 1062 + "id" 1063 + ], 1064 + "onDelete": "no action", 1065 + "onUpdate": "no action" 1066 + } 1067 + }, 1068 + "compositePrimaryKeys": {}, 1069 + "uniqueConstraints": {}, 1070 + "policies": {}, 1071 + "checkConstraints": {}, 1072 + "isRLSEnabled": false 1073 + }, 1074 + "public.role_permissions": { 1075 + "name": "role_permissions", 1076 + "schema": "", 1077 + "columns": { 1078 + "role_id": { 1079 + "name": "role_id", 1080 + "type": "bigint", 1081 + "primaryKey": false, 1082 + "notNull": true 1083 + }, 1084 + "permission": { 1085 + "name": "permission", 1086 + "type": "text", 1087 + "primaryKey": false, 1088 + "notNull": true 1089 + } 1090 + }, 1091 + "indexes": {}, 1092 + "foreignKeys": { 1093 + "role_permissions_role_id_roles_id_fk": { 1094 + "name": "role_permissions_role_id_roles_id_fk", 1095 + "tableFrom": "role_permissions", 1096 + "tableTo": "roles", 1097 + "columnsFrom": [ 1098 + "role_id" 1099 + ], 1100 + "columnsTo": [ 1101 + "id" 1102 + ], 1103 + "onDelete": "cascade", 1104 + "onUpdate": "no action" 1105 + } 1106 + }, 1107 + "compositePrimaryKeys": { 1108 + "role_permissions_role_id_permission_pk": { 1109 + "name": "role_permissions_role_id_permission_pk", 1110 + "columns": [ 1111 + "role_id", 1112 + "permission" 1113 + ] 1114 + } 1115 + }, 1116 + "uniqueConstraints": {}, 1117 + "policies": {}, 1118 + "checkConstraints": {}, 1119 + "isRLSEnabled": false 1120 + }, 1121 + "public.roles": { 1122 + "name": "roles", 1123 + "schema": "", 1124 + "columns": { 1125 + "id": { 1126 + "name": "id", 1127 + "type": "bigserial", 1128 + "primaryKey": true, 1129 + "notNull": true 1130 + }, 1131 + "did": { 1132 + "name": "did", 1133 + "type": "text", 1134 + "primaryKey": false, 1135 + "notNull": true 1136 + }, 1137 + "rkey": { 1138 + "name": "rkey", 1139 + "type": "text", 1140 + "primaryKey": false, 1141 + "notNull": true 1142 + }, 1143 + "cid": { 1144 + "name": "cid", 1145 + "type": "text", 1146 + "primaryKey": false, 1147 + "notNull": true 1148 + }, 1149 + "name": { 1150 + "name": "name", 1151 + "type": "text", 1152 + "primaryKey": false, 1153 + "notNull": true 1154 + }, 1155 + "description": { 1156 + "name": "description", 1157 + "type": "text", 1158 + "primaryKey": false, 1159 + "notNull": false 1160 + }, 1161 + "priority": { 1162 + "name": "priority", 1163 + "type": "integer", 1164 + "primaryKey": false, 1165 + "notNull": true 1166 + }, 1167 + "created_at": { 1168 + "name": "created_at", 1169 + "type": "timestamp with time zone", 1170 + "primaryKey": false, 1171 + "notNull": true 1172 + }, 1173 + "indexed_at": { 1174 + "name": "indexed_at", 1175 + "type": "timestamp with time zone", 1176 + "primaryKey": false, 1177 + "notNull": true 1178 + } 1179 + }, 1180 + "indexes": { 1181 + "roles_did_rkey_idx": { 1182 + "name": "roles_did_rkey_idx", 1183 + "columns": [ 1184 + { 1185 + "expression": "did", 1186 + "isExpression": false, 1187 + "asc": true, 1188 + "nulls": "last" 1189 + }, 1190 + { 1191 + "expression": "rkey", 1192 + "isExpression": false, 1193 + "asc": true, 1194 + "nulls": "last" 1195 + } 1196 + ], 1197 + "isUnique": true, 1198 + "concurrently": false, 1199 + "method": "btree", 1200 + "with": {} 1201 + }, 1202 + "roles_did_idx": { 1203 + "name": "roles_did_idx", 1204 + "columns": [ 1205 + { 1206 + "expression": "did", 1207 + "isExpression": false, 1208 + "asc": true, 1209 + "nulls": "last" 1210 + } 1211 + ], 1212 + "isUnique": false, 1213 + "concurrently": false, 1214 + "method": "btree", 1215 + "with": {} 1216 + }, 1217 + "roles_did_name_idx": { 1218 + "name": "roles_did_name_idx", 1219 + "columns": [ 1220 + { 1221 + "expression": "did", 1222 + "isExpression": false, 1223 + "asc": true, 1224 + "nulls": "last" 1225 + }, 1226 + { 1227 + "expression": "name", 1228 + "isExpression": false, 1229 + "asc": true, 1230 + "nulls": "last" 1231 + } 1232 + ], 1233 + "isUnique": false, 1234 + "concurrently": false, 1235 + "method": "btree", 1236 + "with": {} 1237 + } 1238 + }, 1239 + "foreignKeys": {}, 1240 + "compositePrimaryKeys": {}, 1241 + "uniqueConstraints": {}, 1242 + "policies": {}, 1243 + "checkConstraints": {}, 1244 + "isRLSEnabled": false 1245 + }, 1246 + "public.theme_policies": { 1247 + "name": "theme_policies", 1248 + "schema": "", 1249 + "columns": { 1250 + "id": { 1251 + "name": "id", 1252 + "type": "bigserial", 1253 + "primaryKey": true, 1254 + "notNull": true 1255 + }, 1256 + "did": { 1257 + "name": "did", 1258 + "type": "text", 1259 + "primaryKey": false, 1260 + "notNull": true 1261 + }, 1262 + "rkey": { 1263 + "name": "rkey", 1264 + "type": "text", 1265 + "primaryKey": false, 1266 + "notNull": true 1267 + }, 1268 + "cid": { 1269 + "name": "cid", 1270 + "type": "text", 1271 + "primaryKey": false, 1272 + "notNull": true 1273 + }, 1274 + "default_light_theme_uri": { 1275 + "name": "default_light_theme_uri", 1276 + "type": "text", 1277 + "primaryKey": false, 1278 + "notNull": true 1279 + }, 1280 + "default_dark_theme_uri": { 1281 + "name": "default_dark_theme_uri", 1282 + "type": "text", 1283 + "primaryKey": false, 1284 + "notNull": true 1285 + }, 1286 + "allow_user_choice": { 1287 + "name": "allow_user_choice", 1288 + "type": "boolean", 1289 + "primaryKey": false, 1290 + "notNull": true 1291 + }, 1292 + "indexed_at": { 1293 + "name": "indexed_at", 1294 + "type": "timestamp with time zone", 1295 + "primaryKey": false, 1296 + "notNull": true 1297 + } 1298 + }, 1299 + "indexes": { 1300 + "theme_policies_did_rkey_idx": { 1301 + "name": "theme_policies_did_rkey_idx", 1302 + "columns": [ 1303 + { 1304 + "expression": "did", 1305 + "isExpression": false, 1306 + "asc": true, 1307 + "nulls": "last" 1308 + }, 1309 + { 1310 + "expression": "rkey", 1311 + "isExpression": false, 1312 + "asc": true, 1313 + "nulls": "last" 1314 + } 1315 + ], 1316 + "isUnique": true, 1317 + "concurrently": false, 1318 + "method": "btree", 1319 + "with": {} 1320 + } 1321 + }, 1322 + "foreignKeys": {}, 1323 + "compositePrimaryKeys": {}, 1324 + "uniqueConstraints": {}, 1325 + "policies": {}, 1326 + "checkConstraints": {}, 1327 + "isRLSEnabled": false 1328 + }, 1329 + "public.theme_policy_available_themes": { 1330 + "name": "theme_policy_available_themes", 1331 + "schema": "", 1332 + "columns": { 1333 + "policy_id": { 1334 + "name": "policy_id", 1335 + "type": "bigint", 1336 + "primaryKey": false, 1337 + "notNull": true 1338 + }, 1339 + "theme_uri": { 1340 + "name": "theme_uri", 1341 + "type": "text", 1342 + "primaryKey": false, 1343 + "notNull": true 1344 + }, 1345 + "theme_cid": { 1346 + "name": "theme_cid", 1347 + "type": "text", 1348 + "primaryKey": false, 1349 + "notNull": true 1350 + } 1351 + }, 1352 + "indexes": {}, 1353 + "foreignKeys": { 1354 + "theme_policy_available_themes_policy_id_theme_policies_id_fk": { 1355 + "name": "theme_policy_available_themes_policy_id_theme_policies_id_fk", 1356 + "tableFrom": "theme_policy_available_themes", 1357 + "tableTo": "theme_policies", 1358 + "columnsFrom": [ 1359 + "policy_id" 1360 + ], 1361 + "columnsTo": [ 1362 + "id" 1363 + ], 1364 + "onDelete": "cascade", 1365 + "onUpdate": "no action" 1366 + } 1367 + }, 1368 + "compositePrimaryKeys": { 1369 + "theme_policy_available_themes_policy_id_theme_uri_pk": { 1370 + "name": "theme_policy_available_themes_policy_id_theme_uri_pk", 1371 + "columns": [ 1372 + "policy_id", 1373 + "theme_uri" 1374 + ] 1375 + } 1376 + }, 1377 + "uniqueConstraints": {}, 1378 + "policies": {}, 1379 + "checkConstraints": {}, 1380 + "isRLSEnabled": false 1381 + }, 1382 + "public.themes": { 1383 + "name": "themes", 1384 + "schema": "", 1385 + "columns": { 1386 + "id": { 1387 + "name": "id", 1388 + "type": "bigserial", 1389 + "primaryKey": true, 1390 + "notNull": true 1391 + }, 1392 + "did": { 1393 + "name": "did", 1394 + "type": "text", 1395 + "primaryKey": false, 1396 + "notNull": true 1397 + }, 1398 + "rkey": { 1399 + "name": "rkey", 1400 + "type": "text", 1401 + "primaryKey": false, 1402 + "notNull": true 1403 + }, 1404 + "cid": { 1405 + "name": "cid", 1406 + "type": "text", 1407 + "primaryKey": false, 1408 + "notNull": true 1409 + }, 1410 + "name": { 1411 + "name": "name", 1412 + "type": "text", 1413 + "primaryKey": false, 1414 + "notNull": true 1415 + }, 1416 + "color_scheme": { 1417 + "name": "color_scheme", 1418 + "type": "text", 1419 + "primaryKey": false, 1420 + "notNull": true 1421 + }, 1422 + "tokens": { 1423 + "name": "tokens", 1424 + "type": "jsonb", 1425 + "primaryKey": false, 1426 + "notNull": true 1427 + }, 1428 + "css_overrides": { 1429 + "name": "css_overrides", 1430 + "type": "text", 1431 + "primaryKey": false, 1432 + "notNull": false 1433 + }, 1434 + "font_urls": { 1435 + "name": "font_urls", 1436 + "type": "text[]", 1437 + "primaryKey": false, 1438 + "notNull": false 1439 + }, 1440 + "created_at": { 1441 + "name": "created_at", 1442 + "type": "timestamp with time zone", 1443 + "primaryKey": false, 1444 + "notNull": true 1445 + }, 1446 + "indexed_at": { 1447 + "name": "indexed_at", 1448 + "type": "timestamp with time zone", 1449 + "primaryKey": false, 1450 + "notNull": true 1451 + } 1452 + }, 1453 + "indexes": { 1454 + "themes_did_rkey_idx": { 1455 + "name": "themes_did_rkey_idx", 1456 + "columns": [ 1457 + { 1458 + "expression": "did", 1459 + "isExpression": false, 1460 + "asc": true, 1461 + "nulls": "last" 1462 + }, 1463 + { 1464 + "expression": "rkey", 1465 + "isExpression": false, 1466 + "asc": true, 1467 + "nulls": "last" 1468 + } 1469 + ], 1470 + "isUnique": true, 1471 + "concurrently": false, 1472 + "method": "btree", 1473 + "with": {} 1474 + } 1475 + }, 1476 + "foreignKeys": {}, 1477 + "compositePrimaryKeys": {}, 1478 + "uniqueConstraints": {}, 1479 + "policies": {}, 1480 + "checkConstraints": {}, 1481 + "isRLSEnabled": false 1482 + }, 1483 + "public.users": { 1484 + "name": "users", 1485 + "schema": "", 1486 + "columns": { 1487 + "did": { 1488 + "name": "did", 1489 + "type": "text", 1490 + "primaryKey": true, 1491 + "notNull": true 1492 + }, 1493 + "handle": { 1494 + "name": "handle", 1495 + "type": "text", 1496 + "primaryKey": false, 1497 + "notNull": false 1498 + }, 1499 + "indexed_at": { 1500 + "name": "indexed_at", 1501 + "type": "timestamp with time zone", 1502 + "primaryKey": false, 1503 + "notNull": true 1504 + } 1505 + }, 1506 + "indexes": {}, 1507 + "foreignKeys": {}, 1508 + "compositePrimaryKeys": {}, 1509 + "uniqueConstraints": {}, 1510 + "policies": {}, 1511 + "checkConstraints": {}, 1512 + "isRLSEnabled": false 1513 + } 1514 + }, 1515 + "enums": {}, 1516 + "schemas": {}, 1517 + "sequences": {}, 1518 + "roles": {}, 1519 + "policies": {}, 1520 + "views": {}, 1521 + "_meta": { 1522 + "columns": {}, 1523 + "schemas": {}, 1524 + "tables": {} 1525 + } 1526 + }
+7
apps/appview/drizzle/meta/_journal.json
··· 92 "when": 1772035630111, 93 "tag": "0012_acoustic_swordsman", 94 "breakpoints": true 95 } 96 ] 97 }
··· 92 "when": 1772035630111, 93 "tag": "0012_acoustic_swordsman", 94 "breakpoints": true 95 + }, 96 + { 97 + "idx": 13, 98 + "version": "7", 99 + "when": 1772482052223, 100 + "tag": "0013_add_theme_tables", 101 + "breakpoints": true 102 } 103 ] 104 }
+50
packages/db/src/schema.sqlite.ts
··· 249 }, 250 (table) => [index("backfill_errors_backfill_id_idx").on(table.backfillId)] 251 );
··· 249 }, 250 (table) => [index("backfill_errors_backfill_id_idx").on(table.backfillId)] 251 ); 252 + 253 + // ── themes ────────────────────────────────────────────── 254 + export const themes = sqliteTable( 255 + "themes", 256 + { 257 + id: integer("id").primaryKey({ autoIncrement: true }), 258 + did: text("did").notNull(), 259 + rkey: text("rkey").notNull(), 260 + cid: text("cid").notNull(), 261 + name: text("name").notNull(), 262 + colorScheme: text("color_scheme").notNull(), 263 + tokens: text("tokens", { mode: "json" }).notNull(), // auto JSON parse/stringify 264 + cssOverrides: text("css_overrides"), 265 + fontUrls: text("font_urls", { mode: "json" }), // auto JSON parse/stringify 266 + createdAt: integer("created_at", { mode: "timestamp" }).notNull(), 267 + indexedAt: integer("indexed_at", { mode: "timestamp" }).notNull(), 268 + }, 269 + (table) => [uniqueIndex("themes_did_rkey_idx").on(table.did, table.rkey)] 270 + ); 271 + 272 + // ── theme_policies ─────────────────────────────────────── 273 + export const themePolicies = sqliteTable( 274 + "theme_policies", 275 + { 276 + id: integer("id").primaryKey({ autoIncrement: true }), 277 + did: text("did").notNull(), 278 + rkey: text("rkey").notNull(), 279 + cid: text("cid").notNull(), 280 + defaultLightThemeUri: text("default_light_theme_uri").notNull(), 281 + defaultDarkThemeUri: text("default_dark_theme_uri").notNull(), 282 + allowUserChoice: integer("allow_user_choice", { mode: "boolean" }).notNull(), 283 + indexedAt: integer("indexed_at", { mode: "timestamp" }).notNull(), 284 + }, 285 + (table) => [ 286 + uniqueIndex("theme_policies_did_rkey_idx").on(table.did, table.rkey), 287 + ] 288 + ); 289 + 290 + // ── theme_policy_available_themes ──────────────────────── 291 + export const themePolicyAvailableThemes = sqliteTable( 292 + "theme_policy_available_themes", 293 + { 294 + policyId: integer("policy_id") 295 + .notNull() 296 + .references(() => themePolicies.id, { onDelete: "cascade" }), 297 + themeUri: text("theme_uri").notNull(), 298 + themeCid: text("theme_cid").notNull(), 299 + }, 300 + (t) => [primaryKey({ columns: [t.policyId, t.themeUri] })] 301 + );
+57
packages/db/src/schema.ts
··· 6 integer, 7 boolean, 8 bigint, 9 uniqueIndex, 10 index, 11 primaryKey, ··· 258 }, 259 (table) => [index("backfill_errors_backfill_id_idx").on(table.backfillId)] 260 );
··· 6 integer, 7 boolean, 8 bigint, 9 + jsonb, 10 uniqueIndex, 11 index, 12 primaryKey, ··· 259 }, 260 (table) => [index("backfill_errors_backfill_id_idx").on(table.backfillId)] 261 ); 262 + 263 + // ── themes ────────────────────────────────────────────── 264 + // Theme definitions, owned by Forum DID. Multiple themes per forum. 265 + // Key: tid (multiple records per repo). 266 + export const themes = pgTable( 267 + "themes", 268 + { 269 + id: bigserial("id", { mode: "bigint" }).primaryKey(), 270 + did: text("did").notNull(), 271 + rkey: text("rkey").notNull(), 272 + cid: text("cid").notNull(), 273 + name: text("name").notNull(), 274 + colorScheme: text("color_scheme").notNull(), // "light" | "dark" 275 + tokens: jsonb("tokens").notNull(), // design token key-value map 276 + cssOverrides: text("css_overrides"), 277 + fontUrls: text("font_urls").array(), 278 + createdAt: timestamp("created_at", { withTimezone: true }).notNull(), 279 + indexedAt: timestamp("indexed_at", { withTimezone: true }).notNull(), 280 + }, 281 + (table) => [uniqueIndex("themes_did_rkey_idx").on(table.did, table.rkey)] 282 + ); 283 + 284 + // ── theme_policies ─────────────────────────────────────── 285 + // Singleton theme policy, owned by Forum DID. 286 + // Key: literal:self (rkey is always "self"). 287 + export const themePolicies = pgTable( 288 + "theme_policies", 289 + { 290 + id: bigserial("id", { mode: "bigint" }).primaryKey(), 291 + did: text("did").notNull(), 292 + rkey: text("rkey").notNull(), 293 + cid: text("cid").notNull(), 294 + defaultLightThemeUri: text("default_light_theme_uri").notNull(), 295 + defaultDarkThemeUri: text("default_dark_theme_uri").notNull(), 296 + allowUserChoice: boolean("allow_user_choice").notNull(), 297 + indexedAt: timestamp("indexed_at", { withTimezone: true }).notNull(), 298 + }, 299 + (table) => [ 300 + uniqueIndex("theme_policies_did_rkey_idx").on(table.did, table.rkey), 301 + ] 302 + ); 303 + 304 + // ── theme_policy_available_themes ──────────────────────── 305 + // Normalized join table: which themes does the policy expose to users? 306 + // ON DELETE CASCADE: deleting a policy row removes all its available-theme rows. 307 + export const themePolicyAvailableThemes = pgTable( 308 + "theme_policy_available_themes", 309 + { 310 + policyId: bigint("policy_id", { mode: "bigint" }) 311 + .notNull() 312 + .references(() => themePolicies.id, { onDelete: "cascade" }), 313 + themeUri: text("theme_uri").notNull(), 314 + themeCid: text("theme_cid").notNull(), 315 + }, 316 + (t) => [primaryKey({ columns: [t.policyId, t.themeUri] })] 317 + );