Files
vercel/examples/redwoodjs/api/db/seed.js
Steven 3e18146846 [frameworks][examples] Update RedwoodJS to 0.25.0 (#5842)
RedwoodJS [v0.25.0](https://github.com/redwoodjs/redwood/releases/tag/v0.25.0) changed to a different build command: [yarn rw deploy vercel](https://redwoodjs.com/docs/cli-commands#vercel)

This also updates the example to use the latest template from `created-redwood-app`.
2021-02-17 16:02:53 -05:00

29 lines
928 B
JavaScript

/* eslint-disable no-console */
const { PrismaClient } = require('@prisma/client')
const dotenv = require('dotenv')
dotenv.config()
const db = new PrismaClient()
async function main() {
// https://www.prisma.io/docs/guides/prisma-guides/seed-database
//
// Seed data is database data that needs to exist for your app to run.
// Ideally this file should be idempotent: running it multiple times
// will result in the same database state (usually by checking for the
// existence of a record before trying to create it). For example:
//
// const existing = await db.user.findMany({ where: { email: 'admin@email.com' }})
// if (!existing.length) {
// await db.user.create({ data: { name: 'Admin', email: 'admin@email.com' }})
// }
console.info('No data to seed. See api/db/seed.js for info.')
}
main()
.catch((e) => console.error(e))
.finally(async () => {
await db.$disconnect()
})