Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

🔥 Remove legacy touchedAt field (#2283)

Luke Vella04667313001b
diff --git a/apps/web/src/app/api/house-keeping/[...method]/route.ts b/apps/web/src/app/api/house-keeping/[...method]/route.ts
index 3e9af4924..623d4a074 100644
--- a/apps/web/src/app/api/house-keeping/[...method]/route.ts
+++ b/apps/web/src/app/api/house-keeping/[...method]/route.ts
@@ -22,7 +22,7 @@ app.use("*", async (c, next) => {
/**
* Marks inactive polls as deleted. Polls are inactive if they have not been
- * touched in the last 30 days and all dates are in the past.
+ * updated in the last 30 days and all dates are in the past.
* Only marks polls as deleted if they belong to users without an active subscription
* or if they don't have a user associated with them.
*/
@@ -51,8 +51,8 @@ app.get("/delete-inactive-polls", async (c) => {
},
},
],
- // Poll is inactive (not touched AND not viewed in the last 30 days)
- touchedAt: { lt: thirtyDaysAgo },
+ // Poll is inactive (not updated AND not viewed in the last 30 days)
+ updatedAt: { lt: thirtyDaysAgo },
views: {
none: {
viewedAt: { gte: thirtyDaysAgo },
diff --git a/apps/web/tests/house-keeping.spec.ts b/apps/web/tests/house-keeping.spec.ts
index c8688cae2..473d5af60 100644
--- a/apps/web/tests/house-keeping.spec.ts
+++ b/apps/web/tests/house-keeping.spec.ts
@@ -82,14 +82,14 @@ test.describe("House-keeping API", () => {
id: "old-poll-free-user",
title: "Old Poll from Free User",
userId: freeUser.id,
- touchedAt: dayjs().subtract(35, "day").toDate(),
+ updatedAt: dayjs().subtract(35, "day").toDate(),
});
createdPollIds.push(oldPollFromFreeUser.id);
const oldPollNoUser = await createTestPoll({
id: "old-poll-no-user",
title: "Old Poll with No User",
- touchedAt: dayjs().subtract(35, "day").toDate(),
+ updatedAt: dayjs().subtract(35, "day").toDate(),
});
createdPollIds.push(oldPollNoUser.id);
@@ -99,7 +99,7 @@ test.describe("House-keeping API", () => {
title: "Old Poll in Paid Space",
userId: spaceOwner.id,
spaceId: paidSpace.id,
- touchedAt: dayjs().subtract(35, "day").toDate(),
+ updatedAt: dayjs().subtract(35, "day").toDate(),
});
createdPollIds.push(oldPollInPaidSpace.id);
@@ -107,7 +107,7 @@ test.describe("House-keeping API", () => {
id: "recent-poll-free-user",
title: "Recent Poll from Free User",
userId: freeUser.id,
- touchedAt: dayjs().subtract(15, "day").toDate(),
+ updatedAt: dayjs().subtract(15, "day").toDate(),
});
createdPollIds.push(recentPollFromFreeUser.id);
@@ -115,7 +115,7 @@ test.describe("House-keeping API", () => {
id: "old-poll-future-options",
title: "Old Poll with Future Options",
userId: freeUser.id,
- touchedAt: dayjs().subtract(35, "day").toDate(),
+ updatedAt: dayjs().subtract(35, "day").toDate(),
hasFutureOptions: true,
});
createdPollIds.push(oldPollWithFutureOptions.id);
@@ -124,7 +124,7 @@ test.describe("House-keeping API", () => {
id: "old-poll-recent-views",
title: "Old Poll with Recent Views",
userId: freeUser.id,
- touchedAt: dayjs().subtract(35, "day").toDate(),
+ updatedAt: dayjs().subtract(35, "day").toDate(),
hasRecentViews: true,
});
createdPollIds.push(oldPollWithRecentViews.id);
diff --git a/apps/web/tests/test-utils.ts b/apps/web/tests/test-utils.ts
index 4be22f7ed..18fb2af72 100644
--- a/apps/web/tests/test-utils.ts
+++ b/apps/web/tests/test-utils.ts
@@ -68,7 +68,7 @@ export async function createTestPoll({
title,
userId,
spaceId,
- touchedAt,
+ updatedAt,
hasRecentViews = false,
hasFutureOptions = false,
}: {
@@ -76,7 +76,7 @@ export async function createTestPoll({
title: string;
userId?: string;
spaceId?: string;
- touchedAt: Date;
+ updatedAt: Date;
hasRecentViews?: boolean;
hasFutureOptions?: boolean;
}) {
@@ -87,7 +87,7 @@ export async function createTestPoll({
adminUrlId: `${id}-admin`,
userId,
spaceId,
- touchedAt,
+ updatedAt,
...(hasRecentViews && {
views: {
create: {
diff --git a/packages/database/prisma/migrations/20260313103853_remove_touched_at/migration.sql b/packages/database/prisma/migrations/20260313103853_remove_touched_at/migration.sql
new file mode 100644
index 000000000..3f3705673
--- /dev/null
+++ b/packages/database/prisma/migrations/20260313103853_remove_touched_at/migration.sql
@@ -0,0 +1,8 @@
+/*
+ Warnings:
+
+ - You are about to drop the column `touched_at` on the `polls` table. All the data in the column will be lost.
+
+*/
+-- AlterTable
+ALTER TABLE "polls" DROP COLUMN "touched_at";
diff --git a/packages/database/prisma/models/poll.prisma b/packages/database/prisma/models/poll.prisma
index f8c0250fb..d3f685bbe 100644
--- a/packages/database/prisma/models/poll.prisma
+++ b/packages/database/prisma/models/poll.prisma
@@ -29,7 +29,6 @@ model Poll {
status PollStatus @default(open)
deleted Boolean @default(false)
deletedAt DateTime? @map("deleted_at")
- touchedAt DateTime @default(now()) @map("touched_at") // @deprecated
participantUrlId String @unique @map("participant_url_id")
adminUrlId String @unique @map("admin_url_id")
eventId String? @unique @map("event_id")