Keep/keep-notes/scripts/grant-all-admins.ts

25 lines
557 B
TypeScript

import { prisma } from '../lib/prisma'
async function main() {
console.log('👑 Granting ADMIN access to ALL users...')
try {
const result = await prisma.user.updateMany({
data: {
role: 'ADMIN'
}
})
console.log(`✅ Success! Updated ${result.count} users to ADMIN role.`)
} catch (error) {
console.error('❌ Error updating users:', error)
process.exit(1)
}
}
main()
.catch(e => console.error(e))
.finally(async () => await prisma.$disconnect())