SatsAllDay 8ab58fff87
Proposal: User Subscriptions: separate posts and comments (#470)
* Subscribe to user posts and comments independently

* Track when comments and posts subscriptions are set to filter out old items

* Only send push notification to subscribed user if posts/comments enabled

* Remove `posts` and `comments` boolean fields on UserSub, rely solely on timestamps
2023-09-18 13:20:02 -05:00

10 lines
474 B
SQL

-- AlterTable
ALTER TABLE "UserSubscription"
ADD COLUMN "updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
ADD COLUMN "commentsSubscribedAt" TIMESTAMP(3),
ADD COLUMN "postsSubscribedAt" TIMESTAMP(3);
-- Set the individual post and comment times based on the original creation time for pre-existing subscriptions
UPDATE "UserSubscription"
SET "commentsSubscribedAt" = "UserSubscription".created_at,
"postsSubscribedAt" = "UserSubscription".created_at;