question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Preview feature feedback: Integrated seeding

See original GitHub issue

Please share your feedback about the integrated seeding functionality that was released in v2.15.0 in this issue.

  • If you encounter a bug, please open a bug report in this repo.
  • If the feature is working well for you, please share this in a comment below or leave a 👍 on this issue.

If you have any questions, don’t hesitate to ask them in the #prisma-migrate channel in the Prisma Slack.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:3
  • Comments:50 (18 by maintainers)

github_iconTop GitHub Comments

14reactions
flybayercommented, Feb 4, 2021

I really do not like the decision to make this seed.ts file a script with side effects (vs exporting a function that prisma would then run).

This totally breaks the use case of being able to export a function from the seed file that can be manually invoked somewhere else in my code, such as some test scripts, production scripts, etc.

I urge you to consider changing the functionality to instead export a function so the seed file is side-effect free.

import { PrismaClient } from '@prisma/client'

async function main() {
  const prisma = new PrismaClient()
  const u = await prisma.user.findFirst()
  console.log(u)
}

-main()
+export default main
8reactions
rajuashokcommented, Jan 21, 2021

Changing my tsconfig.json to have this:

"module": "commonjs",

instead of this:

"module": "esnext",

fixed it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Preview Databases (Feature concept for the Prisma Data ...
In this video, you'll see a demo of an early concept our team is working on to make sure databases are smoothly integrated...
Read more >
Prisma CLI preview features
Prisma CLI features that are currently in preview. ... new Prisma CLI feature, it often starts in preview so that you can test...
Read more >
AppleSeed for IT Program Planning Guide
The feedback you provide on quality, usability, integration, and operation of features in your environment will help Apple identify issues, fix them, ...
Read more >
Review Apps (New) - Heroku Dev Center
This article is about the new version of Heroku Review Apps ... should seed the database with comprehensive data so that the review...
Read more >
Overview of Microsoft Viva Learning
Viva Learning is a centralized learning hub in Microsoft Teams that lets you seamlessly integrate learning and building skills into your day ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found