diff --git a/scripts/backfill-flag-configs.ts b/scripts/backfill-flag-configs.ts deleted file mode 100644 index f98df21..0000000 --- a/scripts/backfill-flag-configs.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { eq, isNull } from "drizzle-orm"; -import { db } from "~/server/db"; -import * as schema from "~/database/schema"; -import { generateFlagConfig } from "~/lib/flag-generator"; - -async function main() { - const users = await db.query.users.findMany({ - where: isNull(schema.users.flagConfig), - }); - const teams = await db.query.teams.findMany({ - where: isNull(schema.teams.flagConfig), - }); - - for (const user of users) { - await db - .update(schema.users) - .set({ flagConfig: generateFlagConfig(user.id), updatedAt: new Date() }) - .where(eq(schema.users.id, user.id)); - } - - for (const team of teams) { - await db - .update(schema.teams) - .set({ flagConfig: generateFlagConfig(team.id), updatedAt: new Date() }) - .where(eq(schema.teams.id, team.id)); - } - - console.log(`Backfilled ${users.length} users and ${teams.length} teams.`); -} - -main() - .then(() => { - process.exit(0); - }) - .catch((error) => { - console.error(error); - process.exit(1); - });