2022-03-22 17:42:07 +00:00
|
|
|
import { PrismaClient } from "@prisma/client";
|
|
|
|
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
|
|
|
|
async function seed() {
|
2022-04-02 17:45:06 +00:00
|
|
|
const discord_id = "123601647258697730";
|
|
|
|
const border_id = 'test';
|
2022-03-22 17:42:07 +00:00
|
|
|
|
|
|
|
// cleanup the existing database
|
2022-04-02 17:45:06 +00:00
|
|
|
await prisma.user.delete({ where: { discord_id } }).catch(() => {
|
2022-03-22 17:42:07 +00:00
|
|
|
// no worries if it doesn't exist yet
|
|
|
|
});
|
|
|
|
|
|
|
|
const user = await prisma.user.create({
|
|
|
|
data: {
|
2022-04-02 17:45:06 +00:00
|
|
|
discord_id,
|
|
|
|
border_id
|
2022-03-22 17:42:07 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
console.log(`Database has been seeded. 🌱`);
|
|
|
|
}
|
|
|
|
|
|
|
|
seed()
|
|
|
|
.catch((e) => {
|
|
|
|
console.error(e);
|
|
|
|
process.exit(1);
|
|
|
|
})
|
|
|
|
.finally(async () => {
|
|
|
|
await prisma.$disconnect();
|
|
|
|
});
|