Schedule posts to Bluesky with Cloudflare workers. skyscheduler.work
cf tool bsky-tool cloudflare bluesky schedule bsky service social-media cloudflare-workers

optimize query

for #81

+923 -3
+2
migrations/0024_cloudy_vapor.sql
··· 1 + DROP INDEX `repost_scheduleGuid_idx`;--> statement-breakpoint 2 + CREATE INDEX `repost_scheduleGuid_idx` ON `reposts` (`schedule_guid`,`post_uuid`);
+909
migrations/meta/0024_snapshot.json
··· 1 + { 2 + "version": "6", 3 + "dialect": "sqlite", 4 + "id": "78d39811-af21-4af8-aaf3-e388148bfa95", 5 + "prevId": "7ae53caa-026c-4bbf-ba24-1a36b69f0b64", 6 + "tables": { 7 + "accounts": { 8 + "name": "accounts", 9 + "columns": { 10 + "id": { 11 + "name": "id", 12 + "type": "text", 13 + "primaryKey": true, 14 + "notNull": true, 15 + "autoincrement": false 16 + }, 17 + "account_id": { 18 + "name": "account_id", 19 + "type": "text", 20 + "primaryKey": false, 21 + "notNull": true, 22 + "autoincrement": false 23 + }, 24 + "provider_id": { 25 + "name": "provider_id", 26 + "type": "text", 27 + "primaryKey": false, 28 + "notNull": true, 29 + "autoincrement": false 30 + }, 31 + "user_id": { 32 + "name": "user_id", 33 + "type": "text", 34 + "primaryKey": false, 35 + "notNull": true, 36 + "autoincrement": false 37 + }, 38 + "access_token": { 39 + "name": "access_token", 40 + "type": "text", 41 + "primaryKey": false, 42 + "notNull": false, 43 + "autoincrement": false 44 + }, 45 + "refresh_token": { 46 + "name": "refresh_token", 47 + "type": "text", 48 + "primaryKey": false, 49 + "notNull": false, 50 + "autoincrement": false 51 + }, 52 + "id_token": { 53 + "name": "id_token", 54 + "type": "text", 55 + "primaryKey": false, 56 + "notNull": false, 57 + "autoincrement": false 58 + }, 59 + "access_token_expires_at": { 60 + "name": "access_token_expires_at", 61 + "type": "integer", 62 + "primaryKey": false, 63 + "notNull": false, 64 + "autoincrement": false 65 + }, 66 + "refresh_token_expires_at": { 67 + "name": "refresh_token_expires_at", 68 + "type": "integer", 69 + "primaryKey": false, 70 + "notNull": false, 71 + "autoincrement": false 72 + }, 73 + "scope": { 74 + "name": "scope", 75 + "type": "text", 76 + "primaryKey": false, 77 + "notNull": false, 78 + "autoincrement": false 79 + }, 80 + "password": { 81 + "name": "password", 82 + "type": "text", 83 + "primaryKey": false, 84 + "notNull": false, 85 + "autoincrement": false 86 + }, 87 + "created_at": { 88 + "name": "created_at", 89 + "type": "integer", 90 + "primaryKey": false, 91 + "notNull": true, 92 + "autoincrement": false, 93 + "default": "(cast(unixepoch('subsecond') * 1000 as integer))" 94 + }, 95 + "updated_at": { 96 + "name": "updated_at", 97 + "type": "integer", 98 + "primaryKey": false, 99 + "notNull": true, 100 + "autoincrement": false 101 + } 102 + }, 103 + "indexes": { 104 + "accounts_userId_idx": { 105 + "name": "accounts_userId_idx", 106 + "columns": [ 107 + "user_id" 108 + ], 109 + "isUnique": false 110 + } 111 + }, 112 + "foreignKeys": { 113 + "accounts_user_id_users_id_fk": { 114 + "name": "accounts_user_id_users_id_fk", 115 + "tableFrom": "accounts", 116 + "tableTo": "users", 117 + "columnsFrom": [ 118 + "user_id" 119 + ], 120 + "columnsTo": [ 121 + "id" 122 + ], 123 + "onDelete": "cascade", 124 + "onUpdate": "no action" 125 + } 126 + }, 127 + "compositePrimaryKeys": {}, 128 + "uniqueConstraints": {}, 129 + "checkConstraints": {} 130 + }, 131 + "sessions": { 132 + "name": "sessions", 133 + "columns": { 134 + "id": { 135 + "name": "id", 136 + "type": "text", 137 + "primaryKey": true, 138 + "notNull": true, 139 + "autoincrement": false 140 + }, 141 + "expires_at": { 142 + "name": "expires_at", 143 + "type": "integer", 144 + "primaryKey": false, 145 + "notNull": true, 146 + "autoincrement": false 147 + }, 148 + "token": { 149 + "name": "token", 150 + "type": "text", 151 + "primaryKey": false, 152 + "notNull": true, 153 + "autoincrement": false 154 + }, 155 + "created_at": { 156 + "name": "created_at", 157 + "type": "integer", 158 + "primaryKey": false, 159 + "notNull": true, 160 + "autoincrement": false, 161 + "default": "(cast(unixepoch('subsecond') * 1000 as integer))" 162 + }, 163 + "updated_at": { 164 + "name": "updated_at", 165 + "type": "integer", 166 + "primaryKey": false, 167 + "notNull": true, 168 + "autoincrement": false 169 + }, 170 + "ip_address": { 171 + "name": "ip_address", 172 + "type": "text", 173 + "primaryKey": false, 174 + "notNull": false, 175 + "autoincrement": false 176 + }, 177 + "user_agent": { 178 + "name": "user_agent", 179 + "type": "text", 180 + "primaryKey": false, 181 + "notNull": false, 182 + "autoincrement": false 183 + }, 184 + "user_id": { 185 + "name": "user_id", 186 + "type": "text", 187 + "primaryKey": false, 188 + "notNull": true, 189 + "autoincrement": false 190 + } 191 + }, 192 + "indexes": { 193 + "sessions_token_unique": { 194 + "name": "sessions_token_unique", 195 + "columns": [ 196 + "token" 197 + ], 198 + "isUnique": true 199 + }, 200 + "sessions_userId_idx": { 201 + "name": "sessions_userId_idx", 202 + "columns": [ 203 + "user_id" 204 + ], 205 + "isUnique": false 206 + } 207 + }, 208 + "foreignKeys": { 209 + "sessions_user_id_users_id_fk": { 210 + "name": "sessions_user_id_users_id_fk", 211 + "tableFrom": "sessions", 212 + "tableTo": "users", 213 + "columnsFrom": [ 214 + "user_id" 215 + ], 216 + "columnsTo": [ 217 + "id" 218 + ], 219 + "onDelete": "cascade", 220 + "onUpdate": "no action" 221 + } 222 + }, 223 + "compositePrimaryKeys": {}, 224 + "uniqueConstraints": {}, 225 + "checkConstraints": {} 226 + }, 227 + "users": { 228 + "name": "users", 229 + "columns": { 230 + "id": { 231 + "name": "id", 232 + "type": "text", 233 + "primaryKey": true, 234 + "notNull": true, 235 + "autoincrement": false 236 + }, 237 + "name": { 238 + "name": "name", 239 + "type": "text", 240 + "primaryKey": false, 241 + "notNull": true, 242 + "autoincrement": false 243 + }, 244 + "email": { 245 + "name": "email", 246 + "type": "text", 247 + "primaryKey": false, 248 + "notNull": true, 249 + "autoincrement": false 250 + }, 251 + "email_verified": { 252 + "name": "email_verified", 253 + "type": "integer", 254 + "primaryKey": false, 255 + "notNull": true, 256 + "autoincrement": false 257 + }, 258 + "image": { 259 + "name": "image", 260 + "type": "text", 261 + "primaryKey": false, 262 + "notNull": false, 263 + "autoincrement": false 264 + }, 265 + "created_at": { 266 + "name": "created_at", 267 + "type": "integer", 268 + "primaryKey": false, 269 + "notNull": true, 270 + "autoincrement": false 271 + }, 272 + "updated_at": { 273 + "name": "updated_at", 274 + "type": "integer", 275 + "primaryKey": false, 276 + "notNull": true, 277 + "autoincrement": false 278 + }, 279 + "username": { 280 + "name": "username", 281 + "type": "text", 282 + "primaryKey": false, 283 + "notNull": false, 284 + "autoincrement": false 285 + }, 286 + "display_username": { 287 + "name": "display_username", 288 + "type": "text", 289 + "primaryKey": false, 290 + "notNull": false, 291 + "autoincrement": false 292 + }, 293 + "bsky_app_pass": { 294 + "name": "bsky_app_pass", 295 + "type": "text", 296 + "primaryKey": false, 297 + "notNull": true, 298 + "autoincrement": false 299 + }, 300 + "pds": { 301 + "name": "pds", 302 + "type": "text", 303 + "primaryKey": false, 304 + "notNull": true, 305 + "autoincrement": false, 306 + "default": "'https://bsky.social'" 307 + } 308 + }, 309 + "indexes": { 310 + "users_email_unique": { 311 + "name": "users_email_unique", 312 + "columns": [ 313 + "email" 314 + ], 315 + "isUnique": true 316 + }, 317 + "users_username_unique": { 318 + "name": "users_username_unique", 319 + "columns": [ 320 + "username" 321 + ], 322 + "isUnique": true 323 + } 324 + }, 325 + "foreignKeys": {}, 326 + "compositePrimaryKeys": {}, 327 + "uniqueConstraints": {}, 328 + "checkConstraints": {} 329 + }, 330 + "verifications": { 331 + "name": "verifications", 332 + "columns": { 333 + "id": { 334 + "name": "id", 335 + "type": "text", 336 + "primaryKey": true, 337 + "notNull": true, 338 + "autoincrement": false 339 + }, 340 + "identifier": { 341 + "name": "identifier", 342 + "type": "text", 343 + "primaryKey": false, 344 + "notNull": true, 345 + "autoincrement": false 346 + }, 347 + "value": { 348 + "name": "value", 349 + "type": "text", 350 + "primaryKey": false, 351 + "notNull": true, 352 + "autoincrement": false 353 + }, 354 + "expires_at": { 355 + "name": "expires_at", 356 + "type": "integer", 357 + "primaryKey": false, 358 + "notNull": true, 359 + "autoincrement": false 360 + }, 361 + "created_at": { 362 + "name": "created_at", 363 + "type": "integer", 364 + "primaryKey": false, 365 + "notNull": true, 366 + "autoincrement": false, 367 + "default": "(cast(unixepoch('subsecond') * 1000 as integer))" 368 + }, 369 + "updated_at": { 370 + "name": "updated_at", 371 + "type": "integer", 372 + "primaryKey": false, 373 + "notNull": true, 374 + "autoincrement": false, 375 + "default": "(cast(unixepoch('subsecond') * 1000 as integer))" 376 + } 377 + }, 378 + "indexes": { 379 + "verifications_identifier_idx": { 380 + "name": "verifications_identifier_idx", 381 + "columns": [ 382 + "identifier" 383 + ], 384 + "isUnique": false 385 + } 386 + }, 387 + "foreignKeys": {}, 388 + "compositePrimaryKeys": {}, 389 + "uniqueConstraints": {}, 390 + "checkConstraints": {} 391 + }, 392 + "bans": { 393 + "name": "bans", 394 + "columns": { 395 + "account_did": { 396 + "name": "account_did", 397 + "type": "text", 398 + "primaryKey": true, 399 + "notNull": true, 400 + "autoincrement": false 401 + }, 402 + "banReason": { 403 + "name": "banReason", 404 + "type": "text", 405 + "primaryKey": false, 406 + "notNull": true, 407 + "autoincrement": false, 408 + "default": "''" 409 + }, 410 + "created_at": { 411 + "name": "created_at", 412 + "type": "integer", 413 + "primaryKey": false, 414 + "notNull": true, 415 + "autoincrement": false, 416 + "default": "CURRENT_TIMESTAMP" 417 + } 418 + }, 419 + "indexes": {}, 420 + "foreignKeys": {}, 421 + "compositePrimaryKeys": {}, 422 + "uniqueConstraints": {}, 423 + "checkConstraints": {} 424 + }, 425 + "media": { 426 + "name": "media", 427 + "columns": { 428 + "file": { 429 + "name": "file", 430 + "type": "text", 431 + "primaryKey": true, 432 + "notNull": true, 433 + "autoincrement": false 434 + }, 435 + "hasPost": { 436 + "name": "hasPost", 437 + "type": "integer", 438 + "primaryKey": false, 439 + "notNull": false, 440 + "autoincrement": false, 441 + "default": false 442 + }, 443 + "user": { 444 + "name": "user", 445 + "type": "text", 446 + "primaryKey": false, 447 + "notNull": false, 448 + "autoincrement": false 449 + }, 450 + "created_at": { 451 + "name": "created_at", 452 + "type": "integer", 453 + "primaryKey": false, 454 + "notNull": true, 455 + "autoincrement": false 456 + } 457 + }, 458 + "indexes": { 459 + "media_oldWithNoPost_idx": { 460 + "name": "media_oldWithNoPost_idx", 461 + "columns": [ 462 + "hasPost", 463 + "created_at" 464 + ], 465 + "isUnique": false, 466 + "where": "hasPost = 0" 467 + }, 468 + "media_userid_idx": { 469 + "name": "media_userid_idx", 470 + "columns": [ 471 + "user" 472 + ], 473 + "isUnique": false 474 + } 475 + }, 476 + "foreignKeys": { 477 + "media_user_users_id_fk": { 478 + "name": "media_user_users_id_fk", 479 + "tableFrom": "media", 480 + "tableTo": "users", 481 + "columnsFrom": [ 482 + "user" 483 + ], 484 + "columnsTo": [ 485 + "id" 486 + ], 487 + "onDelete": "cascade", 488 + "onUpdate": "no action" 489 + } 490 + }, 491 + "compositePrimaryKeys": {}, 492 + "uniqueConstraints": {}, 493 + "checkConstraints": {} 494 + }, 495 + "posts": { 496 + "name": "posts", 497 + "columns": { 498 + "uuid": { 499 + "name": "uuid", 500 + "type": "text", 501 + "primaryKey": true, 502 + "notNull": true, 503 + "autoincrement": false 504 + }, 505 + "content": { 506 + "name": "content", 507 + "type": "text", 508 + "primaryKey": false, 509 + "notNull": true, 510 + "autoincrement": false 511 + }, 512 + "scheduled_date": { 513 + "name": "scheduled_date", 514 + "type": "integer", 515 + "primaryKey": false, 516 + "notNull": true, 517 + "autoincrement": false 518 + }, 519 + "posted": { 520 + "name": "posted", 521 + "type": "integer", 522 + "primaryKey": false, 523 + "notNull": false, 524 + "autoincrement": false, 525 + "default": false 526 + }, 527 + "postNow": { 528 + "name": "postNow", 529 + "type": "integer", 530 + "primaryKey": false, 531 + "notNull": false, 532 + "autoincrement": false, 533 + "default": false 534 + }, 535 + "embedContent": { 536 + "name": "embedContent", 537 + "type": "text", 538 + "primaryKey": false, 539 + "notNull": true, 540 + "autoincrement": false, 541 + "default": "(json_array())" 542 + }, 543 + "repostInfo": { 544 + "name": "repostInfo", 545 + "type": "text", 546 + "primaryKey": false, 547 + "notNull": false, 548 + "autoincrement": false 549 + }, 550 + "uri": { 551 + "name": "uri", 552 + "type": "text", 553 + "primaryKey": false, 554 + "notNull": false, 555 + "autoincrement": false 556 + }, 557 + "cid": { 558 + "name": "cid", 559 + "type": "text", 560 + "primaryKey": false, 561 + "notNull": false, 562 + "autoincrement": false 563 + }, 564 + "isRepost": { 565 + "name": "isRepost", 566 + "type": "integer", 567 + "primaryKey": false, 568 + "notNull": false, 569 + "autoincrement": false, 570 + "default": false 571 + }, 572 + "contentLabel": { 573 + "name": "contentLabel", 574 + "type": "text", 575 + "primaryKey": false, 576 + "notNull": true, 577 + "autoincrement": false, 578 + "default": "'None'" 579 + }, 580 + "created_at": { 581 + "name": "created_at", 582 + "type": "integer", 583 + "primaryKey": false, 584 + "notNull": true, 585 + "autoincrement": false, 586 + "default": "CURRENT_TIMESTAMP" 587 + }, 588 + "updated_at": { 589 + "name": "updated_at", 590 + "type": "integer", 591 + "primaryKey": false, 592 + "notNull": false, 593 + "autoincrement": false 594 + }, 595 + "user": { 596 + "name": "user", 597 + "type": "text", 598 + "primaryKey": false, 599 + "notNull": true, 600 + "autoincrement": false 601 + } 602 + }, 603 + "indexes": { 604 + "user_idx": { 605 + "name": "user_idx", 606 + "columns": [ 607 + "user" 608 + ], 609 + "isUnique": false 610 + }, 611 + "postedUpdate_idx": { 612 + "name": "postedUpdate_idx", 613 + "columns": [ 614 + "updated_at", 615 + "posted" 616 + ], 617 + "isUnique": false, 618 + "where": "posted = 1" 619 + }, 620 + "repostOnlyUser_idx": { 621 + "name": "repostOnlyUser_idx", 622 + "columns": [ 623 + "user", 624 + "isRepost" 625 + ], 626 + "isUnique": false, 627 + "where": "isRepost = 1" 628 + }, 629 + "postedUUID_idx": { 630 + "name": "postedUUID_idx", 631 + "columns": [ 632 + "uuid", 633 + "posted" 634 + ], 635 + "isUnique": false 636 + }, 637 + "postNowScheduledDatePosted_idx": { 638 + "name": "postNowScheduledDatePosted_idx", 639 + "columns": [ 640 + "posted", 641 + "scheduled_date", 642 + "postNow" 643 + ], 644 + "isUnique": false, 645 + "where": "posted = 0 and postNow <> 1" 646 + }, 647 + "repostAddOn_idx": { 648 + "name": "repostAddOn_idx", 649 + "columns": [ 650 + "user", 651 + "cid" 652 + ], 653 + "isUnique": false 654 + } 655 + }, 656 + "foreignKeys": { 657 + "posts_user_users_id_fk": { 658 + "name": "posts_user_users_id_fk", 659 + "tableFrom": "posts", 660 + "tableTo": "users", 661 + "columnsFrom": [ 662 + "user" 663 + ], 664 + "columnsTo": [ 665 + "id" 666 + ], 667 + "onDelete": "cascade", 668 + "onUpdate": "no action" 669 + } 670 + }, 671 + "compositePrimaryKeys": {}, 672 + "uniqueConstraints": {}, 673 + "checkConstraints": {} 674 + }, 675 + "repostCounts": { 676 + "name": "repostCounts", 677 + "columns": { 678 + "post_uuid": { 679 + "name": "post_uuid", 680 + "type": "text", 681 + "primaryKey": true, 682 + "notNull": true, 683 + "autoincrement": false 684 + }, 685 + "count": { 686 + "name": "count", 687 + "type": "integer", 688 + "primaryKey": false, 689 + "notNull": true, 690 + "autoincrement": false, 691 + "default": 0 692 + } 693 + }, 694 + "indexes": {}, 695 + "foreignKeys": { 696 + "repostCounts_post_uuid_posts_uuid_fk": { 697 + "name": "repostCounts_post_uuid_posts_uuid_fk", 698 + "tableFrom": "repostCounts", 699 + "tableTo": "posts", 700 + "columnsFrom": [ 701 + "post_uuid" 702 + ], 703 + "columnsTo": [ 704 + "uuid" 705 + ], 706 + "onDelete": "cascade", 707 + "onUpdate": "no action" 708 + } 709 + }, 710 + "compositePrimaryKeys": {}, 711 + "uniqueConstraints": {}, 712 + "checkConstraints": {} 713 + }, 714 + "reposts": { 715 + "name": "reposts", 716 + "columns": { 717 + "id": { 718 + "name": "id", 719 + "type": "integer", 720 + "primaryKey": true, 721 + "notNull": true, 722 + "autoincrement": true 723 + }, 724 + "post_uuid": { 725 + "name": "post_uuid", 726 + "type": "text", 727 + "primaryKey": false, 728 + "notNull": true, 729 + "autoincrement": false 730 + }, 731 + "scheduled_date": { 732 + "name": "scheduled_date", 733 + "type": "integer", 734 + "primaryKey": false, 735 + "notNull": true, 736 + "autoincrement": false 737 + }, 738 + "schedule_guid": { 739 + "name": "schedule_guid", 740 + "type": "text", 741 + "primaryKey": false, 742 + "notNull": false, 743 + "autoincrement": false 744 + } 745 + }, 746 + "indexes": { 747 + "repost_scheduledDate_idx": { 748 + "name": "repost_scheduledDate_idx", 749 + "columns": [ 750 + "scheduled_date" 751 + ], 752 + "isUnique": false 753 + }, 754 + "repost_postid_idx": { 755 + "name": "repost_postid_idx", 756 + "columns": [ 757 + "post_uuid" 758 + ], 759 + "isUnique": false 760 + }, 761 + "repost_scheduleGuid_idx": { 762 + "name": "repost_scheduleGuid_idx", 763 + "columns": [ 764 + "schedule_guid", 765 + "post_uuid" 766 + ], 767 + "isUnique": false 768 + }, 769 + "repost_noduplicates_idx": { 770 + "name": "repost_noduplicates_idx", 771 + "columns": [ 772 + "post_uuid", 773 + "scheduled_date" 774 + ], 775 + "isUnique": true 776 + } 777 + }, 778 + "foreignKeys": { 779 + "reposts_post_uuid_posts_uuid_fk": { 780 + "name": "reposts_post_uuid_posts_uuid_fk", 781 + "tableFrom": "reposts", 782 + "tableTo": "posts", 783 + "columnsFrom": [ 784 + "post_uuid" 785 + ], 786 + "columnsTo": [ 787 + "uuid" 788 + ], 789 + "onDelete": "cascade", 790 + "onUpdate": "no action" 791 + } 792 + }, 793 + "compositePrimaryKeys": {}, 794 + "uniqueConstraints": {}, 795 + "checkConstraints": {} 796 + }, 797 + "violations": { 798 + "name": "violations", 799 + "columns": { 800 + "id": { 801 + "name": "id", 802 + "type": "integer", 803 + "primaryKey": true, 804 + "notNull": true, 805 + "autoincrement": true 806 + }, 807 + "user": { 808 + "name": "user", 809 + "type": "text", 810 + "primaryKey": false, 811 + "notNull": true, 812 + "autoincrement": false 813 + }, 814 + "tosViolation": { 815 + "name": "tosViolation", 816 + "type": "integer", 817 + "primaryKey": false, 818 + "notNull": false, 819 + "autoincrement": false, 820 + "default": false 821 + }, 822 + "userPassInvalid": { 823 + "name": "userPassInvalid", 824 + "type": "integer", 825 + "primaryKey": false, 826 + "notNull": false, 827 + "autoincrement": false, 828 + "default": false 829 + }, 830 + "accountSuspended": { 831 + "name": "accountSuspended", 832 + "type": "integer", 833 + "primaryKey": false, 834 + "notNull": false, 835 + "autoincrement": false, 836 + "default": false 837 + }, 838 + "accountGone": { 839 + "name": "accountGone", 840 + "type": "integer", 841 + "primaryKey": false, 842 + "notNull": false, 843 + "autoincrement": false, 844 + "default": false 845 + }, 846 + "mediaTooBig": { 847 + "name": "mediaTooBig", 848 + "type": "integer", 849 + "primaryKey": false, 850 + "notNull": false, 851 + "autoincrement": false, 852 + "default": false 853 + }, 854 + "created_at": { 855 + "name": "created_at", 856 + "type": "integer", 857 + "primaryKey": false, 858 + "notNull": true, 859 + "autoincrement": false, 860 + "default": "CURRENT_TIMESTAMP" 861 + } 862 + }, 863 + "indexes": { 864 + "violations_user_unique": { 865 + "name": "violations_user_unique", 866 + "columns": [ 867 + "user" 868 + ], 869 + "isUnique": true 870 + }, 871 + "violations_user_idx": { 872 + "name": "violations_user_idx", 873 + "columns": [ 874 + "user" 875 + ], 876 + "isUnique": false 877 + } 878 + }, 879 + "foreignKeys": { 880 + "violations_user_users_id_fk": { 881 + "name": "violations_user_users_id_fk", 882 + "tableFrom": "violations", 883 + "tableTo": "users", 884 + "columnsFrom": [ 885 + "user" 886 + ], 887 + "columnsTo": [ 888 + "id" 889 + ], 890 + "onDelete": "cascade", 891 + "onUpdate": "no action" 892 + } 893 + }, 894 + "compositePrimaryKeys": {}, 895 + "uniqueConstraints": {}, 896 + "checkConstraints": {} 897 + } 898 + }, 899 + "views": {}, 900 + "enums": {}, 901 + "_meta": { 902 + "schemas": {}, 903 + "tables": {}, 904 + "columns": {} 905 + }, 906 + "internal": { 907 + "indexes": {} 908 + } 909 + }
+7
migrations/meta/_journal.json
··· 169 169 "when": 1770514295788, 170 170 "tag": "0023_sweet_slapstick", 171 171 "breakpoints": true 172 + }, 173 + { 174 + "idx": 24, 175 + "version": "6", 176 + "when": 1770686362039, 177 + "tag": "0024_cloudy_vapor", 178 + "breakpoints": true 172 179 } 173 180 ] 174 181 }
+1 -1
src/db/app.schema.ts
··· 67 67 // used for left joining and matching with posts field 68 68 index("repost_postid_idx").on(table.uuid), 69 69 // used for checking if a schedule still has actions left 70 - index("repost_scheduleGuid_idx").on(table.scheduleGuid), 70 + index("repost_scheduleGuid_idx").on(table.scheduleGuid, table.uuid), 71 71 // preventing similar actions from pushing to the table 72 72 unique("repost_noduplicates_idx").on(table.uuid, table.scheduledDate), 73 73 ]);
+4 -2
src/utils/db/data.ts
··· 1 1 import { 2 - and, eq, inArray, isNotNull, 2 + and, eq, inArray, 3 3 lte, ne, notInArray, sql 4 4 } from "drizzle-orm"; 5 5 import { BatchItem } from "drizzle-orm/batch"; ··· 79 79 // do a search to find if there are any reposts with the same scheduleguid. 80 80 // if there are none, this schedule should get removed from the repostInfo array 81 81 const stillHasSchedule = await db.select().from(reposts) 82 - .where(and(isNotNull(reposts.scheduleGuid), eq(reposts.scheduleGuid, deleted.scheduleGuid!))) 82 + .where(and( 83 + eq(reposts.scheduleGuid, deleted.scheduleGuid!), 84 + eq(reposts.uuid, deleted.id))) 83 85 .limit(1).all(); 84 86 85 87 // if this is empty, then we need to update the repost info.