8ab58fff87
* 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
10 lines
474 B
SQL
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; |