Skip to content

Commit

Permalink
Rename default datasource (#1941)
Browse files Browse the repository at this point in the history
* Rename default datasource

When looking in the documentation for experimental features (For example
using DB native types) you need to add a previewFeatures flag to the
Generate block, and then in the docs they use `@db.*` everywhere.

So as an example if you'd want to use the Postgres native Date field you
get something like this:

`createdAt DateTime @default(now()) @db.Date`

Since we use `DS`as a default datasource it can trip users up a bit
since `@DS.Date` is not a valid Prisma line (Somehow they don't like the
uppercase datasource).

So if we would already rename it to `datasource db {}` we would make it
easier for users in the future

* rename prisma datasource: docs, test, fixture, mod

Co-authored-by: David Price <thedavid@thedavidprice.com>
  • Loading branch information
jvanbaarsen and thedavidprice committed May 16, 2021
1 parent 5d2aff1 commit a7e975e
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
datasource DS {
datasource db {
provider = "postgresql"
url = env("DB_HOST")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
datasource DS {
datasource db {
provider = "mysql"
url = env("DB_HOST")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
datasource DS {
datasource db {
provider = "postgresql"
url = env("DB_HOST")
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lib/__tests__/fixtures/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
datasource DS {
datasource db {
provider = "sqlite"
url = env("DB_HOST")
}
Expand Down
2 changes: 1 addition & 1 deletion packages/create-redwood-app/template/api/db/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
datasource DS {
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default `
// api/db/schema.prisma
datasource DS {
datasource db {
provider = "sqlite"
url = env("DATABASE_URL")
}
Expand Down

0 comments on commit a7e975e

Please sign in to comment.