AT-based link agregator. Mirror of https://github.com/likeandscribe/frontpage

Remove default collection on post, comment, vote tables (#285)

authored by tom.sherman.is and committed by

GitHub 7cf203a0 a3f65322

+1240 -10
+33
packages/frontpage/drizzle/0009_soft_strong_guy.sql
··· 1 + DROP INDEX "admin_users_did_unique";--> statement-breakpoint 2 + DROP INDEX "beta_users_did_unique";--> statement-breakpoint 3 + DROP INDEX "comments_author_did_rkey_unique";--> statement-breakpoint 4 + DROP INDEX "comment_aggregates_comment_id_unique";--> statement-breakpoint 5 + DROP INDEX "comment_id_idx";--> statement-breakpoint 6 + DROP INDEX "comment_votes_author_did_rkey_unique";--> statement-breakpoint 7 + DROP INDEX "comment_votes_author_did_comment_id_unique";--> statement-breakpoint 8 + DROP INDEX "labelled_profiles_did_unique";--> statement-breakpoint 9 + DROP INDEX "oauth_auth_requests_state_unique";--> statement-breakpoint 10 + DROP INDEX "posts_author_did_rkey_unique";--> statement-breakpoint 11 + DROP INDEX "post_id_idx";--> statement-breakpoint 12 + DROP INDEX "rank_idx";--> statement-breakpoint 13 + DROP INDEX "post_aggregates_post_id_unique";--> statement-breakpoint 14 + DROP INDEX "post_votes_author_did_rkey_unique";--> statement-breakpoint 15 + DROP INDEX "post_votes_author_did_post_id_unique";--> statement-breakpoint 16 + 17 + ALTER TABLE `posts` ALTER COLUMN "collection" TO "collection" text NOT NULL;--> statement-breakpoint 18 + 19 + CREATE UNIQUE INDEX `admin_users_did_unique` ON `admin_users` (`did`);--> statement-breakpoint 20 + CREATE UNIQUE INDEX `beta_users_did_unique` ON `beta_users` (`did`);--> statement-breakpoint 21 + CREATE UNIQUE INDEX `comments_author_did_rkey_unique` ON `comments` (`author_did`,`rkey`);--> statement-breakpoint 22 + CREATE UNIQUE INDEX `comment_aggregates_comment_id_unique` ON `comment_aggregates` (`comment_id`);--> statement-breakpoint 23 + CREATE INDEX `comment_id_idx` ON `comment_aggregates` (`comment_id`);--> statement-breakpoint 24 + CREATE UNIQUE INDEX `comment_votes_author_did_rkey_unique` ON `comment_votes` (`author_did`,`rkey`);--> statement-breakpoint 25 + CREATE UNIQUE INDEX `comment_votes_author_did_comment_id_unique` ON `comment_votes` (`author_did`,`comment_id`);--> statement-breakpoint 26 + CREATE UNIQUE INDEX `labelled_profiles_did_unique` ON `labelled_profiles` (`did`);--> statement-breakpoint 27 + CREATE UNIQUE INDEX `oauth_auth_requests_state_unique` ON `oauth_auth_requests` (`state`);--> statement-breakpoint 28 + CREATE UNIQUE INDEX `posts_author_did_rkey_unique` ON `posts` (`author_did`,`rkey`);--> statement-breakpoint 29 + CREATE INDEX `post_id_idx` ON `post_aggregates` (`post_id`);--> statement-breakpoint 30 + CREATE INDEX `rank_idx` ON `post_aggregates` (`rank`);--> statement-breakpoint 31 + CREATE UNIQUE INDEX `post_aggregates_post_id_unique` ON `post_aggregates` (`post_id`);--> statement-breakpoint 32 + CREATE UNIQUE INDEX `post_votes_author_did_rkey_unique` ON `post_votes` (`author_did`,`rkey`);--> statement-breakpoint 33 + CREATE UNIQUE INDEX `post_votes_author_did_post_id_unique` ON `post_votes` (`author_did`,`post_id`);
+1190
packages/frontpage/drizzle/meta/0009_snapshot.json
··· 1 + { 2 + "version": "6", 3 + "dialect": "sqlite", 4 + "id": "eb0e43d9-ccd9-45e0-ad5a-f8ed4f77f8d4", 5 + "prevId": "71b3e466-99a8-4c31-9a67-fe76c76010db", 6 + "tables": { 7 + "admin_users": { 8 + "name": "admin_users", 9 + "columns": { 10 + "id": { 11 + "name": "id", 12 + "type": "integer", 13 + "primaryKey": true, 14 + "notNull": true, 15 + "autoincrement": false 16 + }, 17 + "created_at": { 18 + "name": "created_at", 19 + "type": "text", 20 + "primaryKey": false, 21 + "notNull": true, 22 + "autoincrement": false, 23 + "default": "(current_timestamp)" 24 + }, 25 + "did": { 26 + "name": "did", 27 + "type": "text", 28 + "primaryKey": false, 29 + "notNull": true, 30 + "autoincrement": false 31 + } 32 + }, 33 + "indexes": { 34 + "admin_users_did_unique": { 35 + "name": "admin_users_did_unique", 36 + "columns": [ 37 + "did" 38 + ], 39 + "isUnique": true 40 + } 41 + }, 42 + "foreignKeys": {}, 43 + "compositePrimaryKeys": {}, 44 + "uniqueConstraints": {}, 45 + "checkConstraints": {} 46 + }, 47 + "beta_users": { 48 + "name": "beta_users", 49 + "columns": { 50 + "id": { 51 + "name": "id", 52 + "type": "integer", 53 + "primaryKey": true, 54 + "notNull": true, 55 + "autoincrement": false 56 + }, 57 + "created_at": { 58 + "name": "created_at", 59 + "type": "text", 60 + "primaryKey": false, 61 + "notNull": true, 62 + "autoincrement": false 63 + }, 64 + "did": { 65 + "name": "did", 66 + "type": "text", 67 + "primaryKey": false, 68 + "notNull": true, 69 + "autoincrement": false 70 + } 71 + }, 72 + "indexes": { 73 + "beta_users_did_unique": { 74 + "name": "beta_users_did_unique", 75 + "columns": [ 76 + "did" 77 + ], 78 + "isUnique": true 79 + } 80 + }, 81 + "foreignKeys": {}, 82 + "compositePrimaryKeys": {}, 83 + "uniqueConstraints": {}, 84 + "checkConstraints": {} 85 + }, 86 + "comments": { 87 + "name": "comments", 88 + "columns": { 89 + "id": { 90 + "name": "id", 91 + "type": "integer", 92 + "primaryKey": true, 93 + "notNull": true, 94 + "autoincrement": false 95 + }, 96 + "rkey": { 97 + "name": "rkey", 98 + "type": "text", 99 + "primaryKey": false, 100 + "notNull": true, 101 + "autoincrement": false 102 + }, 103 + "cid": { 104 + "name": "cid", 105 + "type": "text", 106 + "primaryKey": false, 107 + "notNull": true, 108 + "autoincrement": false, 109 + "default": "''" 110 + }, 111 + "post_id": { 112 + "name": "post_id", 113 + "type": "integer", 114 + "primaryKey": false, 115 + "notNull": true, 116 + "autoincrement": false 117 + }, 118 + "body": { 119 + "name": "body", 120 + "type": "text(10000)", 121 + "primaryKey": false, 122 + "notNull": true, 123 + "autoincrement": false 124 + }, 125 + "created_at": { 126 + "name": "created_at", 127 + "type": "text", 128 + "primaryKey": false, 129 + "notNull": true, 130 + "autoincrement": false 131 + }, 132 + "author_did": { 133 + "name": "author_did", 134 + "type": "text", 135 + "primaryKey": false, 136 + "notNull": true, 137 + "autoincrement": false 138 + }, 139 + "status": { 140 + "name": "status", 141 + "type": "text", 142 + "primaryKey": false, 143 + "notNull": false, 144 + "autoincrement": false, 145 + "default": "'live'" 146 + }, 147 + "parent_comment_id": { 148 + "name": "parent_comment_id", 149 + "type": "integer", 150 + "primaryKey": false, 151 + "notNull": false, 152 + "autoincrement": false 153 + }, 154 + "collection": { 155 + "name": "collection", 156 + "type": "text", 157 + "primaryKey": false, 158 + "notNull": true, 159 + "autoincrement": false, 160 + "default": "'fyi.unravel.frontpage.comment'" 161 + } 162 + }, 163 + "indexes": { 164 + "comments_author_did_rkey_unique": { 165 + "name": "comments_author_did_rkey_unique", 166 + "columns": [ 167 + "author_did", 168 + "rkey" 169 + ], 170 + "isUnique": true 171 + } 172 + }, 173 + "foreignKeys": { 174 + "comments_post_id_posts_id_fk": { 175 + "name": "comments_post_id_posts_id_fk", 176 + "tableFrom": "comments", 177 + "tableTo": "posts", 178 + "columnsFrom": [ 179 + "post_id" 180 + ], 181 + "columnsTo": [ 182 + "id" 183 + ], 184 + "onDelete": "no action", 185 + "onUpdate": "no action" 186 + }, 187 + "parent_comment_id_fkey": { 188 + "name": "parent_comment_id_fkey", 189 + "tableFrom": "comments", 190 + "tableTo": "comments", 191 + "columnsFrom": [ 192 + "parent_comment_id" 193 + ], 194 + "columnsTo": [ 195 + "id" 196 + ], 197 + "onDelete": "no action", 198 + "onUpdate": "no action" 199 + } 200 + }, 201 + "compositePrimaryKeys": {}, 202 + "uniqueConstraints": {}, 203 + "checkConstraints": {} 204 + }, 205 + "comment_aggregates": { 206 + "name": "comment_aggregates", 207 + "columns": { 208 + "id": { 209 + "name": "id", 210 + "type": "integer", 211 + "primaryKey": true, 212 + "notNull": true, 213 + "autoincrement": false 214 + }, 215 + "comment_id": { 216 + "name": "comment_id", 217 + "type": "integer", 218 + "primaryKey": false, 219 + "notNull": true, 220 + "autoincrement": false 221 + }, 222 + "vote_count": { 223 + "name": "vote_count", 224 + "type": "integer", 225 + "primaryKey": false, 226 + "notNull": true, 227 + "autoincrement": false, 228 + "default": 0 229 + }, 230 + "rank": { 231 + "name": "rank", 232 + "type": "integer", 233 + "primaryKey": false, 234 + "notNull": true, 235 + "autoincrement": false, 236 + "default": "(CAST(1 AS REAL) / (pow(2,1.8)))" 237 + }, 238 + "created_at": { 239 + "name": "created_at", 240 + "type": "text", 241 + "primaryKey": false, 242 + "notNull": true, 243 + "autoincrement": false, 244 + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" 245 + } 246 + }, 247 + "indexes": { 248 + "comment_aggregates_comment_id_unique": { 249 + "name": "comment_aggregates_comment_id_unique", 250 + "columns": [ 251 + "comment_id" 252 + ], 253 + "isUnique": true 254 + }, 255 + "comment_id_idx": { 256 + "name": "comment_id_idx", 257 + "columns": [ 258 + "comment_id" 259 + ], 260 + "isUnique": false 261 + } 262 + }, 263 + "foreignKeys": { 264 + "comment_aggregates_comment_id_comments_id_fk": { 265 + "name": "comment_aggregates_comment_id_comments_id_fk", 266 + "tableFrom": "comment_aggregates", 267 + "tableTo": "comments", 268 + "columnsFrom": [ 269 + "comment_id" 270 + ], 271 + "columnsTo": [ 272 + "id" 273 + ], 274 + "onDelete": "no action", 275 + "onUpdate": "no action" 276 + } 277 + }, 278 + "compositePrimaryKeys": {}, 279 + "uniqueConstraints": {}, 280 + "checkConstraints": {} 281 + }, 282 + "comment_votes": { 283 + "name": "comment_votes", 284 + "columns": { 285 + "id": { 286 + "name": "id", 287 + "type": "integer", 288 + "primaryKey": true, 289 + "notNull": true, 290 + "autoincrement": false 291 + }, 292 + "comment_id": { 293 + "name": "comment_id", 294 + "type": "integer", 295 + "primaryKey": false, 296 + "notNull": true, 297 + "autoincrement": false 298 + }, 299 + "created_at": { 300 + "name": "created_at", 301 + "type": "text", 302 + "primaryKey": false, 303 + "notNull": true, 304 + "autoincrement": false 305 + }, 306 + "author_did": { 307 + "name": "author_did", 308 + "type": "text", 309 + "primaryKey": false, 310 + "notNull": true, 311 + "autoincrement": false 312 + }, 313 + "cid": { 314 + "name": "cid", 315 + "type": "text", 316 + "primaryKey": false, 317 + "notNull": true, 318 + "autoincrement": false, 319 + "default": "''" 320 + }, 321 + "rkey": { 322 + "name": "rkey", 323 + "type": "text", 324 + "primaryKey": false, 325 + "notNull": true, 326 + "autoincrement": false 327 + }, 328 + "status": { 329 + "name": "status", 330 + "type": "text", 331 + "primaryKey": false, 332 + "notNull": false, 333 + "autoincrement": false, 334 + "default": "'live'" 335 + }, 336 + "collection": { 337 + "name": "collection", 338 + "type": "text", 339 + "primaryKey": false, 340 + "notNull": true, 341 + "autoincrement": false, 342 + "default": "'fyi.unravel.frontpage.vote'" 343 + } 344 + }, 345 + "indexes": { 346 + "comment_votes_author_did_rkey_unique": { 347 + "name": "comment_votes_author_did_rkey_unique", 348 + "columns": [ 349 + "author_did", 350 + "rkey" 351 + ], 352 + "isUnique": true 353 + }, 354 + "comment_votes_author_did_comment_id_unique": { 355 + "name": "comment_votes_author_did_comment_id_unique", 356 + "columns": [ 357 + "author_did", 358 + "comment_id" 359 + ], 360 + "isUnique": true 361 + } 362 + }, 363 + "foreignKeys": { 364 + "comment_votes_comment_id_comments_id_fk": { 365 + "name": "comment_votes_comment_id_comments_id_fk", 366 + "tableFrom": "comment_votes", 367 + "tableTo": "comments", 368 + "columnsFrom": [ 369 + "comment_id" 370 + ], 371 + "columnsTo": [ 372 + "id" 373 + ], 374 + "onDelete": "no action", 375 + "onUpdate": "no action" 376 + } 377 + }, 378 + "compositePrimaryKeys": {}, 379 + "uniqueConstraints": {}, 380 + "checkConstraints": {} 381 + }, 382 + "consumed_offsets": { 383 + "name": "consumed_offsets", 384 + "columns": { 385 + "offset": { 386 + "name": "offset", 387 + "type": "integer", 388 + "primaryKey": true, 389 + "notNull": true, 390 + "autoincrement": false 391 + } 392 + }, 393 + "indexes": {}, 394 + "foreignKeys": {}, 395 + "compositePrimaryKeys": {}, 396 + "uniqueConstraints": {}, 397 + "checkConstraints": {} 398 + }, 399 + "labelled_profiles": { 400 + "name": "labelled_profiles", 401 + "columns": { 402 + "id": { 403 + "name": "id", 404 + "type": "integer", 405 + "primaryKey": true, 406 + "notNull": true, 407 + "autoincrement": false 408 + }, 409 + "did": { 410 + "name": "did", 411 + "type": "text", 412 + "primaryKey": false, 413 + "notNull": true, 414 + "autoincrement": false 415 + }, 416 + "is_hidden": { 417 + "name": "is_hidden", 418 + "type": "integer", 419 + "primaryKey": false, 420 + "notNull": true, 421 + "autoincrement": false, 422 + "default": false 423 + }, 424 + "labels": { 425 + "name": "labels", 426 + "type": "text", 427 + "primaryKey": false, 428 + "notNull": false, 429 + "autoincrement": false 430 + }, 431 + "created_at": { 432 + "name": "created_at", 433 + "type": "text", 434 + "primaryKey": false, 435 + "notNull": true, 436 + "autoincrement": false, 437 + "default": "(current_timestamp)" 438 + }, 439 + "updated_at": { 440 + "name": "updated_at", 441 + "type": "text", 442 + "primaryKey": false, 443 + "notNull": true, 444 + "autoincrement": false, 445 + "default": "(current_timestamp)" 446 + } 447 + }, 448 + "indexes": { 449 + "labelled_profiles_did_unique": { 450 + "name": "labelled_profiles_did_unique", 451 + "columns": [ 452 + "did" 453 + ], 454 + "isUnique": true 455 + } 456 + }, 457 + "foreignKeys": {}, 458 + "compositePrimaryKeys": {}, 459 + "uniqueConstraints": {}, 460 + "checkConstraints": {} 461 + }, 462 + "moderation_events": { 463 + "name": "moderation_events", 464 + "columns": { 465 + "id": { 466 + "name": "id", 467 + "type": "integer", 468 + "primaryKey": true, 469 + "notNull": true, 470 + "autoincrement": false 471 + }, 472 + "subject_uri": { 473 + "name": "subject_uri", 474 + "type": "text", 475 + "primaryKey": false, 476 + "notNull": true, 477 + "autoincrement": false 478 + }, 479 + "subject_did": { 480 + "name": "subject_did", 481 + "type": "text", 482 + "primaryKey": false, 483 + "notNull": true, 484 + "autoincrement": false 485 + }, 486 + "subject_collection": { 487 + "name": "subject_collection", 488 + "type": "text", 489 + "primaryKey": false, 490 + "notNull": false, 491 + "autoincrement": false 492 + }, 493 + "subject_rkey": { 494 + "name": "subject_rkey", 495 + "type": "text", 496 + "primaryKey": false, 497 + "notNull": false, 498 + "autoincrement": false 499 + }, 500 + "subject_cid": { 501 + "name": "subject_cid", 502 + "type": "text", 503 + "primaryKey": false, 504 + "notNull": false, 505 + "autoincrement": false 506 + }, 507 + "created_by": { 508 + "name": "created_by", 509 + "type": "text", 510 + "primaryKey": false, 511 + "notNull": true, 512 + "autoincrement": false 513 + }, 514 + "created_at": { 515 + "name": "created_at", 516 + "type": "text", 517 + "primaryKey": false, 518 + "notNull": true, 519 + "autoincrement": false, 520 + "default": "(current_timestamp)" 521 + }, 522 + "labels_added": { 523 + "name": "labels_added", 524 + "type": "text", 525 + "primaryKey": false, 526 + "notNull": false, 527 + "autoincrement": false 528 + }, 529 + "labels_removed": { 530 + "name": "labels_removed", 531 + "type": "text", 532 + "primaryKey": false, 533 + "notNull": false, 534 + "autoincrement": false 535 + }, 536 + "report_type": { 537 + "name": "report_type", 538 + "type": "text", 539 + "primaryKey": false, 540 + "notNull": false, 541 + "autoincrement": false 542 + } 543 + }, 544 + "indexes": {}, 545 + "foreignKeys": {}, 546 + "compositePrimaryKeys": {}, 547 + "uniqueConstraints": {}, 548 + "checkConstraints": {} 549 + }, 550 + "notifications": { 551 + "name": "notifications", 552 + "columns": { 553 + "id": { 554 + "name": "id", 555 + "type": "integer", 556 + "primaryKey": true, 557 + "notNull": true, 558 + "autoincrement": false 559 + }, 560 + "did": { 561 + "name": "did", 562 + "type": "text", 563 + "primaryKey": false, 564 + "notNull": true, 565 + "autoincrement": false 566 + }, 567 + "created_at": { 568 + "name": "created_at", 569 + "type": "text", 570 + "primaryKey": false, 571 + "notNull": true, 572 + "autoincrement": false, 573 + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" 574 + }, 575 + "read_at": { 576 + "name": "read_at", 577 + "type": "text", 578 + "primaryKey": false, 579 + "notNull": false, 580 + "autoincrement": false 581 + }, 582 + "reason": { 583 + "name": "reason", 584 + "type": "text", 585 + "primaryKey": false, 586 + "notNull": true, 587 + "autoincrement": false 588 + }, 589 + "comment_id": { 590 + "name": "comment_id", 591 + "type": "integer", 592 + "primaryKey": false, 593 + "notNull": false, 594 + "autoincrement": false 595 + } 596 + }, 597 + "indexes": {}, 598 + "foreignKeys": { 599 + "notifications_comment_id_comments_id_fk": { 600 + "name": "notifications_comment_id_comments_id_fk", 601 + "tableFrom": "notifications", 602 + "tableTo": "comments", 603 + "columnsFrom": [ 604 + "comment_id" 605 + ], 606 + "columnsTo": [ 607 + "id" 608 + ], 609 + "onDelete": "no action", 610 + "onUpdate": "no action" 611 + } 612 + }, 613 + "compositePrimaryKeys": {}, 614 + "uniqueConstraints": {}, 615 + "checkConstraints": {} 616 + }, 617 + "oauth_auth_requests": { 618 + "name": "oauth_auth_requests", 619 + "columns": { 620 + "state": { 621 + "name": "state", 622 + "type": "text", 623 + "primaryKey": false, 624 + "notNull": true, 625 + "autoincrement": false 626 + }, 627 + "iss": { 628 + "name": "iss", 629 + "type": "text", 630 + "primaryKey": false, 631 + "notNull": true, 632 + "autoincrement": false 633 + }, 634 + "did": { 635 + "name": "did", 636 + "type": "text", 637 + "primaryKey": false, 638 + "notNull": true, 639 + "autoincrement": false 640 + }, 641 + "username": { 642 + "name": "username", 643 + "type": "text", 644 + "primaryKey": false, 645 + "notNull": true, 646 + "autoincrement": false 647 + }, 648 + "nonce": { 649 + "name": "nonce", 650 + "type": "text", 651 + "primaryKey": false, 652 + "notNull": true, 653 + "autoincrement": false 654 + }, 655 + "pkce_verifier": { 656 + "name": "pkce_verifier", 657 + "type": "text", 658 + "primaryKey": false, 659 + "notNull": true, 660 + "autoincrement": false 661 + }, 662 + "dpop_private_jwk": { 663 + "name": "dpop_private_jwk", 664 + "type": "text", 665 + "primaryKey": false, 666 + "notNull": true, 667 + "autoincrement": false 668 + }, 669 + "dpop_public_jwk": { 670 + "name": "dpop_public_jwk", 671 + "type": "text", 672 + "primaryKey": false, 673 + "notNull": true, 674 + "autoincrement": false 675 + }, 676 + "expires_at": { 677 + "name": "expires_at", 678 + "type": "text", 679 + "primaryKey": false, 680 + "notNull": true, 681 + "autoincrement": false 682 + }, 683 + "created_at": { 684 + "name": "created_at", 685 + "type": "text", 686 + "primaryKey": false, 687 + "notNull": true, 688 + "autoincrement": false 689 + } 690 + }, 691 + "indexes": { 692 + "oauth_auth_requests_state_unique": { 693 + "name": "oauth_auth_requests_state_unique", 694 + "columns": [ 695 + "state" 696 + ], 697 + "isUnique": true 698 + } 699 + }, 700 + "foreignKeys": {}, 701 + "compositePrimaryKeys": {}, 702 + "uniqueConstraints": {}, 703 + "checkConstraints": {} 704 + }, 705 + "oauth_sessions": { 706 + "name": "oauth_sessions", 707 + "columns": { 708 + "id": { 709 + "name": "id", 710 + "type": "integer", 711 + "primaryKey": true, 712 + "notNull": true, 713 + "autoincrement": false 714 + }, 715 + "did": { 716 + "name": "did", 717 + "type": "text", 718 + "primaryKey": false, 719 + "notNull": true, 720 + "autoincrement": false 721 + }, 722 + "username": { 723 + "name": "username", 724 + "type": "text", 725 + "primaryKey": false, 726 + "notNull": true, 727 + "autoincrement": false 728 + }, 729 + "iss": { 730 + "name": "iss", 731 + "type": "text", 732 + "primaryKey": false, 733 + "notNull": true, 734 + "autoincrement": false 735 + }, 736 + "access_token": { 737 + "name": "access_token", 738 + "type": "text", 739 + "primaryKey": false, 740 + "notNull": true, 741 + "autoincrement": false 742 + }, 743 + "refresh_token": { 744 + "name": "refresh_token", 745 + "type": "text", 746 + "primaryKey": false, 747 + "notNull": true, 748 + "autoincrement": false 749 + }, 750 + "dpop_nonce": { 751 + "name": "dpop_nonce", 752 + "type": "text", 753 + "primaryKey": false, 754 + "notNull": true, 755 + "autoincrement": false 756 + }, 757 + "dpop_private_jwk": { 758 + "name": "dpop_private_jwk", 759 + "type": "text", 760 + "primaryKey": false, 761 + "notNull": true, 762 + "autoincrement": false 763 + }, 764 + "dpop_public_jwk": { 765 + "name": "dpop_public_jwk", 766 + "type": "text", 767 + "primaryKey": false, 768 + "notNull": true, 769 + "autoincrement": false 770 + }, 771 + "expires_at": { 772 + "name": "expires_at", 773 + "type": "text", 774 + "primaryKey": false, 775 + "notNull": true, 776 + "autoincrement": false 777 + }, 778 + "created_at": { 779 + "name": "created_at", 780 + "type": "text", 781 + "primaryKey": false, 782 + "notNull": true, 783 + "autoincrement": false 784 + }, 785 + "scope": { 786 + "name": "scope", 787 + "type": "text", 788 + "primaryKey": false, 789 + "notNull": true, 790 + "autoincrement": false, 791 + "default": "'atproto transition:generic'" 792 + } 793 + }, 794 + "indexes": {}, 795 + "foreignKeys": {}, 796 + "compositePrimaryKeys": {}, 797 + "uniqueConstraints": {}, 798 + "checkConstraints": {} 799 + }, 800 + "posts": { 801 + "name": "posts", 802 + "columns": { 803 + "id": { 804 + "name": "id", 805 + "type": "integer", 806 + "primaryKey": true, 807 + "notNull": true, 808 + "autoincrement": false 809 + }, 810 + "rkey": { 811 + "name": "rkey", 812 + "type": "text", 813 + "primaryKey": false, 814 + "notNull": true, 815 + "autoincrement": false 816 + }, 817 + "cid": { 818 + "name": "cid", 819 + "type": "text", 820 + "primaryKey": false, 821 + "notNull": true, 822 + "autoincrement": false, 823 + "default": "''" 824 + }, 825 + "title": { 826 + "name": "title", 827 + "type": "text(300)", 828 + "primaryKey": false, 829 + "notNull": true, 830 + "autoincrement": false 831 + }, 832 + "url": { 833 + "name": "url", 834 + "type": "text(255)", 835 + "primaryKey": false, 836 + "notNull": true, 837 + "autoincrement": false 838 + }, 839 + "created_at": { 840 + "name": "created_at", 841 + "type": "text", 842 + "primaryKey": false, 843 + "notNull": true, 844 + "autoincrement": false 845 + }, 846 + "author_did": { 847 + "name": "author_did", 848 + "type": "text", 849 + "primaryKey": false, 850 + "notNull": true, 851 + "autoincrement": false 852 + }, 853 + "status": { 854 + "name": "status", 855 + "type": "text", 856 + "primaryKey": false, 857 + "notNull": false, 858 + "autoincrement": false, 859 + "default": "'live'" 860 + }, 861 + "collection": { 862 + "name": "collection", 863 + "type": "text", 864 + "primaryKey": false, 865 + "notNull": true, 866 + "autoincrement": false 867 + } 868 + }, 869 + "indexes": { 870 + "posts_author_did_rkey_unique": { 871 + "name": "posts_author_did_rkey_unique", 872 + "columns": [ 873 + "author_did", 874 + "rkey" 875 + ], 876 + "isUnique": true 877 + } 878 + }, 879 + "foreignKeys": {}, 880 + "compositePrimaryKeys": {}, 881 + "uniqueConstraints": {}, 882 + "checkConstraints": {} 883 + }, 884 + "post_aggregates": { 885 + "name": "post_aggregates", 886 + "columns": { 887 + "id": { 888 + "name": "id", 889 + "type": "integer", 890 + "primaryKey": true, 891 + "notNull": true, 892 + "autoincrement": false 893 + }, 894 + "post_id": { 895 + "name": "post_id", 896 + "type": "integer", 897 + "primaryKey": false, 898 + "notNull": true, 899 + "autoincrement": false 900 + }, 901 + "comment_count": { 902 + "name": "comment_count", 903 + "type": "integer", 904 + "primaryKey": false, 905 + "notNull": true, 906 + "autoincrement": false, 907 + "default": 0 908 + }, 909 + "vote_count": { 910 + "name": "vote_count", 911 + "type": "integer", 912 + "primaryKey": false, 913 + "notNull": true, 914 + "autoincrement": false, 915 + "default": 0 916 + }, 917 + "rank": { 918 + "name": "rank", 919 + "type": "integer", 920 + "primaryKey": false, 921 + "notNull": true, 922 + "autoincrement": false, 923 + "default": "(CAST(1 AS REAL) / (pow(2,1.8)))" 924 + }, 925 + "created_at": { 926 + "name": "created_at", 927 + "type": "text", 928 + "primaryKey": false, 929 + "notNull": true, 930 + "autoincrement": false, 931 + "default": "(strftime('%Y-%m-%dT%H:%M:%fZ', 'now'))" 932 + } 933 + }, 934 + "indexes": { 935 + "post_id_idx": { 936 + "name": "post_id_idx", 937 + "columns": [ 938 + "post_id" 939 + ], 940 + "isUnique": false 941 + }, 942 + "rank_idx": { 943 + "name": "rank_idx", 944 + "columns": [ 945 + "rank" 946 + ], 947 + "isUnique": false 948 + }, 949 + "post_aggregates_post_id_unique": { 950 + "name": "post_aggregates_post_id_unique", 951 + "columns": [ 952 + "post_id" 953 + ], 954 + "isUnique": true 955 + } 956 + }, 957 + "foreignKeys": { 958 + "post_aggregates_post_id_posts_id_fk": { 959 + "name": "post_aggregates_post_id_posts_id_fk", 960 + "tableFrom": "post_aggregates", 961 + "tableTo": "posts", 962 + "columnsFrom": [ 963 + "post_id" 964 + ], 965 + "columnsTo": [ 966 + "id" 967 + ], 968 + "onDelete": "no action", 969 + "onUpdate": "no action" 970 + } 971 + }, 972 + "compositePrimaryKeys": {}, 973 + "uniqueConstraints": {}, 974 + "checkConstraints": {} 975 + }, 976 + "post_votes": { 977 + "name": "post_votes", 978 + "columns": { 979 + "id": { 980 + "name": "id", 981 + "type": "integer", 982 + "primaryKey": true, 983 + "notNull": true, 984 + "autoincrement": false 985 + }, 986 + "post_id": { 987 + "name": "post_id", 988 + "type": "integer", 989 + "primaryKey": false, 990 + "notNull": true, 991 + "autoincrement": false 992 + }, 993 + "created_at": { 994 + "name": "created_at", 995 + "type": "text", 996 + "primaryKey": false, 997 + "notNull": true, 998 + "autoincrement": false 999 + }, 1000 + "author_did": { 1001 + "name": "author_did", 1002 + "type": "text", 1003 + "primaryKey": false, 1004 + "notNull": true, 1005 + "autoincrement": false 1006 + }, 1007 + "cid": { 1008 + "name": "cid", 1009 + "type": "text", 1010 + "primaryKey": false, 1011 + "notNull": true, 1012 + "autoincrement": false, 1013 + "default": "''" 1014 + }, 1015 + "rkey": { 1016 + "name": "rkey", 1017 + "type": "text", 1018 + "primaryKey": false, 1019 + "notNull": true, 1020 + "autoincrement": false 1021 + }, 1022 + "status": { 1023 + "name": "status", 1024 + "type": "text", 1025 + "primaryKey": false, 1026 + "notNull": false, 1027 + "autoincrement": false, 1028 + "default": "'live'" 1029 + }, 1030 + "collection": { 1031 + "name": "collection", 1032 + "type": "text", 1033 + "primaryKey": false, 1034 + "notNull": true, 1035 + "autoincrement": false, 1036 + "default": "'fyi.unravel.frontpage.vote'" 1037 + } 1038 + }, 1039 + "indexes": { 1040 + "post_votes_author_did_rkey_unique": { 1041 + "name": "post_votes_author_did_rkey_unique", 1042 + "columns": [ 1043 + "author_did", 1044 + "rkey" 1045 + ], 1046 + "isUnique": true 1047 + }, 1048 + "post_votes_author_did_post_id_unique": { 1049 + "name": "post_votes_author_did_post_id_unique", 1050 + "columns": [ 1051 + "author_did", 1052 + "post_id" 1053 + ], 1054 + "isUnique": true 1055 + } 1056 + }, 1057 + "foreignKeys": { 1058 + "post_votes_post_id_posts_id_fk": { 1059 + "name": "post_votes_post_id_posts_id_fk", 1060 + "tableFrom": "post_votes", 1061 + "tableTo": "posts", 1062 + "columnsFrom": [ 1063 + "post_id" 1064 + ], 1065 + "columnsTo": [ 1066 + "id" 1067 + ], 1068 + "onDelete": "no action", 1069 + "onUpdate": "no action" 1070 + } 1071 + }, 1072 + "compositePrimaryKeys": {}, 1073 + "uniqueConstraints": {}, 1074 + "checkConstraints": {} 1075 + }, 1076 + "reports": { 1077 + "name": "reports", 1078 + "columns": { 1079 + "id": { 1080 + "name": "id", 1081 + "type": "integer", 1082 + "primaryKey": true, 1083 + "notNull": true, 1084 + "autoincrement": false 1085 + }, 1086 + "actioned_at": { 1087 + "name": "actioned_at", 1088 + "type": "text", 1089 + "primaryKey": false, 1090 + "notNull": false, 1091 + "autoincrement": false 1092 + }, 1093 + "actioned_by": { 1094 + "name": "actioned_by", 1095 + "type": "text", 1096 + "primaryKey": false, 1097 + "notNull": false, 1098 + "autoincrement": false 1099 + }, 1100 + "subject_uri": { 1101 + "name": "subject_uri", 1102 + "type": "text", 1103 + "primaryKey": false, 1104 + "notNull": true, 1105 + "autoincrement": false 1106 + }, 1107 + "subject_did": { 1108 + "name": "subject_did", 1109 + "type": "text", 1110 + "primaryKey": false, 1111 + "notNull": true, 1112 + "autoincrement": false 1113 + }, 1114 + "subject_collection": { 1115 + "name": "subject_collection", 1116 + "type": "text", 1117 + "primaryKey": false, 1118 + "notNull": false, 1119 + "autoincrement": false 1120 + }, 1121 + "subject_rkey": { 1122 + "name": "subject_rkey", 1123 + "type": "text", 1124 + "primaryKey": false, 1125 + "notNull": false, 1126 + "autoincrement": false 1127 + }, 1128 + "subject_cid": { 1129 + "name": "subject_cid", 1130 + "type": "text", 1131 + "primaryKey": false, 1132 + "notNull": false, 1133 + "autoincrement": false 1134 + }, 1135 + "created_by": { 1136 + "name": "created_by", 1137 + "type": "text", 1138 + "primaryKey": false, 1139 + "notNull": true, 1140 + "autoincrement": false 1141 + }, 1142 + "created_at": { 1143 + "name": "created_at", 1144 + "type": "text", 1145 + "primaryKey": false, 1146 + "notNull": true, 1147 + "autoincrement": false, 1148 + "default": "(current_timestamp)" 1149 + }, 1150 + "creator_comment": { 1151 + "name": "creator_comment", 1152 + "type": "text", 1153 + "primaryKey": false, 1154 + "notNull": false, 1155 + "autoincrement": false 1156 + }, 1157 + "report_reason": { 1158 + "name": "report_reason", 1159 + "type": "text", 1160 + "primaryKey": false, 1161 + "notNull": false, 1162 + "autoincrement": false 1163 + }, 1164 + "status": { 1165 + "name": "status", 1166 + "type": "text", 1167 + "primaryKey": false, 1168 + "notNull": false, 1169 + "autoincrement": false, 1170 + "default": "'pending'" 1171 + } 1172 + }, 1173 + "indexes": {}, 1174 + "foreignKeys": {}, 1175 + "compositePrimaryKeys": {}, 1176 + "uniqueConstraints": {}, 1177 + "checkConstraints": {} 1178 + } 1179 + }, 1180 + "views": {}, 1181 + "enums": {}, 1182 + "_meta": { 1183 + "schemas": {}, 1184 + "tables": {}, 1185 + "columns": {} 1186 + }, 1187 + "internal": { 1188 + "indexes": {} 1189 + } 1190 + }
+7
packages/frontpage/drizzle/meta/_journal.json
··· 64 64 "when": 1763468380404, 65 65 "tag": "0008_unusual_the_initiative", 66 66 "breakpoints": true 67 + }, 68 + { 69 + "idx": 9, 70 + "version": "6", 71 + "when": 1763469054822, 72 + "tag": "0009_soft_strong_guy", 73 + "breakpoints": true 67 74 } 68 75 ] 69 76 }
-1
packages/frontpage/lib/data/atproto/repo.ts
··· 1 - import "server-only"; 2 1 import { AtpBaseClient } from "@repo/frontpage-atproto-client"; 3 2 import { getUser } from "../user"; 4 3 import { fetchAuthenticatedAtproto } from "@/lib/auth";
+2
packages/frontpage/lib/data/db/comment.ts
··· 18 18 deleteCommentAggregateTrigger, 19 19 newCommentAggregateTrigger, 20 20 } from "./triggers"; 21 + import { nsids } from "../atproto/repo"; 21 22 22 23 type CommentRow = Omit< 23 24 InferSelectModel<typeof schema.Comment>, ··· 380 381 createdAt: createdAt, 381 382 parentCommentId: existingParent?.id ?? null, 382 383 status, 384 + collection: nsids.FyiUnravelFrontpageComment, 383 385 }) 384 386 .returning({ 385 387 id: schema.Comment.id,
+2
packages/frontpage/lib/data/db/post.ts
··· 17 17 import { type DID } from "../atproto/did"; 18 18 import { newPostAggregateTrigger } from "./triggers"; 19 19 import { invariant } from "@/lib/utils"; 20 + import { nsids } from "../atproto/repo"; 20 21 21 22 const buildUserHasVotedQuery = cache(async () => { 22 23 const user = await getUser(); ··· 199 200 url: post.url, 200 201 createdAt: post.createdAt, 201 202 status, 203 + collection: nsids.FyiUnravelFrontpagePost, 202 204 }) 203 205 .returning({ postId: schema.Post.id }); 204 206
+3
packages/frontpage/lib/data/db/vote.ts
··· 12 12 newPostVoteAggregateTrigger, 13 13 } from "./triggers"; 14 14 import { invariant } from "@/lib/utils"; 15 + import { nsids } from "../atproto/repo"; 15 16 16 17 export const getVoteForPost = cache(async (postId: number) => { 17 18 const user = await getUser(); ··· 132 133 createdAt: new Date(), 133 134 cid: cid ?? "", 134 135 rkey, 136 + collection: nsids.FyiUnravelFrontpageVote, 135 137 }) 136 138 .returning({ id: schema.PostVote.id }); 137 139 ··· 178 180 createdAt: new Date(), 179 181 cid: cid ?? "", 180 182 rkey, 183 + collection: nsids.FyiUnravelFrontpageVote, 181 184 }) 182 185 .returning({ id: schema.CommentVote.id }); 183 186
+3 -9
packages/frontpage/lib/schema.ts
··· 79 79 status: createStatusColumn("status"), 80 80 collection: text("collection", { 81 81 enum: [nsids.FyiFrontpageFeedPost, nsids.FyiUnravelFrontpagePost], 82 - }) 83 - .notNull() 84 - .default(nsids.FyiUnravelFrontpagePost), 82 + }).notNull(), 85 83 }, 86 84 (t) => ({ 87 85 unique_author_rkey: unique().on(t.authorDid, t.rkey), ··· 90 88 91 89 const voteCollectionColumn = text("collection", { 92 90 enum: [nsids.FyiFrontpageFeedVote, nsids.FyiUnravelFrontpageVote], 93 - }) 94 - .notNull() 95 - .default(nsids.FyiUnravelFrontpageVote); 91 + }).notNull(); 96 92 97 93 export const PostVote = sqliteTable( 98 94 "post_votes", ··· 155 151 parentCommentId: integer("parent_comment_id"), 156 152 collection: text("collection", { 157 153 enum: [nsids.FyiFrontpageFeedComment, nsids.FyiUnravelFrontpageComment], 158 - }) 159 - .notNull() 160 - .default(nsids.FyiUnravelFrontpageComment), 154 + }).notNull(), 161 155 }, 162 156 (t) => ({ 163 157 parentReference: foreignKey({