Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
*/

export const up = async (db, client) => {
const indexes = await db.collection("users").indexes();
const hasEmailIndex = indexes.some((idx) => idx.key?.email === 1);

if (hasEmailIndex) {
// Index already exists (possibly replaced by a later migration) β€” skip
console.log("βœ… email index already exists, skipping sparse migration");
return;
}

// Drop the old non-sparse unique index
await db
.collection("users")
Expand Down
Loading