You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to follow the quickstart at https://goprisma.org/docs/getting-started/quickstart (manual setup).
If I follow all the steps like written, it works as described.
Now I changed the datasource in the prisma/schema.prisma to use the env variable like
I have a .env file in the project root with the content:
DATABASE_URL="file:data.sqlite"
then run the usual command to regen the client go run github.com/steebchen/prisma-client-go db push
(no error)
note: it creates the sqlite file in prisma/data.sqlite.
Now when I run the app with go run . I get a panic with
panic: user facing error: The table `main.Post` does not exist in the current database.
Note: It creates a sqlite file at project root data.sqlite that is fresh and not migrated.
When I set the env variable with DATABASE_URL=prisma/file:data.sqlite go run .
it works as expected, but is a different path than set in .env.
How can I make this work, so that the prisma cli and my app use the same path?
I'd love to use the .env file in my main go with something like (github.com/joho/godotenv) but if the path is different, I'll have a hard time.
AFAIK the js implementation always makes the path relative to the schema.prisma.
Thank you.
The text was updated successfully, but these errors were encountered:
munxar
changed the title
panic: user facing error: The table main.Post does not exist in the current database.
env("DATABASE_URL") different in CLI and app
Apr 25, 2024
Thanks for the info, hmm this should have been fixed via #1059... I'm assuming you are running the latest Go client version? Then I'll have to look into it again
Hello
I tried to follow the quickstart at https://goprisma.org/docs/getting-started/quickstart (manual setup).
If I follow all the steps like written, it works as described.
Now I changed the datasource in the prisma/schema.prisma to use the env variable like
I have a .env file in the project root with the content:
then run the usual command to regen the client
go run github.com/steebchen/prisma-client-go db push
(no error)
note: it creates the sqlite file in prisma/data.sqlite.
Now when I run the app with
go run .
I get a panic withNote: It creates a sqlite file at project root data.sqlite that is fresh and not migrated.
When I set the env variable with
DATABASE_URL=prisma/file:data.sqlite go run .
it works as expected, but is a different path than set in .env.
How can I make this work, so that the prisma cli and my app use the same path?
I'd love to use the .env file in my main go with something like (github.com/joho/godotenv) but if the path is different, I'll have a hard time.
AFAIK the js implementation always makes the path relative to the schema.prisma.
Thank you.
The text was updated successfully, but these errors were encountered: