supabase-community / seed

Automatically seed your database with production-like dummy data based on your schema for local development and testing.
MIT License
456 stars 17 forks source link

Cannot run generate command with `typedSql` #201

Open djshubs opened 1 month ago

djshubs commented 1 month ago

Bug report

Describe the bug

Prisma 5.19.1 has a preview feature for 'typedSql'. The existing dependencies for @snaplet/seed references and older version (5.14.x-dev).

As a result, whenever npx @snaplet/seed generate command is run it errors out.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

Install the latest version of Prisma: npm install prisma --save-dev npm install @prisma/client

Expected behavior

Should generate model.

Screenshots

CleanShot 2024-09-23 at 13 51 50@2x

System information

Additional context

I tried to go into the node_modules and run ncu -i to update the prisma dependencies, but I would get an error for "workspace:*" not found or something similar to that. I'm using NPM to install.

djshubs commented 1 month ago

The following seems to have fixed the issue.

I was able to update the dependencies by going to node_modules/@snaplet/seed and updating the package.json for the packages as follows:

    "@prisma/generator-helper": "5.19.1",
    "@prisma/internals": "5.19.1",

I also went to node_modules/@prisma and went through each folder's package.json and deleted any of them that referenced the 5.14 version.

Then I ran npm install and it update the underlying dependencies. I validated it with package-lock.json.

EDIT: Easier solution... add the following to your package.json

  "overrides": {
    "@snaplet/seed": {
      "@prisma/generator-helper": "^5.19.1",
      "@prisma/internals": "^5.19.1"
    }
  },
djshubs commented 1 month ago

I decided to uninstall @snaplet/seed because it caused issues with prismaSchemaFolder as it couldn't run generate in the schema from a schema folder.