CREATE TABLE "social_feed_read_states" (
  "user_id" UUID NOT NULL,
  "last_seen_at" TIMESTAMPTZ(3) NOT NULL,
  "created_at" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
  "updated_at" TIMESTAMPTZ(3) NOT NULL,
  CONSTRAINT "social_feed_read_states_pkey" PRIMARY KEY ("user_id"),
  CONSTRAINT "social_feed_read_states_user_id_fkey"
    FOREIGN KEY ("user_id") REFERENCES "identity_users"("id")
    ON DELETE CASCADE ON UPDATE CASCADE
);

CREATE INDEX "social_feed_read_states_last_seen_at_idx"
  ON "social_feed_read_states"("last_seen_at");
