Private
Public Access
1
0
Files
Kanban/prisma/seed.ts
T
Catherine Renelle 7b540a37ee Rebrand to Pounce, the Open Source Kanban Solution
- Rename project from "kanban" to "pounce"
- Update landing page: "Pounce on your tasks"
- Replace navbar icon with cat paw
- Update seed hostname to pounce.catrenelle.com
- Write proper README with setup instructions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 22:24:43 -05:00

62 lines
1.4 KiB
TypeScript

import { PrismaClient } from '@prisma/client';
import bcrypt from 'bcrypt';
const prisma = new PrismaClient();
async function main() {
console.log('Seeding database...');
// Create default tenant
const tenant = await prisma.tenant.upsert({
where: { slug: 'default' },
update: {},
create: {
name: 'Default Workspace',
slug: 'default'
}
});
// Map hostnames to default tenant
const hostnames = ['localhost', '127.0.0.1', 'pounce.catrenelle.com'];
for (const hostname of hostnames) {
await prisma.tenantHostname.upsert({
where: { hostname },
update: {},
create: {
hostname,
tenantId: tenant.id,
isPrimary: hostname === 'localhost'
}
});
}
// Create admin user
const passwordHash = await bcrypt.hash('admin123', 12);
await prisma.user.upsert({
where: { tenantId_email: { tenantId: tenant.id, email: 'admin@example.com' } },
update: {},
create: {
tenantId: tenant.id,
email: 'admin@example.com',
name: 'Admin',
passwordHash,
globalRole: 'SITE_ADMIN',
tenantRole: 'ADMIN'
}
});
console.log('Seed complete.');
console.log(` Tenant: ${tenant.name} (${tenant.id})`);
console.log(` Hostnames: ${hostnames.join(', ')}`);
console.log(' Admin: admin@example.com / admin123');
}
main()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});