Skip to content

Init flow should default to using environment variables for connection URLs #1480

@schickling

Description

@schickling

prisma2 init should be adjusted in the following way:

  • Additionally generate a .env file with the connection url comments moved. (Note the comments below need to be updated)
# Other examples for connection strings are:
# SQLite: url = "sqlite:./dev.db"
# MySQL:  url = "mysql://johndoe:johndoe@localhost:3306/mydb"
# You can also use environment variables to specify the connection string: https://pris.ly/prisma-schema#using-environment-variables
DATABASE_URL="postgresql://schickling@localhost:5432/schickling?schema=public"
  • Use DATABASE_URL in the schema.prisma
datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

Related issues:

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions