2
0

build: 🏗️ Add script package

This commit is contained in:
Baptiste Arnaud
2022-02-25 09:45:31 +01:00
parent 27bff8c4b7
commit eb23ad61a7
6 changed files with 52 additions and 2 deletions

20
packages/scripts/index.ts Normal file
View File

@ -0,0 +1,20 @@
import { PrismaClient } from 'db'
import { randomUUID } from 'crypto'
import path from 'path'
require('dotenv').config({
path: path.join(
__dirname,
process.env.NODE_ENV === 'production' ? '.env.prod' : '.env.local'
),
})
const prisma = new PrismaClient()
const main = async () => {
await prisma.user.updateMany({
where: { apiToken: null },
data: { apiToken: randomUUID() },
})
}
main().then()