Remove backfill-flag-configs script
One-time migration has been run; script is no longer needed. https://claude.ai/code/session_014RUwPfm1qc539xLxW4m9Uy
This commit is contained in:
parent
bbe5bc4053
commit
f8ae740085
1 changed files with 0 additions and 38 deletions
|
|
@ -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);
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue