Barazo AppView backend barazo.forum

Merge pull request #67 from barazo-forum/perf/users-table-indexes

perf(db): add indexes on users table for role, handle, and account age

authored by

Guido X Jansen and committed by
GitHub
a5a15c70 ef573086

+3473 -24
+3
drizzle/0027_sad_spencer_smythe.sql
··· 1 + CREATE INDEX IF NOT EXISTS "users_role_elevated_idx" ON "users" USING btree ("role") WHERE role IN ('moderator', 'admin'); 2 + CREATE INDEX IF NOT EXISTS "users_handle_idx" ON "users" USING btree ("handle"); 3 + CREATE INDEX IF NOT EXISTS "users_account_created_at_idx" ON "users" USING btree ("account_created_at");
+3428
drizzle/meta/0027_snapshot.json
··· 1 + { 2 + "id": "829275b4-e784-45bf-a097-d689f3623cbb", 3 + "prevId": "1682a9f5-dd72-46a8-90ec-c64301068410", 4 + "version": "7", 5 + "dialect": "postgresql", 6 + "tables": { 7 + "public.users": { 8 + "name": "users", 9 + "schema": "", 10 + "columns": { 11 + "did": { 12 + "name": "did", 13 + "type": "text", 14 + "primaryKey": true, 15 + "notNull": true 16 + }, 17 + "handle": { 18 + "name": "handle", 19 + "type": "text", 20 + "primaryKey": false, 21 + "notNull": true 22 + }, 23 + "display_name": { 24 + "name": "display_name", 25 + "type": "text", 26 + "primaryKey": false, 27 + "notNull": false 28 + }, 29 + "avatar_url": { 30 + "name": "avatar_url", 31 + "type": "text", 32 + "primaryKey": false, 33 + "notNull": false 34 + }, 35 + "banner_url": { 36 + "name": "banner_url", 37 + "type": "text", 38 + "primaryKey": false, 39 + "notNull": false 40 + }, 41 + "bio": { 42 + "name": "bio", 43 + "type": "text", 44 + "primaryKey": false, 45 + "notNull": false 46 + }, 47 + "role": { 48 + "name": "role", 49 + "type": "text", 50 + "primaryKey": false, 51 + "notNull": true, 52 + "default": "'user'" 53 + }, 54 + "is_banned": { 55 + "name": "is_banned", 56 + "type": "boolean", 57 + "primaryKey": false, 58 + "notNull": true, 59 + "default": false 60 + }, 61 + "reputation_score": { 62 + "name": "reputation_score", 63 + "type": "integer", 64 + "primaryKey": false, 65 + "notNull": true, 66 + "default": 0 67 + }, 68 + "first_seen_at": { 69 + "name": "first_seen_at", 70 + "type": "timestamp with time zone", 71 + "primaryKey": false, 72 + "notNull": true, 73 + "default": "now()" 74 + }, 75 + "last_active_at": { 76 + "name": "last_active_at", 77 + "type": "timestamp with time zone", 78 + "primaryKey": false, 79 + "notNull": true, 80 + "default": "now()" 81 + }, 82 + "declared_age": { 83 + "name": "declared_age", 84 + "type": "integer", 85 + "primaryKey": false, 86 + "notNull": false 87 + }, 88 + "maturity_pref": { 89 + "name": "maturity_pref", 90 + "type": "text", 91 + "primaryKey": false, 92 + "notNull": true, 93 + "default": "'safe'" 94 + }, 95 + "account_created_at": { 96 + "name": "account_created_at", 97 + "type": "timestamp with time zone", 98 + "primaryKey": false, 99 + "notNull": false 100 + } 101 + }, 102 + "indexes": { 103 + "users_role_elevated_idx": { 104 + "name": "users_role_elevated_idx", 105 + "columns": [ 106 + { 107 + "expression": "role", 108 + "isExpression": false, 109 + "asc": true, 110 + "nulls": "last" 111 + } 112 + ], 113 + "isUnique": false, 114 + "where": "role IN ('moderator', 'admin')", 115 + "concurrently": false, 116 + "method": "btree", 117 + "with": {} 118 + }, 119 + "users_handle_idx": { 120 + "name": "users_handle_idx", 121 + "columns": [ 122 + { 123 + "expression": "handle", 124 + "isExpression": false, 125 + "asc": true, 126 + "nulls": "last" 127 + } 128 + ], 129 + "isUnique": false, 130 + "concurrently": false, 131 + "method": "btree", 132 + "with": {} 133 + }, 134 + "users_account_created_at_idx": { 135 + "name": "users_account_created_at_idx", 136 + "columns": [ 137 + { 138 + "expression": "account_created_at", 139 + "isExpression": false, 140 + "asc": true, 141 + "nulls": "last" 142 + } 143 + ], 144 + "isUnique": false, 145 + "concurrently": false, 146 + "method": "btree", 147 + "with": {} 148 + } 149 + }, 150 + "foreignKeys": {}, 151 + "compositePrimaryKeys": {}, 152 + "uniqueConstraints": {}, 153 + "policies": {}, 154 + "checkConstraints": {}, 155 + "isRLSEnabled": false 156 + }, 157 + "public.firehose_cursor": { 158 + "name": "firehose_cursor", 159 + "schema": "", 160 + "columns": { 161 + "id": { 162 + "name": "id", 163 + "type": "text", 164 + "primaryKey": true, 165 + "notNull": true, 166 + "default": "'default'" 167 + }, 168 + "cursor": { 169 + "name": "cursor", 170 + "type": "bigint", 171 + "primaryKey": false, 172 + "notNull": false 173 + }, 174 + "updated_at": { 175 + "name": "updated_at", 176 + "type": "timestamp with time zone", 177 + "primaryKey": false, 178 + "notNull": true, 179 + "default": "now()" 180 + } 181 + }, 182 + "indexes": {}, 183 + "foreignKeys": {}, 184 + "compositePrimaryKeys": {}, 185 + "uniqueConstraints": {}, 186 + "policies": {}, 187 + "checkConstraints": {}, 188 + "isRLSEnabled": false 189 + }, 190 + "public.topics": { 191 + "name": "topics", 192 + "schema": "", 193 + "columns": { 194 + "uri": { 195 + "name": "uri", 196 + "type": "text", 197 + "primaryKey": true, 198 + "notNull": true 199 + }, 200 + "rkey": { 201 + "name": "rkey", 202 + "type": "text", 203 + "primaryKey": false, 204 + "notNull": true 205 + }, 206 + "author_did": { 207 + "name": "author_did", 208 + "type": "text", 209 + "primaryKey": false, 210 + "notNull": true 211 + }, 212 + "title": { 213 + "name": "title", 214 + "type": "text", 215 + "primaryKey": false, 216 + "notNull": true 217 + }, 218 + "content": { 219 + "name": "content", 220 + "type": "text", 221 + "primaryKey": false, 222 + "notNull": true 223 + }, 224 + "content_format": { 225 + "name": "content_format", 226 + "type": "text", 227 + "primaryKey": false, 228 + "notNull": false 229 + }, 230 + "category": { 231 + "name": "category", 232 + "type": "text", 233 + "primaryKey": false, 234 + "notNull": true 235 + }, 236 + "tags": { 237 + "name": "tags", 238 + "type": "jsonb", 239 + "primaryKey": false, 240 + "notNull": false 241 + }, 242 + "community_did": { 243 + "name": "community_did", 244 + "type": "text", 245 + "primaryKey": false, 246 + "notNull": true 247 + }, 248 + "cid": { 249 + "name": "cid", 250 + "type": "text", 251 + "primaryKey": false, 252 + "notNull": true 253 + }, 254 + "labels": { 255 + "name": "labels", 256 + "type": "jsonb", 257 + "primaryKey": false, 258 + "notNull": false 259 + }, 260 + "reply_count": { 261 + "name": "reply_count", 262 + "type": "integer", 263 + "primaryKey": false, 264 + "notNull": true, 265 + "default": 0 266 + }, 267 + "reaction_count": { 268 + "name": "reaction_count", 269 + "type": "integer", 270 + "primaryKey": false, 271 + "notNull": true, 272 + "default": 0 273 + }, 274 + "last_activity_at": { 275 + "name": "last_activity_at", 276 + "type": "timestamp with time zone", 277 + "primaryKey": false, 278 + "notNull": true, 279 + "default": "now()" 280 + }, 281 + "created_at": { 282 + "name": "created_at", 283 + "type": "timestamp with time zone", 284 + "primaryKey": false, 285 + "notNull": true 286 + }, 287 + "indexed_at": { 288 + "name": "indexed_at", 289 + "type": "timestamp with time zone", 290 + "primaryKey": false, 291 + "notNull": true, 292 + "default": "now()" 293 + }, 294 + "is_locked": { 295 + "name": "is_locked", 296 + "type": "boolean", 297 + "primaryKey": false, 298 + "notNull": true, 299 + "default": false 300 + }, 301 + "is_pinned": { 302 + "name": "is_pinned", 303 + "type": "boolean", 304 + "primaryKey": false, 305 + "notNull": true, 306 + "default": false 307 + }, 308 + "is_mod_deleted": { 309 + "name": "is_mod_deleted", 310 + "type": "boolean", 311 + "primaryKey": false, 312 + "notNull": true, 313 + "default": false 314 + }, 315 + "is_author_deleted": { 316 + "name": "is_author_deleted", 317 + "type": "boolean", 318 + "primaryKey": false, 319 + "notNull": true, 320 + "default": false 321 + }, 322 + "moderation_status": { 323 + "name": "moderation_status", 324 + "type": "text", 325 + "primaryKey": false, 326 + "notNull": true, 327 + "default": "'approved'" 328 + }, 329 + "trust_status": { 330 + "name": "trust_status", 331 + "type": "text", 332 + "primaryKey": false, 333 + "notNull": true, 334 + "default": "'trusted'" 335 + } 336 + }, 337 + "indexes": { 338 + "topics_author_did_idx": { 339 + "name": "topics_author_did_idx", 340 + "columns": [ 341 + { 342 + "expression": "author_did", 343 + "isExpression": false, 344 + "asc": true, 345 + "nulls": "last" 346 + } 347 + ], 348 + "isUnique": false, 349 + "concurrently": false, 350 + "method": "btree", 351 + "with": {} 352 + }, 353 + "topics_category_idx": { 354 + "name": "topics_category_idx", 355 + "columns": [ 356 + { 357 + "expression": "category", 358 + "isExpression": false, 359 + "asc": true, 360 + "nulls": "last" 361 + } 362 + ], 363 + "isUnique": false, 364 + "concurrently": false, 365 + "method": "btree", 366 + "with": {} 367 + }, 368 + "topics_created_at_idx": { 369 + "name": "topics_created_at_idx", 370 + "columns": [ 371 + { 372 + "expression": "created_at", 373 + "isExpression": false, 374 + "asc": true, 375 + "nulls": "last" 376 + } 377 + ], 378 + "isUnique": false, 379 + "concurrently": false, 380 + "method": "btree", 381 + "with": {} 382 + }, 383 + "topics_last_activity_at_idx": { 384 + "name": "topics_last_activity_at_idx", 385 + "columns": [ 386 + { 387 + "expression": "last_activity_at", 388 + "isExpression": false, 389 + "asc": true, 390 + "nulls": "last" 391 + } 392 + ], 393 + "isUnique": false, 394 + "concurrently": false, 395 + "method": "btree", 396 + "with": {} 397 + }, 398 + "topics_community_did_idx": { 399 + "name": "topics_community_did_idx", 400 + "columns": [ 401 + { 402 + "expression": "community_did", 403 + "isExpression": false, 404 + "asc": true, 405 + "nulls": "last" 406 + } 407 + ], 408 + "isUnique": false, 409 + "concurrently": false, 410 + "method": "btree", 411 + "with": {} 412 + }, 413 + "topics_moderation_status_idx": { 414 + "name": "topics_moderation_status_idx", 415 + "columns": [ 416 + { 417 + "expression": "moderation_status", 418 + "isExpression": false, 419 + "asc": true, 420 + "nulls": "last" 421 + } 422 + ], 423 + "isUnique": false, 424 + "concurrently": false, 425 + "method": "btree", 426 + "with": {} 427 + }, 428 + "topics_trust_status_idx": { 429 + "name": "topics_trust_status_idx", 430 + "columns": [ 431 + { 432 + "expression": "trust_status", 433 + "isExpression": false, 434 + "asc": true, 435 + "nulls": "last" 436 + } 437 + ], 438 + "isUnique": false, 439 + "concurrently": false, 440 + "method": "btree", 441 + "with": {} 442 + }, 443 + "topics_community_category_activity_idx": { 444 + "name": "topics_community_category_activity_idx", 445 + "columns": [ 446 + { 447 + "expression": "community_did", 448 + "isExpression": false, 449 + "asc": true, 450 + "nulls": "last" 451 + }, 452 + { 453 + "expression": "category", 454 + "isExpression": false, 455 + "asc": true, 456 + "nulls": "last" 457 + }, 458 + { 459 + "expression": "last_activity_at", 460 + "isExpression": false, 461 + "asc": true, 462 + "nulls": "last" 463 + } 464 + ], 465 + "isUnique": false, 466 + "concurrently": false, 467 + "method": "btree", 468 + "with": {} 469 + } 470 + }, 471 + "foreignKeys": {}, 472 + "compositePrimaryKeys": {}, 473 + "uniqueConstraints": {}, 474 + "policies": {}, 475 + "checkConstraints": {}, 476 + "isRLSEnabled": false 477 + }, 478 + "public.replies": { 479 + "name": "replies", 480 + "schema": "", 481 + "columns": { 482 + "uri": { 483 + "name": "uri", 484 + "type": "text", 485 + "primaryKey": true, 486 + "notNull": true 487 + }, 488 + "rkey": { 489 + "name": "rkey", 490 + "type": "text", 491 + "primaryKey": false, 492 + "notNull": true 493 + }, 494 + "author_did": { 495 + "name": "author_did", 496 + "type": "text", 497 + "primaryKey": false, 498 + "notNull": true 499 + }, 500 + "content": { 501 + "name": "content", 502 + "type": "text", 503 + "primaryKey": false, 504 + "notNull": true 505 + }, 506 + "content_format": { 507 + "name": "content_format", 508 + "type": "text", 509 + "primaryKey": false, 510 + "notNull": false 511 + }, 512 + "root_uri": { 513 + "name": "root_uri", 514 + "type": "text", 515 + "primaryKey": false, 516 + "notNull": true 517 + }, 518 + "root_cid": { 519 + "name": "root_cid", 520 + "type": "text", 521 + "primaryKey": false, 522 + "notNull": true 523 + }, 524 + "parent_uri": { 525 + "name": "parent_uri", 526 + "type": "text", 527 + "primaryKey": false, 528 + "notNull": true 529 + }, 530 + "parent_cid": { 531 + "name": "parent_cid", 532 + "type": "text", 533 + "primaryKey": false, 534 + "notNull": true 535 + }, 536 + "community_did": { 537 + "name": "community_did", 538 + "type": "text", 539 + "primaryKey": false, 540 + "notNull": true 541 + }, 542 + "cid": { 543 + "name": "cid", 544 + "type": "text", 545 + "primaryKey": false, 546 + "notNull": true 547 + }, 548 + "labels": { 549 + "name": "labels", 550 + "type": "jsonb", 551 + "primaryKey": false, 552 + "notNull": false 553 + }, 554 + "reaction_count": { 555 + "name": "reaction_count", 556 + "type": "integer", 557 + "primaryKey": false, 558 + "notNull": true, 559 + "default": 0 560 + }, 561 + "created_at": { 562 + "name": "created_at", 563 + "type": "timestamp with time zone", 564 + "primaryKey": false, 565 + "notNull": true 566 + }, 567 + "indexed_at": { 568 + "name": "indexed_at", 569 + "type": "timestamp with time zone", 570 + "primaryKey": false, 571 + "notNull": true, 572 + "default": "now()" 573 + }, 574 + "is_author_deleted": { 575 + "name": "is_author_deleted", 576 + "type": "boolean", 577 + "primaryKey": false, 578 + "notNull": true, 579 + "default": false 580 + }, 581 + "moderation_status": { 582 + "name": "moderation_status", 583 + "type": "text", 584 + "primaryKey": false, 585 + "notNull": true, 586 + "default": "'approved'" 587 + }, 588 + "trust_status": { 589 + "name": "trust_status", 590 + "type": "text", 591 + "primaryKey": false, 592 + "notNull": true, 593 + "default": "'trusted'" 594 + } 595 + }, 596 + "indexes": { 597 + "replies_author_did_idx": { 598 + "name": "replies_author_did_idx", 599 + "columns": [ 600 + { 601 + "expression": "author_did", 602 + "isExpression": false, 603 + "asc": true, 604 + "nulls": "last" 605 + } 606 + ], 607 + "isUnique": false, 608 + "concurrently": false, 609 + "method": "btree", 610 + "with": {} 611 + }, 612 + "replies_root_uri_idx": { 613 + "name": "replies_root_uri_idx", 614 + "columns": [ 615 + { 616 + "expression": "root_uri", 617 + "isExpression": false, 618 + "asc": true, 619 + "nulls": "last" 620 + } 621 + ], 622 + "isUnique": false, 623 + "concurrently": false, 624 + "method": "btree", 625 + "with": {} 626 + }, 627 + "replies_parent_uri_idx": { 628 + "name": "replies_parent_uri_idx", 629 + "columns": [ 630 + { 631 + "expression": "parent_uri", 632 + "isExpression": false, 633 + "asc": true, 634 + "nulls": "last" 635 + } 636 + ], 637 + "isUnique": false, 638 + "concurrently": false, 639 + "method": "btree", 640 + "with": {} 641 + }, 642 + "replies_created_at_idx": { 643 + "name": "replies_created_at_idx", 644 + "columns": [ 645 + { 646 + "expression": "created_at", 647 + "isExpression": false, 648 + "asc": true, 649 + "nulls": "last" 650 + } 651 + ], 652 + "isUnique": false, 653 + "concurrently": false, 654 + "method": "btree", 655 + "with": {} 656 + }, 657 + "replies_community_did_idx": { 658 + "name": "replies_community_did_idx", 659 + "columns": [ 660 + { 661 + "expression": "community_did", 662 + "isExpression": false, 663 + "asc": true, 664 + "nulls": "last" 665 + } 666 + ], 667 + "isUnique": false, 668 + "concurrently": false, 669 + "method": "btree", 670 + "with": {} 671 + }, 672 + "replies_moderation_status_idx": { 673 + "name": "replies_moderation_status_idx", 674 + "columns": [ 675 + { 676 + "expression": "moderation_status", 677 + "isExpression": false, 678 + "asc": true, 679 + "nulls": "last" 680 + } 681 + ], 682 + "isUnique": false, 683 + "concurrently": false, 684 + "method": "btree", 685 + "with": {} 686 + }, 687 + "replies_trust_status_idx": { 688 + "name": "replies_trust_status_idx", 689 + "columns": [ 690 + { 691 + "expression": "trust_status", 692 + "isExpression": false, 693 + "asc": true, 694 + "nulls": "last" 695 + } 696 + ], 697 + "isUnique": false, 698 + "concurrently": false, 699 + "method": "btree", 700 + "with": {} 701 + }, 702 + "replies_root_uri_created_at_idx": { 703 + "name": "replies_root_uri_created_at_idx", 704 + "columns": [ 705 + { 706 + "expression": "root_uri", 707 + "isExpression": false, 708 + "asc": true, 709 + "nulls": "last" 710 + }, 711 + { 712 + "expression": "created_at", 713 + "isExpression": false, 714 + "asc": true, 715 + "nulls": "last" 716 + } 717 + ], 718 + "isUnique": false, 719 + "concurrently": false, 720 + "method": "btree", 721 + "with": {} 722 + } 723 + }, 724 + "foreignKeys": {}, 725 + "compositePrimaryKeys": {}, 726 + "uniqueConstraints": {}, 727 + "policies": {}, 728 + "checkConstraints": {}, 729 + "isRLSEnabled": false 730 + }, 731 + "public.reactions": { 732 + "name": "reactions", 733 + "schema": "", 734 + "columns": { 735 + "uri": { 736 + "name": "uri", 737 + "type": "text", 738 + "primaryKey": true, 739 + "notNull": true 740 + }, 741 + "rkey": { 742 + "name": "rkey", 743 + "type": "text", 744 + "primaryKey": false, 745 + "notNull": true 746 + }, 747 + "author_did": { 748 + "name": "author_did", 749 + "type": "text", 750 + "primaryKey": false, 751 + "notNull": true 752 + }, 753 + "subject_uri": { 754 + "name": "subject_uri", 755 + "type": "text", 756 + "primaryKey": false, 757 + "notNull": true 758 + }, 759 + "subject_cid": { 760 + "name": "subject_cid", 761 + "type": "text", 762 + "primaryKey": false, 763 + "notNull": true 764 + }, 765 + "type": { 766 + "name": "type", 767 + "type": "text", 768 + "primaryKey": false, 769 + "notNull": true 770 + }, 771 + "community_did": { 772 + "name": "community_did", 773 + "type": "text", 774 + "primaryKey": false, 775 + "notNull": true 776 + }, 777 + "cid": { 778 + "name": "cid", 779 + "type": "text", 780 + "primaryKey": false, 781 + "notNull": true 782 + }, 783 + "created_at": { 784 + "name": "created_at", 785 + "type": "timestamp with time zone", 786 + "primaryKey": false, 787 + "notNull": true 788 + }, 789 + "indexed_at": { 790 + "name": "indexed_at", 791 + "type": "timestamp with time zone", 792 + "primaryKey": false, 793 + "notNull": true, 794 + "default": "now()" 795 + } 796 + }, 797 + "indexes": { 798 + "reactions_author_did_idx": { 799 + "name": "reactions_author_did_idx", 800 + "columns": [ 801 + { 802 + "expression": "author_did", 803 + "isExpression": false, 804 + "asc": true, 805 + "nulls": "last" 806 + } 807 + ], 808 + "isUnique": false, 809 + "concurrently": false, 810 + "method": "btree", 811 + "with": {} 812 + }, 813 + "reactions_subject_uri_idx": { 814 + "name": "reactions_subject_uri_idx", 815 + "columns": [ 816 + { 817 + "expression": "subject_uri", 818 + "isExpression": false, 819 + "asc": true, 820 + "nulls": "last" 821 + } 822 + ], 823 + "isUnique": false, 824 + "concurrently": false, 825 + "method": "btree", 826 + "with": {} 827 + }, 828 + "reactions_community_did_idx": { 829 + "name": "reactions_community_did_idx", 830 + "columns": [ 831 + { 832 + "expression": "community_did", 833 + "isExpression": false, 834 + "asc": true, 835 + "nulls": "last" 836 + } 837 + ], 838 + "isUnique": false, 839 + "concurrently": false, 840 + "method": "btree", 841 + "with": {} 842 + }, 843 + "reactions_subject_uri_type_idx": { 844 + "name": "reactions_subject_uri_type_idx", 845 + "columns": [ 846 + { 847 + "expression": "subject_uri", 848 + "isExpression": false, 849 + "asc": true, 850 + "nulls": "last" 851 + }, 852 + { 853 + "expression": "type", 854 + "isExpression": false, 855 + "asc": true, 856 + "nulls": "last" 857 + } 858 + ], 859 + "isUnique": false, 860 + "concurrently": false, 861 + "method": "btree", 862 + "with": {} 863 + } 864 + }, 865 + "foreignKeys": {}, 866 + "compositePrimaryKeys": {}, 867 + "uniqueConstraints": { 868 + "reactions_author_subject_type_uniq": { 869 + "name": "reactions_author_subject_type_uniq", 870 + "nullsNotDistinct": false, 871 + "columns": ["author_did", "subject_uri", "type"] 872 + } 873 + }, 874 + "policies": {}, 875 + "checkConstraints": {}, 876 + "isRLSEnabled": false 877 + }, 878 + "public.tracked_repos": { 879 + "name": "tracked_repos", 880 + "schema": "", 881 + "columns": { 882 + "did": { 883 + "name": "did", 884 + "type": "text", 885 + "primaryKey": true, 886 + "notNull": true 887 + }, 888 + "tracked_at": { 889 + "name": "tracked_at", 890 + "type": "timestamp with time zone", 891 + "primaryKey": false, 892 + "notNull": true, 893 + "default": "now()" 894 + } 895 + }, 896 + "indexes": {}, 897 + "foreignKeys": {}, 898 + "compositePrimaryKeys": {}, 899 + "uniqueConstraints": {}, 900 + "policies": {}, 901 + "checkConstraints": {}, 902 + "isRLSEnabled": false 903 + }, 904 + "public.community_settings": { 905 + "name": "community_settings", 906 + "schema": "", 907 + "columns": { 908 + "id": { 909 + "name": "id", 910 + "type": "text", 911 + "primaryKey": true, 912 + "notNull": true, 913 + "default": "'default'" 914 + }, 915 + "initialized": { 916 + "name": "initialized", 917 + "type": "boolean", 918 + "primaryKey": false, 919 + "notNull": true, 920 + "default": false 921 + }, 922 + "community_did": { 923 + "name": "community_did", 924 + "type": "text", 925 + "primaryKey": false, 926 + "notNull": false 927 + }, 928 + "admin_did": { 929 + "name": "admin_did", 930 + "type": "text", 931 + "primaryKey": false, 932 + "notNull": false 933 + }, 934 + "community_name": { 935 + "name": "community_name", 936 + "type": "text", 937 + "primaryKey": false, 938 + "notNull": true, 939 + "default": "'Barazo Community'" 940 + }, 941 + "maturity_rating": { 942 + "name": "maturity_rating", 943 + "type": "text", 944 + "primaryKey": false, 945 + "notNull": true, 946 + "default": "'safe'" 947 + }, 948 + "reaction_set": { 949 + "name": "reaction_set", 950 + "type": "jsonb", 951 + "primaryKey": false, 952 + "notNull": true, 953 + "default": "'[\"like\"]'::jsonb" 954 + }, 955 + "moderation_thresholds": { 956 + "name": "moderation_thresholds", 957 + "type": "jsonb", 958 + "primaryKey": false, 959 + "notNull": true, 960 + "default": "'{\"autoBlockReportCount\":5,\"warnThreshold\":3,\"firstPostQueueCount\":3,\"newAccountDays\":7,\"newAccountWriteRatePerMin\":3,\"establishedWriteRatePerMin\":10,\"linkHoldEnabled\":true,\"topicCreationDelayEnabled\":true,\"burstPostCount\":5,\"burstWindowMinutes\":10,\"trustedPostThreshold\":10}'::jsonb" 961 + }, 962 + "word_filter": { 963 + "name": "word_filter", 964 + "type": "jsonb", 965 + "primaryKey": false, 966 + "notNull": true, 967 + "default": "'[]'::jsonb" 968 + }, 969 + "jurisdiction_country": { 970 + "name": "jurisdiction_country", 971 + "type": "text", 972 + "primaryKey": false, 973 + "notNull": false 974 + }, 975 + "age_threshold": { 976 + "name": "age_threshold", 977 + "type": "integer", 978 + "primaryKey": false, 979 + "notNull": true, 980 + "default": 16 981 + }, 982 + "require_login_for_mature": { 983 + "name": "require_login_for_mature", 984 + "type": "boolean", 985 + "primaryKey": false, 986 + "notNull": true, 987 + "default": true 988 + }, 989 + "community_description": { 990 + "name": "community_description", 991 + "type": "text", 992 + "primaryKey": false, 993 + "notNull": false 994 + }, 995 + "handle": { 996 + "name": "handle", 997 + "type": "text", 998 + "primaryKey": false, 999 + "notNull": false 1000 + }, 1001 + "service_endpoint": { 1002 + "name": "service_endpoint", 1003 + "type": "text", 1004 + "primaryKey": false, 1005 + "notNull": false 1006 + }, 1007 + "signing_key": { 1008 + "name": "signing_key", 1009 + "type": "text", 1010 + "primaryKey": false, 1011 + "notNull": false 1012 + }, 1013 + "rotation_key": { 1014 + "name": "rotation_key", 1015 + "type": "text", 1016 + "primaryKey": false, 1017 + "notNull": false 1018 + }, 1019 + "community_logo_url": { 1020 + "name": "community_logo_url", 1021 + "type": "text", 1022 + "primaryKey": false, 1023 + "notNull": false 1024 + }, 1025 + "primary_color": { 1026 + "name": "primary_color", 1027 + "type": "text", 1028 + "primaryKey": false, 1029 + "notNull": false 1030 + }, 1031 + "accent_color": { 1032 + "name": "accent_color", 1033 + "type": "text", 1034 + "primaryKey": false, 1035 + "notNull": false 1036 + }, 1037 + "created_at": { 1038 + "name": "created_at", 1039 + "type": "timestamp with time zone", 1040 + "primaryKey": false, 1041 + "notNull": true, 1042 + "default": "now()" 1043 + }, 1044 + "updated_at": { 1045 + "name": "updated_at", 1046 + "type": "timestamp with time zone", 1047 + "primaryKey": false, 1048 + "notNull": true, 1049 + "default": "now()" 1050 + } 1051 + }, 1052 + "indexes": {}, 1053 + "foreignKeys": {}, 1054 + "compositePrimaryKeys": {}, 1055 + "uniqueConstraints": {}, 1056 + "policies": {}, 1057 + "checkConstraints": {}, 1058 + "isRLSEnabled": false 1059 + }, 1060 + "public.categories": { 1061 + "name": "categories", 1062 + "schema": "", 1063 + "columns": { 1064 + "id": { 1065 + "name": "id", 1066 + "type": "text", 1067 + "primaryKey": true, 1068 + "notNull": true 1069 + }, 1070 + "slug": { 1071 + "name": "slug", 1072 + "type": "text", 1073 + "primaryKey": false, 1074 + "notNull": true 1075 + }, 1076 + "name": { 1077 + "name": "name", 1078 + "type": "text", 1079 + "primaryKey": false, 1080 + "notNull": true 1081 + }, 1082 + "description": { 1083 + "name": "description", 1084 + "type": "text", 1085 + "primaryKey": false, 1086 + "notNull": false 1087 + }, 1088 + "parent_id": { 1089 + "name": "parent_id", 1090 + "type": "text", 1091 + "primaryKey": false, 1092 + "notNull": false 1093 + }, 1094 + "sort_order": { 1095 + "name": "sort_order", 1096 + "type": "integer", 1097 + "primaryKey": false, 1098 + "notNull": true, 1099 + "default": 0 1100 + }, 1101 + "community_did": { 1102 + "name": "community_did", 1103 + "type": "text", 1104 + "primaryKey": false, 1105 + "notNull": true 1106 + }, 1107 + "maturity_rating": { 1108 + "name": "maturity_rating", 1109 + "type": "text", 1110 + "primaryKey": false, 1111 + "notNull": true, 1112 + "default": "'safe'" 1113 + }, 1114 + "created_at": { 1115 + "name": "created_at", 1116 + "type": "timestamp with time zone", 1117 + "primaryKey": false, 1118 + "notNull": true, 1119 + "default": "now()" 1120 + }, 1121 + "updated_at": { 1122 + "name": "updated_at", 1123 + "type": "timestamp with time zone", 1124 + "primaryKey": false, 1125 + "notNull": true, 1126 + "default": "now()" 1127 + } 1128 + }, 1129 + "indexes": { 1130 + "categories_slug_community_did_idx": { 1131 + "name": "categories_slug_community_did_idx", 1132 + "columns": [ 1133 + { 1134 + "expression": "slug", 1135 + "isExpression": false, 1136 + "asc": true, 1137 + "nulls": "last" 1138 + }, 1139 + { 1140 + "expression": "community_did", 1141 + "isExpression": false, 1142 + "asc": true, 1143 + "nulls": "last" 1144 + } 1145 + ], 1146 + "isUnique": true, 1147 + "concurrently": false, 1148 + "method": "btree", 1149 + "with": {} 1150 + }, 1151 + "categories_parent_id_idx": { 1152 + "name": "categories_parent_id_idx", 1153 + "columns": [ 1154 + { 1155 + "expression": "parent_id", 1156 + "isExpression": false, 1157 + "asc": true, 1158 + "nulls": "last" 1159 + } 1160 + ], 1161 + "isUnique": false, 1162 + "concurrently": false, 1163 + "method": "btree", 1164 + "with": {} 1165 + }, 1166 + "categories_community_did_idx": { 1167 + "name": "categories_community_did_idx", 1168 + "columns": [ 1169 + { 1170 + "expression": "community_did", 1171 + "isExpression": false, 1172 + "asc": true, 1173 + "nulls": "last" 1174 + } 1175 + ], 1176 + "isUnique": false, 1177 + "concurrently": false, 1178 + "method": "btree", 1179 + "with": {} 1180 + }, 1181 + "categories_maturity_rating_idx": { 1182 + "name": "categories_maturity_rating_idx", 1183 + "columns": [ 1184 + { 1185 + "expression": "maturity_rating", 1186 + "isExpression": false, 1187 + "asc": true, 1188 + "nulls": "last" 1189 + } 1190 + ], 1191 + "isUnique": false, 1192 + "concurrently": false, 1193 + "method": "btree", 1194 + "with": {} 1195 + } 1196 + }, 1197 + "foreignKeys": { 1198 + "categories_parent_id_fk": { 1199 + "name": "categories_parent_id_fk", 1200 + "tableFrom": "categories", 1201 + "tableTo": "categories", 1202 + "columnsFrom": ["parent_id"], 1203 + "columnsTo": ["id"], 1204 + "onDelete": "set null", 1205 + "onUpdate": "no action" 1206 + } 1207 + }, 1208 + "compositePrimaryKeys": {}, 1209 + "uniqueConstraints": {}, 1210 + "policies": {}, 1211 + "checkConstraints": {}, 1212 + "isRLSEnabled": false 1213 + }, 1214 + "public.moderation_actions": { 1215 + "name": "moderation_actions", 1216 + "schema": "", 1217 + "columns": { 1218 + "id": { 1219 + "name": "id", 1220 + "type": "serial", 1221 + "primaryKey": true, 1222 + "notNull": true 1223 + }, 1224 + "action": { 1225 + "name": "action", 1226 + "type": "text", 1227 + "primaryKey": false, 1228 + "notNull": true 1229 + }, 1230 + "target_uri": { 1231 + "name": "target_uri", 1232 + "type": "text", 1233 + "primaryKey": false, 1234 + "notNull": false 1235 + }, 1236 + "target_did": { 1237 + "name": "target_did", 1238 + "type": "text", 1239 + "primaryKey": false, 1240 + "notNull": false 1241 + }, 1242 + "moderator_did": { 1243 + "name": "moderator_did", 1244 + "type": "text", 1245 + "primaryKey": false, 1246 + "notNull": true 1247 + }, 1248 + "community_did": { 1249 + "name": "community_did", 1250 + "type": "text", 1251 + "primaryKey": false, 1252 + "notNull": true 1253 + }, 1254 + "reason": { 1255 + "name": "reason", 1256 + "type": "text", 1257 + "primaryKey": false, 1258 + "notNull": false 1259 + }, 1260 + "created_at": { 1261 + "name": "created_at", 1262 + "type": "timestamp with time zone", 1263 + "primaryKey": false, 1264 + "notNull": true, 1265 + "default": "now()" 1266 + } 1267 + }, 1268 + "indexes": { 1269 + "mod_actions_moderator_did_idx": { 1270 + "name": "mod_actions_moderator_did_idx", 1271 + "columns": [ 1272 + { 1273 + "expression": "moderator_did", 1274 + "isExpression": false, 1275 + "asc": true, 1276 + "nulls": "last" 1277 + } 1278 + ], 1279 + "isUnique": false, 1280 + "concurrently": false, 1281 + "method": "btree", 1282 + "with": {} 1283 + }, 1284 + "mod_actions_community_did_idx": { 1285 + "name": "mod_actions_community_did_idx", 1286 + "columns": [ 1287 + { 1288 + "expression": "community_did", 1289 + "isExpression": false, 1290 + "asc": true, 1291 + "nulls": "last" 1292 + } 1293 + ], 1294 + "isUnique": false, 1295 + "concurrently": false, 1296 + "method": "btree", 1297 + "with": {} 1298 + }, 1299 + "mod_actions_created_at_idx": { 1300 + "name": "mod_actions_created_at_idx", 1301 + "columns": [ 1302 + { 1303 + "expression": "created_at", 1304 + "isExpression": false, 1305 + "asc": true, 1306 + "nulls": "last" 1307 + } 1308 + ], 1309 + "isUnique": false, 1310 + "concurrently": false, 1311 + "method": "btree", 1312 + "with": {} 1313 + }, 1314 + "mod_actions_target_uri_idx": { 1315 + "name": "mod_actions_target_uri_idx", 1316 + "columns": [ 1317 + { 1318 + "expression": "target_uri", 1319 + "isExpression": false, 1320 + "asc": true, 1321 + "nulls": "last" 1322 + } 1323 + ], 1324 + "isUnique": false, 1325 + "concurrently": false, 1326 + "method": "btree", 1327 + "with": {} 1328 + }, 1329 + "mod_actions_target_did_idx": { 1330 + "name": "mod_actions_target_did_idx", 1331 + "columns": [ 1332 + { 1333 + "expression": "target_did", 1334 + "isExpression": false, 1335 + "asc": true, 1336 + "nulls": "last" 1337 + } 1338 + ], 1339 + "isUnique": false, 1340 + "concurrently": false, 1341 + "method": "btree", 1342 + "with": {} 1343 + } 1344 + }, 1345 + "foreignKeys": {}, 1346 + "compositePrimaryKeys": {}, 1347 + "uniqueConstraints": {}, 1348 + "policies": {}, 1349 + "checkConstraints": {}, 1350 + "isRLSEnabled": false 1351 + }, 1352 + "public.reports": { 1353 + "name": "reports", 1354 + "schema": "", 1355 + "columns": { 1356 + "id": { 1357 + "name": "id", 1358 + "type": "serial", 1359 + "primaryKey": true, 1360 + "notNull": true 1361 + }, 1362 + "reporter_did": { 1363 + "name": "reporter_did", 1364 + "type": "text", 1365 + "primaryKey": false, 1366 + "notNull": true 1367 + }, 1368 + "target_uri": { 1369 + "name": "target_uri", 1370 + "type": "text", 1371 + "primaryKey": false, 1372 + "notNull": true 1373 + }, 1374 + "target_did": { 1375 + "name": "target_did", 1376 + "type": "text", 1377 + "primaryKey": false, 1378 + "notNull": true 1379 + }, 1380 + "reason_type": { 1381 + "name": "reason_type", 1382 + "type": "text", 1383 + "primaryKey": false, 1384 + "notNull": true 1385 + }, 1386 + "description": { 1387 + "name": "description", 1388 + "type": "text", 1389 + "primaryKey": false, 1390 + "notNull": false 1391 + }, 1392 + "community_did": { 1393 + "name": "community_did", 1394 + "type": "text", 1395 + "primaryKey": false, 1396 + "notNull": true 1397 + }, 1398 + "status": { 1399 + "name": "status", 1400 + "type": "text", 1401 + "primaryKey": false, 1402 + "notNull": true, 1403 + "default": "'pending'" 1404 + }, 1405 + "resolution_type": { 1406 + "name": "resolution_type", 1407 + "type": "text", 1408 + "primaryKey": false, 1409 + "notNull": false 1410 + }, 1411 + "resolved_by": { 1412 + "name": "resolved_by", 1413 + "type": "text", 1414 + "primaryKey": false, 1415 + "notNull": false 1416 + }, 1417 + "resolved_at": { 1418 + "name": "resolved_at", 1419 + "type": "timestamp with time zone", 1420 + "primaryKey": false, 1421 + "notNull": false 1422 + }, 1423 + "appeal_reason": { 1424 + "name": "appeal_reason", 1425 + "type": "text", 1426 + "primaryKey": false, 1427 + "notNull": false 1428 + }, 1429 + "appealed_at": { 1430 + "name": "appealed_at", 1431 + "type": "timestamp with time zone", 1432 + "primaryKey": false, 1433 + "notNull": false 1434 + }, 1435 + "appeal_status": { 1436 + "name": "appeal_status", 1437 + "type": "text", 1438 + "primaryKey": false, 1439 + "notNull": true, 1440 + "default": "'none'" 1441 + }, 1442 + "created_at": { 1443 + "name": "created_at", 1444 + "type": "timestamp with time zone", 1445 + "primaryKey": false, 1446 + "notNull": true, 1447 + "default": "now()" 1448 + } 1449 + }, 1450 + "indexes": { 1451 + "reports_reporter_did_idx": { 1452 + "name": "reports_reporter_did_idx", 1453 + "columns": [ 1454 + { 1455 + "expression": "reporter_did", 1456 + "isExpression": false, 1457 + "asc": true, 1458 + "nulls": "last" 1459 + } 1460 + ], 1461 + "isUnique": false, 1462 + "concurrently": false, 1463 + "method": "btree", 1464 + "with": {} 1465 + }, 1466 + "reports_target_uri_idx": { 1467 + "name": "reports_target_uri_idx", 1468 + "columns": [ 1469 + { 1470 + "expression": "target_uri", 1471 + "isExpression": false, 1472 + "asc": true, 1473 + "nulls": "last" 1474 + } 1475 + ], 1476 + "isUnique": false, 1477 + "concurrently": false, 1478 + "method": "btree", 1479 + "with": {} 1480 + }, 1481 + "reports_target_did_idx": { 1482 + "name": "reports_target_did_idx", 1483 + "columns": [ 1484 + { 1485 + "expression": "target_did", 1486 + "isExpression": false, 1487 + "asc": true, 1488 + "nulls": "last" 1489 + } 1490 + ], 1491 + "isUnique": false, 1492 + "concurrently": false, 1493 + "method": "btree", 1494 + "with": {} 1495 + }, 1496 + "reports_community_did_idx": { 1497 + "name": "reports_community_did_idx", 1498 + "columns": [ 1499 + { 1500 + "expression": "community_did", 1501 + "isExpression": false, 1502 + "asc": true, 1503 + "nulls": "last" 1504 + } 1505 + ], 1506 + "isUnique": false, 1507 + "concurrently": false, 1508 + "method": "btree", 1509 + "with": {} 1510 + }, 1511 + "reports_status_idx": { 1512 + "name": "reports_status_idx", 1513 + "columns": [ 1514 + { 1515 + "expression": "status", 1516 + "isExpression": false, 1517 + "asc": true, 1518 + "nulls": "last" 1519 + } 1520 + ], 1521 + "isUnique": false, 1522 + "concurrently": false, 1523 + "method": "btree", 1524 + "with": {} 1525 + }, 1526 + "reports_created_at_idx": { 1527 + "name": "reports_created_at_idx", 1528 + "columns": [ 1529 + { 1530 + "expression": "created_at", 1531 + "isExpression": false, 1532 + "asc": true, 1533 + "nulls": "last" 1534 + } 1535 + ], 1536 + "isUnique": false, 1537 + "concurrently": false, 1538 + "method": "btree", 1539 + "with": {} 1540 + }, 1541 + "reports_unique_reporter_target_idx": { 1542 + "name": "reports_unique_reporter_target_idx", 1543 + "columns": [ 1544 + { 1545 + "expression": "reporter_did", 1546 + "isExpression": false, 1547 + "asc": true, 1548 + "nulls": "last" 1549 + }, 1550 + { 1551 + "expression": "target_uri", 1552 + "isExpression": false, 1553 + "asc": true, 1554 + "nulls": "last" 1555 + }, 1556 + { 1557 + "expression": "community_did", 1558 + "isExpression": false, 1559 + "asc": true, 1560 + "nulls": "last" 1561 + } 1562 + ], 1563 + "isUnique": true, 1564 + "concurrently": false, 1565 + "method": "btree", 1566 + "with": {} 1567 + } 1568 + }, 1569 + "foreignKeys": {}, 1570 + "compositePrimaryKeys": {}, 1571 + "uniqueConstraints": {}, 1572 + "policies": {}, 1573 + "checkConstraints": {}, 1574 + "isRLSEnabled": false 1575 + }, 1576 + "public.notifications": { 1577 + "name": "notifications", 1578 + "schema": "", 1579 + "columns": { 1580 + "id": { 1581 + "name": "id", 1582 + "type": "serial", 1583 + "primaryKey": true, 1584 + "notNull": true 1585 + }, 1586 + "recipient_did": { 1587 + "name": "recipient_did", 1588 + "type": "text", 1589 + "primaryKey": false, 1590 + "notNull": true 1591 + }, 1592 + "type": { 1593 + "name": "type", 1594 + "type": "text", 1595 + "primaryKey": false, 1596 + "notNull": true 1597 + }, 1598 + "subject_uri": { 1599 + "name": "subject_uri", 1600 + "type": "text", 1601 + "primaryKey": false, 1602 + "notNull": true 1603 + }, 1604 + "actor_did": { 1605 + "name": "actor_did", 1606 + "type": "text", 1607 + "primaryKey": false, 1608 + "notNull": true 1609 + }, 1610 + "community_did": { 1611 + "name": "community_did", 1612 + "type": "text", 1613 + "primaryKey": false, 1614 + "notNull": true 1615 + }, 1616 + "read": { 1617 + "name": "read", 1618 + "type": "boolean", 1619 + "primaryKey": false, 1620 + "notNull": true, 1621 + "default": false 1622 + }, 1623 + "created_at": { 1624 + "name": "created_at", 1625 + "type": "timestamp with time zone", 1626 + "primaryKey": false, 1627 + "notNull": true, 1628 + "default": "now()" 1629 + } 1630 + }, 1631 + "indexes": { 1632 + "notifications_recipient_did_idx": { 1633 + "name": "notifications_recipient_did_idx", 1634 + "columns": [ 1635 + { 1636 + "expression": "recipient_did", 1637 + "isExpression": false, 1638 + "asc": true, 1639 + "nulls": "last" 1640 + } 1641 + ], 1642 + "isUnique": false, 1643 + "concurrently": false, 1644 + "method": "btree", 1645 + "with": {} 1646 + }, 1647 + "notifications_recipient_read_idx": { 1648 + "name": "notifications_recipient_read_idx", 1649 + "columns": [ 1650 + { 1651 + "expression": "recipient_did", 1652 + "isExpression": false, 1653 + "asc": true, 1654 + "nulls": "last" 1655 + }, 1656 + { 1657 + "expression": "read", 1658 + "isExpression": false, 1659 + "asc": true, 1660 + "nulls": "last" 1661 + } 1662 + ], 1663 + "isUnique": false, 1664 + "concurrently": false, 1665 + "method": "btree", 1666 + "with": {} 1667 + }, 1668 + "notifications_created_at_idx": { 1669 + "name": "notifications_created_at_idx", 1670 + "columns": [ 1671 + { 1672 + "expression": "created_at", 1673 + "isExpression": false, 1674 + "asc": true, 1675 + "nulls": "last" 1676 + } 1677 + ], 1678 + "isUnique": false, 1679 + "concurrently": false, 1680 + "method": "btree", 1681 + "with": {} 1682 + } 1683 + }, 1684 + "foreignKeys": {}, 1685 + "compositePrimaryKeys": {}, 1686 + "uniqueConstraints": {}, 1687 + "policies": {}, 1688 + "checkConstraints": {}, 1689 + "isRLSEnabled": false 1690 + }, 1691 + "public.user_community_preferences": { 1692 + "name": "user_community_preferences", 1693 + "schema": "", 1694 + "columns": { 1695 + "did": { 1696 + "name": "did", 1697 + "type": "text", 1698 + "primaryKey": false, 1699 + "notNull": true 1700 + }, 1701 + "community_did": { 1702 + "name": "community_did", 1703 + "type": "text", 1704 + "primaryKey": false, 1705 + "notNull": true 1706 + }, 1707 + "maturity_override": { 1708 + "name": "maturity_override", 1709 + "type": "text", 1710 + "primaryKey": false, 1711 + "notNull": false 1712 + }, 1713 + "muted_words": { 1714 + "name": "muted_words", 1715 + "type": "jsonb", 1716 + "primaryKey": false, 1717 + "notNull": false 1718 + }, 1719 + "blocked_dids": { 1720 + "name": "blocked_dids", 1721 + "type": "jsonb", 1722 + "primaryKey": false, 1723 + "notNull": false 1724 + }, 1725 + "muted_dids": { 1726 + "name": "muted_dids", 1727 + "type": "jsonb", 1728 + "primaryKey": false, 1729 + "notNull": false 1730 + }, 1731 + "notification_prefs": { 1732 + "name": "notification_prefs", 1733 + "type": "jsonb", 1734 + "primaryKey": false, 1735 + "notNull": false 1736 + }, 1737 + "updated_at": { 1738 + "name": "updated_at", 1739 + "type": "timestamp with time zone", 1740 + "primaryKey": false, 1741 + "notNull": true, 1742 + "default": "now()" 1743 + } 1744 + }, 1745 + "indexes": { 1746 + "user_community_prefs_did_idx": { 1747 + "name": "user_community_prefs_did_idx", 1748 + "columns": [ 1749 + { 1750 + "expression": "did", 1751 + "isExpression": false, 1752 + "asc": true, 1753 + "nulls": "last" 1754 + } 1755 + ], 1756 + "isUnique": false, 1757 + "concurrently": false, 1758 + "method": "btree", 1759 + "with": {} 1760 + }, 1761 + "user_community_prefs_community_idx": { 1762 + "name": "user_community_prefs_community_idx", 1763 + "columns": [ 1764 + { 1765 + "expression": "community_did", 1766 + "isExpression": false, 1767 + "asc": true, 1768 + "nulls": "last" 1769 + } 1770 + ], 1771 + "isUnique": false, 1772 + "concurrently": false, 1773 + "method": "btree", 1774 + "with": {} 1775 + } 1776 + }, 1777 + "foreignKeys": {}, 1778 + "compositePrimaryKeys": { 1779 + "user_community_preferences_did_community_did_pk": { 1780 + "name": "user_community_preferences_did_community_did_pk", 1781 + "columns": ["did", "community_did"] 1782 + } 1783 + }, 1784 + "uniqueConstraints": {}, 1785 + "policies": {}, 1786 + "checkConstraints": {}, 1787 + "isRLSEnabled": false 1788 + }, 1789 + "public.user_preferences": { 1790 + "name": "user_preferences", 1791 + "schema": "", 1792 + "columns": { 1793 + "did": { 1794 + "name": "did", 1795 + "type": "text", 1796 + "primaryKey": true, 1797 + "notNull": true 1798 + }, 1799 + "maturity_level": { 1800 + "name": "maturity_level", 1801 + "type": "text", 1802 + "primaryKey": false, 1803 + "notNull": true, 1804 + "default": "'sfw'" 1805 + }, 1806 + "declared_age": { 1807 + "name": "declared_age", 1808 + "type": "integer", 1809 + "primaryKey": false, 1810 + "notNull": false 1811 + }, 1812 + "muted_words": { 1813 + "name": "muted_words", 1814 + "type": "jsonb", 1815 + "primaryKey": false, 1816 + "notNull": true, 1817 + "default": "'[]'::jsonb" 1818 + }, 1819 + "blocked_dids": { 1820 + "name": "blocked_dids", 1821 + "type": "jsonb", 1822 + "primaryKey": false, 1823 + "notNull": true, 1824 + "default": "'[]'::jsonb" 1825 + }, 1826 + "muted_dids": { 1827 + "name": "muted_dids", 1828 + "type": "jsonb", 1829 + "primaryKey": false, 1830 + "notNull": true, 1831 + "default": "'[]'::jsonb" 1832 + }, 1833 + "cross_post_bluesky": { 1834 + "name": "cross_post_bluesky", 1835 + "type": "boolean", 1836 + "primaryKey": false, 1837 + "notNull": true, 1838 + "default": false 1839 + }, 1840 + "cross_post_frontpage": { 1841 + "name": "cross_post_frontpage", 1842 + "type": "boolean", 1843 + "primaryKey": false, 1844 + "notNull": true, 1845 + "default": false 1846 + }, 1847 + "cross_post_scopes_granted": { 1848 + "name": "cross_post_scopes_granted", 1849 + "type": "boolean", 1850 + "primaryKey": false, 1851 + "notNull": true, 1852 + "default": false 1853 + }, 1854 + "updated_at": { 1855 + "name": "updated_at", 1856 + "type": "timestamp with time zone", 1857 + "primaryKey": false, 1858 + "notNull": true, 1859 + "default": "now()" 1860 + } 1861 + }, 1862 + "indexes": {}, 1863 + "foreignKeys": {}, 1864 + "compositePrimaryKeys": {}, 1865 + "uniqueConstraints": {}, 1866 + "policies": {}, 1867 + "checkConstraints": {}, 1868 + "isRLSEnabled": false 1869 + }, 1870 + "public.cross_posts": { 1871 + "name": "cross_posts", 1872 + "schema": "", 1873 + "columns": { 1874 + "id": { 1875 + "name": "id", 1876 + "type": "text", 1877 + "primaryKey": true, 1878 + "notNull": true 1879 + }, 1880 + "topic_uri": { 1881 + "name": "topic_uri", 1882 + "type": "text", 1883 + "primaryKey": false, 1884 + "notNull": true 1885 + }, 1886 + "service": { 1887 + "name": "service", 1888 + "type": "text", 1889 + "primaryKey": false, 1890 + "notNull": true 1891 + }, 1892 + "cross_post_uri": { 1893 + "name": "cross_post_uri", 1894 + "type": "text", 1895 + "primaryKey": false, 1896 + "notNull": true 1897 + }, 1898 + "cross_post_cid": { 1899 + "name": "cross_post_cid", 1900 + "type": "text", 1901 + "primaryKey": false, 1902 + "notNull": true 1903 + }, 1904 + "author_did": { 1905 + "name": "author_did", 1906 + "type": "text", 1907 + "primaryKey": false, 1908 + "notNull": true 1909 + }, 1910 + "created_at": { 1911 + "name": "created_at", 1912 + "type": "timestamp with time zone", 1913 + "primaryKey": false, 1914 + "notNull": true, 1915 + "default": "now()" 1916 + } 1917 + }, 1918 + "indexes": { 1919 + "cross_posts_topic_uri_idx": { 1920 + "name": "cross_posts_topic_uri_idx", 1921 + "columns": [ 1922 + { 1923 + "expression": "topic_uri", 1924 + "isExpression": false, 1925 + "asc": true, 1926 + "nulls": "last" 1927 + } 1928 + ], 1929 + "isUnique": false, 1930 + "concurrently": false, 1931 + "method": "btree", 1932 + "with": {} 1933 + }, 1934 + "cross_posts_author_did_idx": { 1935 + "name": "cross_posts_author_did_idx", 1936 + "columns": [ 1937 + { 1938 + "expression": "author_did", 1939 + "isExpression": false, 1940 + "asc": true, 1941 + "nulls": "last" 1942 + } 1943 + ], 1944 + "isUnique": false, 1945 + "concurrently": false, 1946 + "method": "btree", 1947 + "with": {} 1948 + } 1949 + }, 1950 + "foreignKeys": {}, 1951 + "compositePrimaryKeys": {}, 1952 + "uniqueConstraints": {}, 1953 + "policies": {}, 1954 + "checkConstraints": {}, 1955 + "isRLSEnabled": false 1956 + }, 1957 + "public.community_onboarding_fields": { 1958 + "name": "community_onboarding_fields", 1959 + "schema": "", 1960 + "columns": { 1961 + "id": { 1962 + "name": "id", 1963 + "type": "text", 1964 + "primaryKey": true, 1965 + "notNull": true 1966 + }, 1967 + "community_did": { 1968 + "name": "community_did", 1969 + "type": "text", 1970 + "primaryKey": false, 1971 + "notNull": true 1972 + }, 1973 + "field_type": { 1974 + "name": "field_type", 1975 + "type": "text", 1976 + "primaryKey": false, 1977 + "notNull": true 1978 + }, 1979 + "label": { 1980 + "name": "label", 1981 + "type": "text", 1982 + "primaryKey": false, 1983 + "notNull": true 1984 + }, 1985 + "description": { 1986 + "name": "description", 1987 + "type": "text", 1988 + "primaryKey": false, 1989 + "notNull": false 1990 + }, 1991 + "is_mandatory": { 1992 + "name": "is_mandatory", 1993 + "type": "boolean", 1994 + "primaryKey": false, 1995 + "notNull": true, 1996 + "default": true 1997 + }, 1998 + "sort_order": { 1999 + "name": "sort_order", 2000 + "type": "integer", 2001 + "primaryKey": false, 2002 + "notNull": true, 2003 + "default": 0 2004 + }, 2005 + "config": { 2006 + "name": "config", 2007 + "type": "jsonb", 2008 + "primaryKey": false, 2009 + "notNull": false 2010 + }, 2011 + "created_at": { 2012 + "name": "created_at", 2013 + "type": "timestamp with time zone", 2014 + "primaryKey": false, 2015 + "notNull": true, 2016 + "default": "now()" 2017 + }, 2018 + "updated_at": { 2019 + "name": "updated_at", 2020 + "type": "timestamp with time zone", 2021 + "primaryKey": false, 2022 + "notNull": true, 2023 + "default": "now()" 2024 + } 2025 + }, 2026 + "indexes": { 2027 + "onboarding_fields_community_idx": { 2028 + "name": "onboarding_fields_community_idx", 2029 + "columns": [ 2030 + { 2031 + "expression": "community_did", 2032 + "isExpression": false, 2033 + "asc": true, 2034 + "nulls": "last" 2035 + } 2036 + ], 2037 + "isUnique": false, 2038 + "concurrently": false, 2039 + "method": "btree", 2040 + "with": {} 2041 + } 2042 + }, 2043 + "foreignKeys": {}, 2044 + "compositePrimaryKeys": {}, 2045 + "uniqueConstraints": {}, 2046 + "policies": {}, 2047 + "checkConstraints": {}, 2048 + "isRLSEnabled": false 2049 + }, 2050 + "public.user_onboarding_responses": { 2051 + "name": "user_onboarding_responses", 2052 + "schema": "", 2053 + "columns": { 2054 + "did": { 2055 + "name": "did", 2056 + "type": "text", 2057 + "primaryKey": false, 2058 + "notNull": true 2059 + }, 2060 + "community_did": { 2061 + "name": "community_did", 2062 + "type": "text", 2063 + "primaryKey": false, 2064 + "notNull": true 2065 + }, 2066 + "field_id": { 2067 + "name": "field_id", 2068 + "type": "text", 2069 + "primaryKey": false, 2070 + "notNull": true 2071 + }, 2072 + "response": { 2073 + "name": "response", 2074 + "type": "jsonb", 2075 + "primaryKey": false, 2076 + "notNull": true 2077 + }, 2078 + "completed_at": { 2079 + "name": "completed_at", 2080 + "type": "timestamp with time zone", 2081 + "primaryKey": false, 2082 + "notNull": true, 2083 + "default": "now()" 2084 + } 2085 + }, 2086 + "indexes": { 2087 + "onboarding_responses_did_community_idx": { 2088 + "name": "onboarding_responses_did_community_idx", 2089 + "columns": [ 2090 + { 2091 + "expression": "did", 2092 + "isExpression": false, 2093 + "asc": true, 2094 + "nulls": "last" 2095 + }, 2096 + { 2097 + "expression": "community_did", 2098 + "isExpression": false, 2099 + "asc": true, 2100 + "nulls": "last" 2101 + } 2102 + ], 2103 + "isUnique": false, 2104 + "concurrently": false, 2105 + "method": "btree", 2106 + "with": {} 2107 + } 2108 + }, 2109 + "foreignKeys": {}, 2110 + "compositePrimaryKeys": { 2111 + "user_onboarding_responses_did_community_did_field_id_pk": { 2112 + "name": "user_onboarding_responses_did_community_did_field_id_pk", 2113 + "columns": ["did", "community_did", "field_id"] 2114 + } 2115 + }, 2116 + "uniqueConstraints": {}, 2117 + "policies": {}, 2118 + "checkConstraints": {}, 2119 + "isRLSEnabled": false 2120 + }, 2121 + "public.moderation_queue": { 2122 + "name": "moderation_queue", 2123 + "schema": "", 2124 + "columns": { 2125 + "id": { 2126 + "name": "id", 2127 + "type": "serial", 2128 + "primaryKey": true, 2129 + "notNull": true 2130 + }, 2131 + "content_uri": { 2132 + "name": "content_uri", 2133 + "type": "text", 2134 + "primaryKey": false, 2135 + "notNull": true 2136 + }, 2137 + "content_type": { 2138 + "name": "content_type", 2139 + "type": "text", 2140 + "primaryKey": false, 2141 + "notNull": true 2142 + }, 2143 + "author_did": { 2144 + "name": "author_did", 2145 + "type": "text", 2146 + "primaryKey": false, 2147 + "notNull": true 2148 + }, 2149 + "community_did": { 2150 + "name": "community_did", 2151 + "type": "text", 2152 + "primaryKey": false, 2153 + "notNull": true 2154 + }, 2155 + "queue_reason": { 2156 + "name": "queue_reason", 2157 + "type": "text", 2158 + "primaryKey": false, 2159 + "notNull": true 2160 + }, 2161 + "matched_words": { 2162 + "name": "matched_words", 2163 + "type": "jsonb", 2164 + "primaryKey": false, 2165 + "notNull": false 2166 + }, 2167 + "status": { 2168 + "name": "status", 2169 + "type": "text", 2170 + "primaryKey": false, 2171 + "notNull": true, 2172 + "default": "'pending'" 2173 + }, 2174 + "reviewed_by": { 2175 + "name": "reviewed_by", 2176 + "type": "text", 2177 + "primaryKey": false, 2178 + "notNull": false 2179 + }, 2180 + "created_at": { 2181 + "name": "created_at", 2182 + "type": "timestamp with time zone", 2183 + "primaryKey": false, 2184 + "notNull": true, 2185 + "default": "now()" 2186 + }, 2187 + "reviewed_at": { 2188 + "name": "reviewed_at", 2189 + "type": "timestamp with time zone", 2190 + "primaryKey": false, 2191 + "notNull": false 2192 + } 2193 + }, 2194 + "indexes": { 2195 + "mod_queue_author_did_idx": { 2196 + "name": "mod_queue_author_did_idx", 2197 + "columns": [ 2198 + { 2199 + "expression": "author_did", 2200 + "isExpression": false, 2201 + "asc": true, 2202 + "nulls": "last" 2203 + } 2204 + ], 2205 + "isUnique": false, 2206 + "concurrently": false, 2207 + "method": "btree", 2208 + "with": {} 2209 + }, 2210 + "mod_queue_community_did_idx": { 2211 + "name": "mod_queue_community_did_idx", 2212 + "columns": [ 2213 + { 2214 + "expression": "community_did", 2215 + "isExpression": false, 2216 + "asc": true, 2217 + "nulls": "last" 2218 + } 2219 + ], 2220 + "isUnique": false, 2221 + "concurrently": false, 2222 + "method": "btree", 2223 + "with": {} 2224 + }, 2225 + "mod_queue_status_idx": { 2226 + "name": "mod_queue_status_idx", 2227 + "columns": [ 2228 + { 2229 + "expression": "status", 2230 + "isExpression": false, 2231 + "asc": true, 2232 + "nulls": "last" 2233 + } 2234 + ], 2235 + "isUnique": false, 2236 + "concurrently": false, 2237 + "method": "btree", 2238 + "with": {} 2239 + }, 2240 + "mod_queue_created_at_idx": { 2241 + "name": "mod_queue_created_at_idx", 2242 + "columns": [ 2243 + { 2244 + "expression": "created_at", 2245 + "isExpression": false, 2246 + "asc": true, 2247 + "nulls": "last" 2248 + } 2249 + ], 2250 + "isUnique": false, 2251 + "concurrently": false, 2252 + "method": "btree", 2253 + "with": {} 2254 + }, 2255 + "mod_queue_content_uri_idx": { 2256 + "name": "mod_queue_content_uri_idx", 2257 + "columns": [ 2258 + { 2259 + "expression": "content_uri", 2260 + "isExpression": false, 2261 + "asc": true, 2262 + "nulls": "last" 2263 + } 2264 + ], 2265 + "isUnique": false, 2266 + "concurrently": false, 2267 + "method": "btree", 2268 + "with": {} 2269 + } 2270 + }, 2271 + "foreignKeys": {}, 2272 + "compositePrimaryKeys": {}, 2273 + "uniqueConstraints": {}, 2274 + "policies": {}, 2275 + "checkConstraints": {}, 2276 + "isRLSEnabled": false 2277 + }, 2278 + "public.account_trust": { 2279 + "name": "account_trust", 2280 + "schema": "", 2281 + "columns": { 2282 + "id": { 2283 + "name": "id", 2284 + "type": "serial", 2285 + "primaryKey": true, 2286 + "notNull": true 2287 + }, 2288 + "did": { 2289 + "name": "did", 2290 + "type": "text", 2291 + "primaryKey": false, 2292 + "notNull": true 2293 + }, 2294 + "community_did": { 2295 + "name": "community_did", 2296 + "type": "text", 2297 + "primaryKey": false, 2298 + "notNull": true 2299 + }, 2300 + "approved_post_count": { 2301 + "name": "approved_post_count", 2302 + "type": "integer", 2303 + "primaryKey": false, 2304 + "notNull": true, 2305 + "default": 0 2306 + }, 2307 + "is_trusted": { 2308 + "name": "is_trusted", 2309 + "type": "boolean", 2310 + "primaryKey": false, 2311 + "notNull": true, 2312 + "default": false 2313 + }, 2314 + "trusted_at": { 2315 + "name": "trusted_at", 2316 + "type": "timestamp with time zone", 2317 + "primaryKey": false, 2318 + "notNull": false 2319 + } 2320 + }, 2321 + "indexes": { 2322 + "account_trust_did_community_idx": { 2323 + "name": "account_trust_did_community_idx", 2324 + "columns": [ 2325 + { 2326 + "expression": "did", 2327 + "isExpression": false, 2328 + "asc": true, 2329 + "nulls": "last" 2330 + }, 2331 + { 2332 + "expression": "community_did", 2333 + "isExpression": false, 2334 + "asc": true, 2335 + "nulls": "last" 2336 + } 2337 + ], 2338 + "isUnique": true, 2339 + "concurrently": false, 2340 + "method": "btree", 2341 + "with": {} 2342 + }, 2343 + "account_trust_did_idx": { 2344 + "name": "account_trust_did_idx", 2345 + "columns": [ 2346 + { 2347 + "expression": "did", 2348 + "isExpression": false, 2349 + "asc": true, 2350 + "nulls": "last" 2351 + } 2352 + ], 2353 + "isUnique": false, 2354 + "concurrently": false, 2355 + "method": "btree", 2356 + "with": {} 2357 + } 2358 + }, 2359 + "foreignKeys": {}, 2360 + "compositePrimaryKeys": {}, 2361 + "uniqueConstraints": {}, 2362 + "policies": {}, 2363 + "checkConstraints": {}, 2364 + "isRLSEnabled": false 2365 + }, 2366 + "public.community_filters": { 2367 + "name": "community_filters", 2368 + "schema": "", 2369 + "columns": { 2370 + "community_did": { 2371 + "name": "community_did", 2372 + "type": "text", 2373 + "primaryKey": true, 2374 + "notNull": true 2375 + }, 2376 + "status": { 2377 + "name": "status", 2378 + "type": "text", 2379 + "primaryKey": false, 2380 + "notNull": true, 2381 + "default": "'active'" 2382 + }, 2383 + "admin_did": { 2384 + "name": "admin_did", 2385 + "type": "text", 2386 + "primaryKey": false, 2387 + "notNull": false 2388 + }, 2389 + "reason": { 2390 + "name": "reason", 2391 + "type": "text", 2392 + "primaryKey": false, 2393 + "notNull": false 2394 + }, 2395 + "report_count": { 2396 + "name": "report_count", 2397 + "type": "integer", 2398 + "primaryKey": false, 2399 + "notNull": true, 2400 + "default": 0 2401 + }, 2402 + "last_reviewed_at": { 2403 + "name": "last_reviewed_at", 2404 + "type": "timestamp with time zone", 2405 + "primaryKey": false, 2406 + "notNull": false 2407 + }, 2408 + "filtered_by": { 2409 + "name": "filtered_by", 2410 + "type": "text", 2411 + "primaryKey": false, 2412 + "notNull": false 2413 + }, 2414 + "created_at": { 2415 + "name": "created_at", 2416 + "type": "timestamp with time zone", 2417 + "primaryKey": false, 2418 + "notNull": true, 2419 + "default": "now()" 2420 + }, 2421 + "updated_at": { 2422 + "name": "updated_at", 2423 + "type": "timestamp with time zone", 2424 + "primaryKey": false, 2425 + "notNull": true, 2426 + "default": "now()" 2427 + } 2428 + }, 2429 + "indexes": { 2430 + "community_filters_status_idx": { 2431 + "name": "community_filters_status_idx", 2432 + "columns": [ 2433 + { 2434 + "expression": "status", 2435 + "isExpression": false, 2436 + "asc": true, 2437 + "nulls": "last" 2438 + } 2439 + ], 2440 + "isUnique": false, 2441 + "concurrently": false, 2442 + "method": "btree", 2443 + "with": {} 2444 + }, 2445 + "community_filters_admin_did_idx": { 2446 + "name": "community_filters_admin_did_idx", 2447 + "columns": [ 2448 + { 2449 + "expression": "admin_did", 2450 + "isExpression": false, 2451 + "asc": true, 2452 + "nulls": "last" 2453 + } 2454 + ], 2455 + "isUnique": false, 2456 + "concurrently": false, 2457 + "method": "btree", 2458 + "with": {} 2459 + }, 2460 + "community_filters_updated_at_idx": { 2461 + "name": "community_filters_updated_at_idx", 2462 + "columns": [ 2463 + { 2464 + "expression": "updated_at", 2465 + "isExpression": false, 2466 + "asc": true, 2467 + "nulls": "last" 2468 + } 2469 + ], 2470 + "isUnique": false, 2471 + "concurrently": false, 2472 + "method": "btree", 2473 + "with": {} 2474 + } 2475 + }, 2476 + "foreignKeys": {}, 2477 + "compositePrimaryKeys": {}, 2478 + "uniqueConstraints": {}, 2479 + "policies": {}, 2480 + "checkConstraints": {}, 2481 + "isRLSEnabled": false 2482 + }, 2483 + "public.account_filters": { 2484 + "name": "account_filters", 2485 + "schema": "", 2486 + "columns": { 2487 + "id": { 2488 + "name": "id", 2489 + "type": "serial", 2490 + "primaryKey": true, 2491 + "notNull": true 2492 + }, 2493 + "did": { 2494 + "name": "did", 2495 + "type": "text", 2496 + "primaryKey": false, 2497 + "notNull": true 2498 + }, 2499 + "community_did": { 2500 + "name": "community_did", 2501 + "type": "text", 2502 + "primaryKey": false, 2503 + "notNull": true 2504 + }, 2505 + "status": { 2506 + "name": "status", 2507 + "type": "text", 2508 + "primaryKey": false, 2509 + "notNull": true, 2510 + "default": "'active'" 2511 + }, 2512 + "reason": { 2513 + "name": "reason", 2514 + "type": "text", 2515 + "primaryKey": false, 2516 + "notNull": false 2517 + }, 2518 + "report_count": { 2519 + "name": "report_count", 2520 + "type": "integer", 2521 + "primaryKey": false, 2522 + "notNull": true, 2523 + "default": 0 2524 + }, 2525 + "ban_count": { 2526 + "name": "ban_count", 2527 + "type": "integer", 2528 + "primaryKey": false, 2529 + "notNull": true, 2530 + "default": 0 2531 + }, 2532 + "last_reviewed_at": { 2533 + "name": "last_reviewed_at", 2534 + "type": "timestamp with time zone", 2535 + "primaryKey": false, 2536 + "notNull": false 2537 + }, 2538 + "filtered_by": { 2539 + "name": "filtered_by", 2540 + "type": "text", 2541 + "primaryKey": false, 2542 + "notNull": false 2543 + }, 2544 + "created_at": { 2545 + "name": "created_at", 2546 + "type": "timestamp with time zone", 2547 + "primaryKey": false, 2548 + "notNull": true, 2549 + "default": "now()" 2550 + }, 2551 + "updated_at": { 2552 + "name": "updated_at", 2553 + "type": "timestamp with time zone", 2554 + "primaryKey": false, 2555 + "notNull": true, 2556 + "default": "now()" 2557 + } 2558 + }, 2559 + "indexes": { 2560 + "account_filters_did_community_idx": { 2561 + "name": "account_filters_did_community_idx", 2562 + "columns": [ 2563 + { 2564 + "expression": "did", 2565 + "isExpression": false, 2566 + "asc": true, 2567 + "nulls": "last" 2568 + }, 2569 + { 2570 + "expression": "community_did", 2571 + "isExpression": false, 2572 + "asc": true, 2573 + "nulls": "last" 2574 + } 2575 + ], 2576 + "isUnique": true, 2577 + "concurrently": false, 2578 + "method": "btree", 2579 + "with": {} 2580 + }, 2581 + "account_filters_did_idx": { 2582 + "name": "account_filters_did_idx", 2583 + "columns": [ 2584 + { 2585 + "expression": "did", 2586 + "isExpression": false, 2587 + "asc": true, 2588 + "nulls": "last" 2589 + } 2590 + ], 2591 + "isUnique": false, 2592 + "concurrently": false, 2593 + "method": "btree", 2594 + "with": {} 2595 + }, 2596 + "account_filters_community_did_idx": { 2597 + "name": "account_filters_community_did_idx", 2598 + "columns": [ 2599 + { 2600 + "expression": "community_did", 2601 + "isExpression": false, 2602 + "asc": true, 2603 + "nulls": "last" 2604 + } 2605 + ], 2606 + "isUnique": false, 2607 + "concurrently": false, 2608 + "method": "btree", 2609 + "with": {} 2610 + }, 2611 + "account_filters_status_idx": { 2612 + "name": "account_filters_status_idx", 2613 + "columns": [ 2614 + { 2615 + "expression": "status", 2616 + "isExpression": false, 2617 + "asc": true, 2618 + "nulls": "last" 2619 + } 2620 + ], 2621 + "isUnique": false, 2622 + "concurrently": false, 2623 + "method": "btree", 2624 + "with": {} 2625 + }, 2626 + "account_filters_updated_at_idx": { 2627 + "name": "account_filters_updated_at_idx", 2628 + "columns": [ 2629 + { 2630 + "expression": "updated_at", 2631 + "isExpression": false, 2632 + "asc": true, 2633 + "nulls": "last" 2634 + } 2635 + ], 2636 + "isUnique": false, 2637 + "concurrently": false, 2638 + "method": "btree", 2639 + "with": {} 2640 + } 2641 + }, 2642 + "foreignKeys": {}, 2643 + "compositePrimaryKeys": {}, 2644 + "uniqueConstraints": {}, 2645 + "policies": {}, 2646 + "checkConstraints": {}, 2647 + "isRLSEnabled": false 2648 + }, 2649 + "public.ozone_labels": { 2650 + "name": "ozone_labels", 2651 + "schema": "", 2652 + "columns": { 2653 + "id": { 2654 + "name": "id", 2655 + "type": "serial", 2656 + "primaryKey": true, 2657 + "notNull": true 2658 + }, 2659 + "src": { 2660 + "name": "src", 2661 + "type": "text", 2662 + "primaryKey": false, 2663 + "notNull": true 2664 + }, 2665 + "uri": { 2666 + "name": "uri", 2667 + "type": "text", 2668 + "primaryKey": false, 2669 + "notNull": true 2670 + }, 2671 + "val": { 2672 + "name": "val", 2673 + "type": "text", 2674 + "primaryKey": false, 2675 + "notNull": true 2676 + }, 2677 + "neg": { 2678 + "name": "neg", 2679 + "type": "boolean", 2680 + "primaryKey": false, 2681 + "notNull": true, 2682 + "default": false 2683 + }, 2684 + "cts": { 2685 + "name": "cts", 2686 + "type": "timestamp with time zone", 2687 + "primaryKey": false, 2688 + "notNull": true 2689 + }, 2690 + "exp": { 2691 + "name": "exp", 2692 + "type": "timestamp with time zone", 2693 + "primaryKey": false, 2694 + "notNull": false 2695 + }, 2696 + "indexed_at": { 2697 + "name": "indexed_at", 2698 + "type": "timestamp with time zone", 2699 + "primaryKey": false, 2700 + "notNull": true, 2701 + "default": "now()" 2702 + } 2703 + }, 2704 + "indexes": { 2705 + "ozone_labels_src_uri_val_idx": { 2706 + "name": "ozone_labels_src_uri_val_idx", 2707 + "columns": [ 2708 + { 2709 + "expression": "src", 2710 + "isExpression": false, 2711 + "asc": true, 2712 + "nulls": "last" 2713 + }, 2714 + { 2715 + "expression": "uri", 2716 + "isExpression": false, 2717 + "asc": true, 2718 + "nulls": "last" 2719 + }, 2720 + { 2721 + "expression": "val", 2722 + "isExpression": false, 2723 + "asc": true, 2724 + "nulls": "last" 2725 + } 2726 + ], 2727 + "isUnique": true, 2728 + "concurrently": false, 2729 + "method": "btree", 2730 + "with": {} 2731 + }, 2732 + "ozone_labels_uri_idx": { 2733 + "name": "ozone_labels_uri_idx", 2734 + "columns": [ 2735 + { 2736 + "expression": "uri", 2737 + "isExpression": false, 2738 + "asc": true, 2739 + "nulls": "last" 2740 + } 2741 + ], 2742 + "isUnique": false, 2743 + "concurrently": false, 2744 + "method": "btree", 2745 + "with": {} 2746 + }, 2747 + "ozone_labels_val_idx": { 2748 + "name": "ozone_labels_val_idx", 2749 + "columns": [ 2750 + { 2751 + "expression": "val", 2752 + "isExpression": false, 2753 + "asc": true, 2754 + "nulls": "last" 2755 + } 2756 + ], 2757 + "isUnique": false, 2758 + "concurrently": false, 2759 + "method": "btree", 2760 + "with": {} 2761 + }, 2762 + "ozone_labels_indexed_at_idx": { 2763 + "name": "ozone_labels_indexed_at_idx", 2764 + "columns": [ 2765 + { 2766 + "expression": "indexed_at", 2767 + "isExpression": false, 2768 + "asc": true, 2769 + "nulls": "last" 2770 + } 2771 + ], 2772 + "isUnique": false, 2773 + "concurrently": false, 2774 + "method": "btree", 2775 + "with": {} 2776 + } 2777 + }, 2778 + "foreignKeys": {}, 2779 + "compositePrimaryKeys": {}, 2780 + "uniqueConstraints": {}, 2781 + "policies": {}, 2782 + "checkConstraints": {}, 2783 + "isRLSEnabled": false 2784 + }, 2785 + "public.community_profiles": { 2786 + "name": "community_profiles", 2787 + "schema": "", 2788 + "columns": { 2789 + "did": { 2790 + "name": "did", 2791 + "type": "text", 2792 + "primaryKey": false, 2793 + "notNull": true 2794 + }, 2795 + "community_did": { 2796 + "name": "community_did", 2797 + "type": "text", 2798 + "primaryKey": false, 2799 + "notNull": true 2800 + }, 2801 + "display_name": { 2802 + "name": "display_name", 2803 + "type": "text", 2804 + "primaryKey": false, 2805 + "notNull": false 2806 + }, 2807 + "avatar_url": { 2808 + "name": "avatar_url", 2809 + "type": "text", 2810 + "primaryKey": false, 2811 + "notNull": false 2812 + }, 2813 + "banner_url": { 2814 + "name": "banner_url", 2815 + "type": "text", 2816 + "primaryKey": false, 2817 + "notNull": false 2818 + }, 2819 + "bio": { 2820 + "name": "bio", 2821 + "type": "text", 2822 + "primaryKey": false, 2823 + "notNull": false 2824 + }, 2825 + "updated_at": { 2826 + "name": "updated_at", 2827 + "type": "timestamp with time zone", 2828 + "primaryKey": false, 2829 + "notNull": true, 2830 + "default": "now()" 2831 + } 2832 + }, 2833 + "indexes": { 2834 + "community_profiles_did_idx": { 2835 + "name": "community_profiles_did_idx", 2836 + "columns": [ 2837 + { 2838 + "expression": "did", 2839 + "isExpression": false, 2840 + "asc": true, 2841 + "nulls": "last" 2842 + } 2843 + ], 2844 + "isUnique": false, 2845 + "concurrently": false, 2846 + "method": "btree", 2847 + "with": {} 2848 + }, 2849 + "community_profiles_community_idx": { 2850 + "name": "community_profiles_community_idx", 2851 + "columns": [ 2852 + { 2853 + "expression": "community_did", 2854 + "isExpression": false, 2855 + "asc": true, 2856 + "nulls": "last" 2857 + } 2858 + ], 2859 + "isUnique": false, 2860 + "concurrently": false, 2861 + "method": "btree", 2862 + "with": {} 2863 + } 2864 + }, 2865 + "foreignKeys": {}, 2866 + "compositePrimaryKeys": { 2867 + "community_profiles_did_community_did_pk": { 2868 + "name": "community_profiles_did_community_did_pk", 2869 + "columns": ["did", "community_did"] 2870 + } 2871 + }, 2872 + "uniqueConstraints": {}, 2873 + "policies": {}, 2874 + "checkConstraints": {}, 2875 + "isRLSEnabled": false 2876 + }, 2877 + "public.interaction_graph": { 2878 + "name": "interaction_graph", 2879 + "schema": "", 2880 + "columns": { 2881 + "source_did": { 2882 + "name": "source_did", 2883 + "type": "text", 2884 + "primaryKey": false, 2885 + "notNull": true 2886 + }, 2887 + "target_did": { 2888 + "name": "target_did", 2889 + "type": "text", 2890 + "primaryKey": false, 2891 + "notNull": true 2892 + }, 2893 + "community_id": { 2894 + "name": "community_id", 2895 + "type": "text", 2896 + "primaryKey": false, 2897 + "notNull": true 2898 + }, 2899 + "interaction_type": { 2900 + "name": "interaction_type", 2901 + "type": "text", 2902 + "primaryKey": false, 2903 + "notNull": true 2904 + }, 2905 + "weight": { 2906 + "name": "weight", 2907 + "type": "integer", 2908 + "primaryKey": false, 2909 + "notNull": true, 2910 + "default": 1 2911 + }, 2912 + "first_interaction_at": { 2913 + "name": "first_interaction_at", 2914 + "type": "timestamp with time zone", 2915 + "primaryKey": false, 2916 + "notNull": true, 2917 + "default": "now()" 2918 + }, 2919 + "last_interaction_at": { 2920 + "name": "last_interaction_at", 2921 + "type": "timestamp with time zone", 2922 + "primaryKey": false, 2923 + "notNull": true, 2924 + "default": "now()" 2925 + } 2926 + }, 2927 + "indexes": { 2928 + "interaction_graph_source_target_community_idx": { 2929 + "name": "interaction_graph_source_target_community_idx", 2930 + "columns": [ 2931 + { 2932 + "expression": "source_did", 2933 + "isExpression": false, 2934 + "asc": true, 2935 + "nulls": "last" 2936 + }, 2937 + { 2938 + "expression": "target_did", 2939 + "isExpression": false, 2940 + "asc": true, 2941 + "nulls": "last" 2942 + }, 2943 + { 2944 + "expression": "community_id", 2945 + "isExpression": false, 2946 + "asc": true, 2947 + "nulls": "last" 2948 + } 2949 + ], 2950 + "isUnique": false, 2951 + "concurrently": false, 2952 + "method": "btree", 2953 + "with": {} 2954 + } 2955 + }, 2956 + "foreignKeys": {}, 2957 + "compositePrimaryKeys": { 2958 + "interaction_graph_source_did_target_did_community_id_interaction_type_pk": { 2959 + "name": "interaction_graph_source_did_target_did_community_id_interaction_type_pk", 2960 + "columns": ["source_did", "target_did", "community_id", "interaction_type"] 2961 + } 2962 + }, 2963 + "uniqueConstraints": {}, 2964 + "policies": {}, 2965 + "checkConstraints": {}, 2966 + "isRLSEnabled": false 2967 + }, 2968 + "public.trust_seeds": { 2969 + "name": "trust_seeds", 2970 + "schema": "", 2971 + "columns": { 2972 + "id": { 2973 + "name": "id", 2974 + "type": "serial", 2975 + "primaryKey": true, 2976 + "notNull": true 2977 + }, 2978 + "did": { 2979 + "name": "did", 2980 + "type": "text", 2981 + "primaryKey": false, 2982 + "notNull": true 2983 + }, 2984 + "community_id": { 2985 + "name": "community_id", 2986 + "type": "text", 2987 + "primaryKey": false, 2988 + "notNull": true, 2989 + "default": "''" 2990 + }, 2991 + "added_by": { 2992 + "name": "added_by", 2993 + "type": "text", 2994 + "primaryKey": false, 2995 + "notNull": true 2996 + }, 2997 + "reason": { 2998 + "name": "reason", 2999 + "type": "text", 3000 + "primaryKey": false, 3001 + "notNull": false 3002 + }, 3003 + "created_at": { 3004 + "name": "created_at", 3005 + "type": "timestamp with time zone", 3006 + "primaryKey": false, 3007 + "notNull": true, 3008 + "default": "now()" 3009 + } 3010 + }, 3011 + "indexes": { 3012 + "trust_seeds_did_community_idx": { 3013 + "name": "trust_seeds_did_community_idx", 3014 + "columns": [ 3015 + { 3016 + "expression": "did", 3017 + "isExpression": false, 3018 + "asc": true, 3019 + "nulls": "last" 3020 + }, 3021 + { 3022 + "expression": "community_id", 3023 + "isExpression": false, 3024 + "asc": true, 3025 + "nulls": "last" 3026 + } 3027 + ], 3028 + "isUnique": true, 3029 + "concurrently": false, 3030 + "method": "btree", 3031 + "with": {} 3032 + } 3033 + }, 3034 + "foreignKeys": {}, 3035 + "compositePrimaryKeys": {}, 3036 + "uniqueConstraints": {}, 3037 + "policies": {}, 3038 + "checkConstraints": {}, 3039 + "isRLSEnabled": false 3040 + }, 3041 + "public.trust_scores": { 3042 + "name": "trust_scores", 3043 + "schema": "", 3044 + "columns": { 3045 + "did": { 3046 + "name": "did", 3047 + "type": "text", 3048 + "primaryKey": false, 3049 + "notNull": true 3050 + }, 3051 + "community_id": { 3052 + "name": "community_id", 3053 + "type": "text", 3054 + "primaryKey": false, 3055 + "notNull": true, 3056 + "default": "''" 3057 + }, 3058 + "score": { 3059 + "name": "score", 3060 + "type": "real", 3061 + "primaryKey": false, 3062 + "notNull": true 3063 + }, 3064 + "computed_at": { 3065 + "name": "computed_at", 3066 + "type": "timestamp with time zone", 3067 + "primaryKey": false, 3068 + "notNull": true, 3069 + "default": "now()" 3070 + } 3071 + }, 3072 + "indexes": { 3073 + "trust_scores_did_community_idx": { 3074 + "name": "trust_scores_did_community_idx", 3075 + "columns": [ 3076 + { 3077 + "expression": "did", 3078 + "isExpression": false, 3079 + "asc": true, 3080 + "nulls": "last" 3081 + }, 3082 + { 3083 + "expression": "community_id", 3084 + "isExpression": false, 3085 + "asc": true, 3086 + "nulls": "last" 3087 + } 3088 + ], 3089 + "isUnique": false, 3090 + "concurrently": false, 3091 + "method": "btree", 3092 + "with": {} 3093 + } 3094 + }, 3095 + "foreignKeys": {}, 3096 + "compositePrimaryKeys": { 3097 + "trust_scores_did_community_id_pk": { 3098 + "name": "trust_scores_did_community_id_pk", 3099 + "columns": ["did", "community_id"] 3100 + } 3101 + }, 3102 + "uniqueConstraints": {}, 3103 + "policies": {}, 3104 + "checkConstraints": {}, 3105 + "isRLSEnabled": false 3106 + }, 3107 + "public.sybil_clusters": { 3108 + "name": "sybil_clusters", 3109 + "schema": "", 3110 + "columns": { 3111 + "id": { 3112 + "name": "id", 3113 + "type": "serial", 3114 + "primaryKey": true, 3115 + "notNull": true 3116 + }, 3117 + "cluster_hash": { 3118 + "name": "cluster_hash", 3119 + "type": "text", 3120 + "primaryKey": false, 3121 + "notNull": true 3122 + }, 3123 + "internal_edge_count": { 3124 + "name": "internal_edge_count", 3125 + "type": "integer", 3126 + "primaryKey": false, 3127 + "notNull": true 3128 + }, 3129 + "external_edge_count": { 3130 + "name": "external_edge_count", 3131 + "type": "integer", 3132 + "primaryKey": false, 3133 + "notNull": true 3134 + }, 3135 + "member_count": { 3136 + "name": "member_count", 3137 + "type": "integer", 3138 + "primaryKey": false, 3139 + "notNull": true 3140 + }, 3141 + "status": { 3142 + "name": "status", 3143 + "type": "text", 3144 + "primaryKey": false, 3145 + "notNull": true, 3146 + "default": "'flagged'" 3147 + }, 3148 + "reviewed_by": { 3149 + "name": "reviewed_by", 3150 + "type": "text", 3151 + "primaryKey": false, 3152 + "notNull": false 3153 + }, 3154 + "reviewed_at": { 3155 + "name": "reviewed_at", 3156 + "type": "timestamp with time zone", 3157 + "primaryKey": false, 3158 + "notNull": false 3159 + }, 3160 + "detected_at": { 3161 + "name": "detected_at", 3162 + "type": "timestamp with time zone", 3163 + "primaryKey": false, 3164 + "notNull": true, 3165 + "default": "now()" 3166 + }, 3167 + "updated_at": { 3168 + "name": "updated_at", 3169 + "type": "timestamp with time zone", 3170 + "primaryKey": false, 3171 + "notNull": true, 3172 + "default": "now()" 3173 + } 3174 + }, 3175 + "indexes": { 3176 + "sybil_clusters_hash_idx": { 3177 + "name": "sybil_clusters_hash_idx", 3178 + "columns": [ 3179 + { 3180 + "expression": "cluster_hash", 3181 + "isExpression": false, 3182 + "asc": true, 3183 + "nulls": "last" 3184 + } 3185 + ], 3186 + "isUnique": true, 3187 + "concurrently": false, 3188 + "method": "btree", 3189 + "with": {} 3190 + } 3191 + }, 3192 + "foreignKeys": {}, 3193 + "compositePrimaryKeys": {}, 3194 + "uniqueConstraints": {}, 3195 + "policies": {}, 3196 + "checkConstraints": {}, 3197 + "isRLSEnabled": false 3198 + }, 3199 + "public.sybil_cluster_members": { 3200 + "name": "sybil_cluster_members", 3201 + "schema": "", 3202 + "columns": { 3203 + "cluster_id": { 3204 + "name": "cluster_id", 3205 + "type": "integer", 3206 + "primaryKey": false, 3207 + "notNull": true 3208 + }, 3209 + "did": { 3210 + "name": "did", 3211 + "type": "text", 3212 + "primaryKey": false, 3213 + "notNull": true 3214 + }, 3215 + "role_in_cluster": { 3216 + "name": "role_in_cluster", 3217 + "type": "text", 3218 + "primaryKey": false, 3219 + "notNull": true 3220 + }, 3221 + "joined_at": { 3222 + "name": "joined_at", 3223 + "type": "timestamp with time zone", 3224 + "primaryKey": false, 3225 + "notNull": true, 3226 + "default": "now()" 3227 + } 3228 + }, 3229 + "indexes": {}, 3230 + "foreignKeys": { 3231 + "sybil_cluster_members_cluster_id_sybil_clusters_id_fk": { 3232 + "name": "sybil_cluster_members_cluster_id_sybil_clusters_id_fk", 3233 + "tableFrom": "sybil_cluster_members", 3234 + "tableTo": "sybil_clusters", 3235 + "columnsFrom": ["cluster_id"], 3236 + "columnsTo": ["id"], 3237 + "onDelete": "no action", 3238 + "onUpdate": "no action" 3239 + } 3240 + }, 3241 + "compositePrimaryKeys": { 3242 + "sybil_cluster_members_cluster_id_did_pk": { 3243 + "name": "sybil_cluster_members_cluster_id_did_pk", 3244 + "columns": ["cluster_id", "did"] 3245 + } 3246 + }, 3247 + "uniqueConstraints": {}, 3248 + "policies": {}, 3249 + "checkConstraints": {}, 3250 + "isRLSEnabled": false 3251 + }, 3252 + "public.behavioral_flags": { 3253 + "name": "behavioral_flags", 3254 + "schema": "", 3255 + "columns": { 3256 + "id": { 3257 + "name": "id", 3258 + "type": "serial", 3259 + "primaryKey": true, 3260 + "notNull": true 3261 + }, 3262 + "flag_type": { 3263 + "name": "flag_type", 3264 + "type": "text", 3265 + "primaryKey": false, 3266 + "notNull": true 3267 + }, 3268 + "affected_dids": { 3269 + "name": "affected_dids", 3270 + "type": "jsonb", 3271 + "primaryKey": false, 3272 + "notNull": true 3273 + }, 3274 + "details": { 3275 + "name": "details", 3276 + "type": "text", 3277 + "primaryKey": false, 3278 + "notNull": true 3279 + }, 3280 + "community_did": { 3281 + "name": "community_did", 3282 + "type": "text", 3283 + "primaryKey": false, 3284 + "notNull": false 3285 + }, 3286 + "status": { 3287 + "name": "status", 3288 + "type": "text", 3289 + "primaryKey": false, 3290 + "notNull": true, 3291 + "default": "'pending'" 3292 + }, 3293 + "detected_at": { 3294 + "name": "detected_at", 3295 + "type": "timestamp with time zone", 3296 + "primaryKey": false, 3297 + "notNull": true, 3298 + "default": "now()" 3299 + } 3300 + }, 3301 + "indexes": { 3302 + "behavioral_flags_flag_type_idx": { 3303 + "name": "behavioral_flags_flag_type_idx", 3304 + "columns": [ 3305 + { 3306 + "expression": "flag_type", 3307 + "isExpression": false, 3308 + "asc": true, 3309 + "nulls": "last" 3310 + } 3311 + ], 3312 + "isUnique": false, 3313 + "concurrently": false, 3314 + "method": "btree", 3315 + "with": {} 3316 + }, 3317 + "behavioral_flags_status_idx": { 3318 + "name": "behavioral_flags_status_idx", 3319 + "columns": [ 3320 + { 3321 + "expression": "status", 3322 + "isExpression": false, 3323 + "asc": true, 3324 + "nulls": "last" 3325 + } 3326 + ], 3327 + "isUnique": false, 3328 + "concurrently": false, 3329 + "method": "btree", 3330 + "with": {} 3331 + }, 3332 + "behavioral_flags_detected_at_idx": { 3333 + "name": "behavioral_flags_detected_at_idx", 3334 + "columns": [ 3335 + { 3336 + "expression": "detected_at", 3337 + "isExpression": false, 3338 + "asc": true, 3339 + "nulls": "last" 3340 + } 3341 + ], 3342 + "isUnique": false, 3343 + "concurrently": false, 3344 + "method": "btree", 3345 + "with": {} 3346 + } 3347 + }, 3348 + "foreignKeys": {}, 3349 + "compositePrimaryKeys": {}, 3350 + "uniqueConstraints": {}, 3351 + "policies": {}, 3352 + "checkConstraints": {}, 3353 + "isRLSEnabled": false 3354 + }, 3355 + "public.pds_trust_factors": { 3356 + "name": "pds_trust_factors", 3357 + "schema": "", 3358 + "columns": { 3359 + "id": { 3360 + "name": "id", 3361 + "type": "serial", 3362 + "primaryKey": true, 3363 + "notNull": true 3364 + }, 3365 + "pds_host": { 3366 + "name": "pds_host", 3367 + "type": "text", 3368 + "primaryKey": false, 3369 + "notNull": true 3370 + }, 3371 + "trust_factor": { 3372 + "name": "trust_factor", 3373 + "type": "real", 3374 + "primaryKey": false, 3375 + "notNull": true 3376 + }, 3377 + "is_default": { 3378 + "name": "is_default", 3379 + "type": "boolean", 3380 + "primaryKey": false, 3381 + "notNull": true, 3382 + "default": false 3383 + }, 3384 + "updated_at": { 3385 + "name": "updated_at", 3386 + "type": "timestamp with time zone", 3387 + "primaryKey": false, 3388 + "notNull": true, 3389 + "default": "now()" 3390 + } 3391 + }, 3392 + "indexes": { 3393 + "pds_trust_factors_pds_host_idx": { 3394 + "name": "pds_trust_factors_pds_host_idx", 3395 + "columns": [ 3396 + { 3397 + "expression": "pds_host", 3398 + "isExpression": false, 3399 + "asc": true, 3400 + "nulls": "last" 3401 + } 3402 + ], 3403 + "isUnique": true, 3404 + "concurrently": false, 3405 + "method": "btree", 3406 + "with": {} 3407 + } 3408 + }, 3409 + "foreignKeys": {}, 3410 + "compositePrimaryKeys": {}, 3411 + "uniqueConstraints": {}, 3412 + "policies": {}, 3413 + "checkConstraints": {}, 3414 + "isRLSEnabled": false 3415 + } 3416 + }, 3417 + "enums": {}, 3418 + "schemas": {}, 3419 + "sequences": {}, 3420 + "roles": {}, 3421 + "policies": {}, 3422 + "views": {}, 3423 + "_meta": { 3424 + "columns": {}, 3425 + "schemas": {}, 3426 + "tables": {} 3427 + } 3428 + }
+7
drizzle/meta/_journal.json
··· 190 190 "when": 1771459200001, 191 191 "tag": "0026_composite_indexes", 192 192 "breakpoints": true 193 + }, 194 + { 195 + "idx": 27, 196 + "version": "7", 197 + "when": 1771619013359, 198 + "tag": "0027_sad_spencer_smythe", 199 + "breakpoints": true 193 200 } 194 201 ] 195 202 }
+35 -24
src/db/schema/users.ts
··· 1 - import { pgTable, text, timestamp, boolean, integer } from 'drizzle-orm/pg-core' 1 + import { pgTable, text, timestamp, boolean, integer, index } from 'drizzle-orm/pg-core' 2 + import { sql } from 'drizzle-orm' 2 3 3 - export const users = pgTable('users', { 4 - did: text('did').primaryKey(), 5 - handle: text('handle').notNull(), 6 - displayName: text('display_name'), 7 - avatarUrl: text('avatar_url'), 8 - bannerUrl: text('banner_url'), 9 - bio: text('bio'), 10 - role: text('role', { enum: ['user', 'moderator', 'admin'] }) 11 - .notNull() 12 - .default('user'), 13 - isBanned: boolean('is_banned').notNull().default(false), 14 - reputationScore: integer('reputation_score').notNull().default(0), 15 - firstSeenAt: timestamp('first_seen_at', { withTimezone: true }).notNull().defaultNow(), 16 - lastActiveAt: timestamp('last_active_at', { withTimezone: true }).notNull().defaultNow(), 17 - declaredAge: integer('declared_age'), 18 - maturityPref: text('maturity_pref', { 19 - enum: ['safe', 'mature', 'adult'], 20 - }) 21 - .notNull() 22 - .default('safe'), 23 - /** Account creation date resolved from PLC directory on first encounter. */ 24 - accountCreatedAt: timestamp('account_created_at', { withTimezone: true }), 25 - }) 4 + export const users = pgTable( 5 + 'users', 6 + { 7 + did: text('did').primaryKey(), 8 + handle: text('handle').notNull(), 9 + displayName: text('display_name'), 10 + avatarUrl: text('avatar_url'), 11 + bannerUrl: text('banner_url'), 12 + bio: text('bio'), 13 + role: text('role', { enum: ['user', 'moderator', 'admin'] }) 14 + .notNull() 15 + .default('user'), 16 + isBanned: boolean('is_banned').notNull().default(false), 17 + reputationScore: integer('reputation_score').notNull().default(0), 18 + firstSeenAt: timestamp('first_seen_at', { withTimezone: true }).notNull().defaultNow(), 19 + lastActiveAt: timestamp('last_active_at', { withTimezone: true }).notNull().defaultNow(), 20 + declaredAge: integer('declared_age'), 21 + maturityPref: text('maturity_pref', { 22 + enum: ['safe', 'mature', 'adult'], 23 + }) 24 + .notNull() 25 + .default('safe'), 26 + /** Account creation date resolved from PLC directory on first encounter. */ 27 + accountCreatedAt: timestamp('account_created_at', { withTimezone: true }), 28 + }, 29 + (table) => [ 30 + index('users_role_elevated_idx') 31 + .on(table.role) 32 + .where(sql`role IN ('moderator', 'admin')`), 33 + index('users_handle_idx').on(table.handle), 34 + index('users_account_created_at_idx').on(table.accountCreatedAt), 35 + ] 36 + )