Skip to content

Instantly share code, notes, and snippets.

@dipeshhkc
Created January 13, 2023 04:45
Show Gist options
  • Save dipeshhkc/13227c304ea63b6f826582ef4cfd9f4b to your computer and use it in GitHub Desktop.
Save dipeshhkc/13227c304ea63b6f826582ef4cfd9f4b to your computer and use it in GitHub Desktop.
import { PrismaClient } from '@prisma/client';
const db = new PrismaClient();
import { add } from 'date-fns';
async function seed() {
await Promise.all(
getUsers().map((user) => {
return db.user.create({ data: user });
})
);
}
seed();
function getUsers() {
return [
{
email: '[email protected]',
trial_ends_at: add(new Date(), { weeks: 1 }),
},
{
email: '[email protected]',
trial_ends_at: add(new Date(), { weeks: 1 }),
},
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment