Unknown database type on db save
See original GitHub issueWhile following along with the Tutorial, I got this error which is apparently due to the environment variable not getting loaded from .env.defaults
:
$ yarn redwood db save yarn run v1.22.0 $ … redwoodblog/node_modules/.bin/redwood db save Creating database migration… [started] $ … redwoodblog/node_modules/.bin/prisma2 migrate save --experimental Error: Unknown database type error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. Creating database migration… [failed] → Command failed with exit code 1: yarn prisma2 migrate save --experimental Command failed with exit code 1: yarn prisma2 migrate save --experimental ✨ Done in 2.05s.
$ yarn -v 1.22.0 $ node -v v12.14.0 “@redwoodjs/core”: “^0.2.0”
If I change api/prisma/schema.prisma
from this:
datasource DS {
provider = "sqlite"
url = env("DATABASE_URL")
}
…to this:
datasource DS {
provider = "sqlite"
url = "file:./dev.db"
}
…it works fine.
I see in the prisma2 docs, it mentions that the .env file has to be in the same directory as the schema file. But I assume that Redwood is meant to be handling the loading of environment variables differently, so that it’s not necessary for the env file to be in the same directory.
Issue Analytics
- State:
- Created 4 years ago
- Comments:12 (8 by maintainers)
Top GitHub Comments
Would it make sense to try and render the DB info that Redwood is trying to use in the error message? That way it can give people a hint on where to look for when they have problems.
@TravisL12 it sounds like you might be on an older version of Redwood since we changed from
DB_HOST
toDATABASE_URL
.