rwadurian/backend/services/identity-service/prisma/seed.ts

28 lines
645 B
TypeScript

import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function main() {
console.log('Seeding database...');
// 清理现有数据
await prisma.deadLetterEvent.deleteMany();
await prisma.smsCode.deleteMany();
await prisma.userEvent.deleteMany();
await prisma.deviceToken.deleteMany();
await prisma.walletAddress.deleteMany();
await prisma.userDevice.deleteMany();
await prisma.userAccount.deleteMany();
console.log('Database seeded successfully!');
}
main()
.catch((e) => {
console.error(e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});