mirror of
https://github.com/RSSNext/Folo.git
synced 2026-10-17 05:08:13 +08:00
fix(database): update hide-from-timeline when a subscription is upserted
The subscription upsert listed the columns to update on conflict before hide from timeline existed, so re-saving an existing subscription kept the old value in the database while the store had the new one, and it came back after a restart. Update every column except the id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
import type { FeedViewType } from "@follow/constants"
|
||||
import { and, eq, inArray, notInArray, sql } from "drizzle-orm"
|
||||
import { and, eq, inArray, notInArray } from "drizzle-orm"
|
||||
|
||||
import { db } from "../db"
|
||||
import { feedsTable, inboxesTable, listsTable, subscriptionsTable } from "../schemas"
|
||||
import type { SubscriptionSchema } from "../schemas/types"
|
||||
import type { Resetable } from "./internal/base"
|
||||
import { conflictUpdateAllExcept } from "./internal/utils"
|
||||
|
||||
class SubscriptionServiceStatic implements Resetable {
|
||||
getSubscriptionAll() {
|
||||
@@ -21,15 +22,8 @@ class SubscriptionServiceStatic implements Resetable {
|
||||
.values(subscriptions)
|
||||
.onConflictDoUpdate({
|
||||
target: [subscriptionsTable.id],
|
||||
set: {
|
||||
category: sql`excluded.category`,
|
||||
createdAt: sql`excluded.created_at`,
|
||||
feedId: sql`excluded.feed_id`,
|
||||
isPrivate: sql`excluded.is_private`,
|
||||
title: sql`excluded.title`,
|
||||
userId: sql`excluded.user_id`,
|
||||
view: sql`excluded.view`,
|
||||
},
|
||||
// Every column but the id, so columns added later aren't left stale
|
||||
set: conflictUpdateAllExcept(subscriptionsTable, ["id"]),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user