31 lines
622 B
TypeScript
31 lines
622 B
TypeScript
import { PrismaClient } from "@prisma/client";
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function seed() {
|
|
const discord_id = "123601647258697730";
|
|
const border_id = 'test';
|
|
|
|
// cleanup the existing database
|
|
await prisma.user.delete({ where: { discord_id } }).catch(() => {
|
|
// no worries if it doesn't exist yet
|
|
});
|
|
|
|
const user = await prisma.user.create({
|
|
data: {
|
|
discord_id,
|
|
border_id
|
|
},
|
|
});
|
|
|
|
console.log(`Database has been seeded. 🌱`);
|
|
}
|
|
|
|
seed()
|
|
.catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
})
|
|
.finally(async () => {
|
|
await prisma.$disconnect();
|
|
});
|