import { PrismaClient } from '@prisma/client'; import { format, parseISO } from 'date-fns'; const L_ERROR = 0; const L_WARN = 1; const L_INFO = 2; const L_DEBUG = 3; const L_TRACE = 4; const prisma = new PrismaClient(); async function appLog() { await prisma.appLog.upsert({ where: { id: '0' }, update: {}, create: { message: 'helloworld', level: L_ERROR, }, }); await prisma.appLog.upsert({ where: { id: '1' }, update: {}, create: { message: 'warning message', level: L_WARN, }, }); await prisma.appLog.upsert({ where: { id: '2' }, update: {}, create: { message: 'info message', level: L_INFO, }, }); await prisma.appLog.upsert({ where: { id: '3' }, update: {}, create: { message: 'debug message', level: L_DEBUG, }, }); await prisma.appLog.upsert({ where: { id: '4' }, update: {}, create: { message: 'trace message', level: L_TRACE, }, }); console.log('seed AppLog done'); } const appLogSeed = appLog() .then(async () => { await prisma.$disconnect(); }) .catch(async (e) => { console.error(e); await prisma.$disconnect(); process.exit(1); }); export { appLogSeed };