Skip to content

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

πŸ› Unshare single-member spaces wrongly marked shared by backfill (#3118)

Luke Vella1ebb52db567e
diff --git a/packages/database/prisma/migrations/20260831000000_unshare_single_member_spaces/migration.sql b/packages/database/prisma/migrations/20260831000000_unshare_single_member_spaces/migration.sql
new file mode 100644
index 000000000..50abcc4b0
--- /dev/null
+++ b/packages/database/prisma/migrations/20260831000000_unshare_single_member_spaces/migration.sql
@@ -0,0 +1,12 @@
+-- The 20260828000000 backfill also marked spaces with pending invites as
+-- shared, on the theory that invites sent before the setting existed carried
+-- shared-visibility expectations. That was wrong: a pending invitee has never
+-- seen any content, so a single-member space being shared changes nothing
+-- observable while telling its owner collaboration is on when they never
+-- chose it. Realign shared with actual membership. Spaces that gained a
+-- second member are left untouched β€” unsharing those would be observable.
+UPDATE "spaces" SET "shared" = false
+WHERE "shared" = true
+ AND "id" NOT IN (
+ SELECT "space_id" FROM "space_members" GROUP BY "space_id" HAVING count(*) > 1
+ );
diff --git a/packages/database/prisma/models/space.prisma b/packages/database/prisma/models/space.prisma
index 40d195b86..ccdc5b454 100644
--- a/packages/database/prisma/models/space.prisma
+++ b/packages/database/prisma/models/space.prisma
@@ -17,8 +17,8 @@ model Space {
// everything) or work independently (everyone, admins included, only
// sees what they create; roles grant administrative capabilities, not
// visibility). Defaults to not shared β€” sharing is opt-in; the backfill
- // kept existing multi-member spaces (and spaces with pending invites)
- // shared to preserve their behavior. When the org layer lands, shared
+ // kept existing multi-member spaces shared to preserve their behavior.
+ // When the org layer lands, shared
// spaces map to teams and unshared spaces to organizations.
shared Boolean @default(false)
createdAt DateTime @default(now()) @map("created_at")