···11import * as z from "zod";
2233+import { eq } from "@openstatus/db";
34import { user, usersToWorkspaces, workspace } from "@openstatus/db/src/schema";
4556import { createTRPCRouter, publicProcedure } from "../../trpc";
···1718 // There's no primary key with drizzle I checked the tennant is not already in the database
1819 const alreadyExists = await opts.ctx.db
1920 .select({ id: user.id })
2020- .from(user);
2121+ .from(user)
2222+ .where(eq(user.tenantId, opts.input.data.data.id));
21232224 if (alreadyExists.length) return;
2325