diff --git a/services/our/prisma/migrations/20250617153949_seed_roles/migration.sql b/services/our/prisma/migrations/20250617153949_seed_roles/migration.sql new file mode 100644 index 0000000..af5102c --- /dev/null +++ b/services/our/prisma/migrations/20250617153949_seed_roles/migration.sql @@ -0,0 +1 @@ +-- This is an empty migration. \ No newline at end of file diff --git a/services/our/prisma/migrations/20250617153949_seed_roles/seed.ts b/services/our/prisma/migrations/20250617153949_seed_roles/seed.ts new file mode 100644 index 0000000..434c11b --- /dev/null +++ b/services/our/prisma/migrations/20250617153949_seed_roles/seed.ts @@ -0,0 +1,17 @@ + +import { PrismaClient } from '../generated/prisma'; +import { withAccelerate } from '@prisma/extension-accelerate'; + +const prisma = new PrismaClient().$extends(withAccelerate()); + + +await Promise.all([ + prisma.role.create({ data: { name: 'user' } }), + prisma.role.create({ data: { name: 'admin' } }), + prisma.role.create({ data: { name: 'supporterTier1' } }), + prisma.role.create({ data: { name: 'supporterTier2' } }), + prisma.role.create({ data: { name: 'supporterTier3' } }), + prisma.role.create({ data: { name: 'supporterTier4' } }), + prisma.role.create({ data: { name: 'supporterTier5' } }), + prisma.role.create({ data: { name: 'supporterTier6' } }), +]); \ No newline at end of file diff --git a/services/our/prisma/schema.prisma b/services/our/prisma/schema.prisma index 4c62a2b..85d7029 100644 --- a/services/our/prisma/schema.prisma +++ b/services/our/prisma/schema.prisma @@ -31,7 +31,7 @@ enum RoleName { } model Role { - id String @id @default(cuid()) + id String @id @default(cuid(2)) name String @unique users User[] }