-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Seeding not working in 2.23.0 in Windows #7176
Comments
In case someone is stuck with this issue, I resolved this with the following: prisma/seed.ts:
|
Weird... I've tried multiple variations of that and none of them seem to be working either. Do you know what part of that code resolves the issue? Could it be something else you did? |
Adjusting my tsconfig leads to the same situation in this repo. With |
@Cyntheon not sure. @ljosberinn I have package.json
|
I can confirm this regression. We will fix this. |
This worked for me |
Are you all on Windows where seeding is not working? I updated the title of this issue to reflect this assunption, so please speak up if that is not true (and optimally open a new issue with exactly your situation so we can track this separately!). |
Yes it appears to be specific to Windows. My teammate is unable to seed our database (he's on Windows) while I am able to (I'm on macOS). |
@janpio Confirmed. The only reported occurrences for RedwoodJS are specific to Windows. |
Same issue too with 2.26 |
I added this script to my "scripts": {
"ts-node": "ts-node --compiler-options \"{\\\"module\\\":\\\"commonjs\\\"}\""
} It´s important to have And i added this option in my {
"compilerOptions": {
"isolatedModules": true
}
} I execute |
@MarcosJBM glad that worked for you. We are reworking the seeding feature at the moment. The gist of it is that we want seeding to always work like that |
@tomhoule Assuming the preview version of the feature is This was tested with a |
Super happy to read that :) Stay tuned for moe, but we hope to deliver something stable and without any surprise when db seed comes out of preview. It's a bit tricky to release because seeding is also used by |
🗒️ We heard the feedback and we are planning a redesign of How it will work is that a This property is where you will be able to put any command you want to execute your seed script. More info/details & how to try it out now in: |
This is now released - let us know if this works for you. Thanks! |
After hours of research, only this worked for me. I've tried the other options to change package.json with no success. Thanks! |
None of those worked for me. This worked:
|
Bug description
When seeding the database,
prisma/seed.ts
doesn't seem to be getting called, despite saying that it seeded my database. I tried wrapping lines 30-37 in anexport const seed = () => { ... };
and also withexport default function() { ... }
. In all three cases, none of theconsole.log()
calls are logged, and the database is not updated. I also know that it knowsprisma/seed.ts
exists, as when I delete the file it errors. Reproduction steps are mostly just following the code at Start from scratch | TypeScript & MySQL | Prisma Docs and prisma-examples/seed.ts at latest · prisma/prisma-examples.(Note: when switching the version of
prisma
and@prisma/client
back to2.22.1
, bug no longer occurs and functionality is normal. Breaks again when switching back to2.23.0
)How to reproduce
yarn init
yarn add @prisma/client
andyarn add --dev @types/node prisma ts-node typescript
prisma init
DATABASE_URL
in.env
filetsconfig.json
prisma migrate dev --name init
seed.ts
in folder withschema.prisma
prisma db seed --preview-feature
Expected behavior
No response
Prisma information
.env:
tsconfig.json:
prisma/schema.prisma:
prisma/seed.ts:
Console Output:
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: