Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename default datasource #1941

Merged
merged 3 commits into from
May 16, 2021

Conversation

jvanbaarsen
Copy link
Contributor

@jvanbaarsen jvanbaarsen commented Mar 7, 2021

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 DSas 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.

As a sidenote, Prisma is using datasource db {} themselves in the docs as well.

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
@github-actions
Copy link

github-actions bot commented Mar 7, 2021

📦 PR Packages

Click to Show Package Download Links

https://rw-pr-redwoodjs-com.s3.amazonaws.com/1941/create-redwood-app-0.26.2-ee2304a.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/1941/redwoodjs-api-0.26.2-ee2304a.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/1941/redwoodjs-api-server-0.26.2-ee2304a.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/1941/redwoodjs-auth-0.26.2-ee2304a.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/1941/redwoodjs-cli-0.26.2-ee2304a.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/1941/redwoodjs-core-0.26.2-ee2304a.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/1941/redwoodjs-dev-server-0.26.2-ee2304a.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/1941/redwoodjs-eslint-config-0.26.2-ee2304a.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/1941/redwoodjs-eslint-plugin-redwood-0.26.2-ee2304a.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/1941/redwoodjs-forms-0.26.2-ee2304a.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/1941/redwoodjs-internal-0.26.2-ee2304a.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/1941/redwoodjs-prerender-0.26.2-ee2304a.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/1941/redwoodjs-router-0.26.2-ee2304a.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/1941/redwoodjs-structure-0.26.2-ee2304a.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/1941/redwoodjs-testing-0.26.2-ee2304a.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/1941/redwoodjs-web-0.26.2-ee2304a.tgz

Install this PR by running yarn rw upgrade --pr 1941:0.26.2-ee2304a

@thedavidprice thedavidprice added release:breaking This PR is a breaking change topic/docs labels Mar 16, 2021
@thedavidprice thedavidprice modified the milestone: next release Mar 17, 2021
@thedavidprice
Copy link
Contributor

thedavidprice commented Mar 18, 2021

Ok, so this would be a non-breaking change we'd suggest people update via manual code mod. Also, we'd need to:

@peterp anything else you can think of that we should consider along with this one? Such a small change. But, you know, Prisma always has me nervous.

@jvanbaarsen Based on feedback and recommendations regarding my questions above, I can help if/as needed. Would be great to get it all in with this PR.

@cannikin
Copy link
Member

This is literally the first time I've ever noticed that the datasource gets a name DS. 😮 I'm pretty sure the generators don't do anything with that value, considering I've never noticed it before!

@jvanbaarsen
Copy link
Contributor Author

@thedavidprice No problem I can pick up the first and latter todo. (I believe the second one has been answered now right?)

@peterp
Copy link
Contributor

peterp commented Mar 19, 2021

@peterp anything else you can think of that we should consider along with this one? Such a small change. But, you know, Prisma always has me nervous.

Not that I can think of.

@thedavidprice
Copy link
Contributor

Thanks so much, @jvanbaarsen I've updated the original tasks I outlined. Recognizing I'm being a bit particular about this one, we've had so many unexpected hiccups with Prisma along the way I've learned to be thorough.

I can take a stab at any of those three items as well — just don't want to lose track of them. Keep me posted as need.

@thedavidprice
Copy link
Contributor

Update here: not getting this into the current release v0.28. But will pick up the effort for v0.29 starting next week.

@thedavidprice
Copy link
Contributor

Update: Jeroen and I connected. He is going to be out of the loop for a while, so I am going to take lead on this PR for the final steps.

@thedavidprice thedavidprice self-assigned this Mar 26, 2021
@thedavidprice thedavidprice self-requested a review March 26, 2021 16:09
@thedavidprice
Copy link
Contributor

@dac09 I don't think this is a breaking change. Will update v0.33 notes for code mod update. TBD otherwise.

@thedavidprice thedavidprice merged commit a7e975e into redwoodjs:main May 16, 2021
@thedavidprice thedavidprice added this to the next-release milestone May 16, 2021
@jvanbaarsen jvanbaarsen deleted the rename-default-datasource branch May 17, 2021 07:46
dac09 added a commit to dac09/redwood that referenced this pull request May 19, 2021
…-codegen

* 'main' of github.com:redwoodjs/redwood: (54 commits)
  Add private methods loose explicitly (redwoodjs#2554)
  Custom `useAuth` pass through for `RedwoodApolloProvider` (redwoodjs#2455)
  Prerender all routes nested in Set with prerender prop (redwoodjs#2542)
  Upgrade eslint and prettier packages including formatting fixes (redwoodjs#2540)
  contributors updates (redwoodjs#2544)
  Rename default datasource (redwoodjs#1941)
  Add default config for Component generation (redwoodjs#1814)
  build(deps): bump core-js from 3.10.1 to 3.12.1 (redwoodjs#2481)
  upgrade babel 7.14.2 with misc babel packages (redwoodjs#2541)
  build(deps): bump http-proxy-middleware from 1.1.0 to 2.0.0 (redwoodjs#2536)
  build(deps): bump pino-pretty from 4.7.1 to 4.8.0 (redwoodjs#2534)
  build(deps): bump concurrently from 6.0.2 to 6.1.0 (redwoodjs#2533)
  build(deps-dev): bump firebase-admin from 9.7.0 to 9.8.0 (redwoodjs#2522)
  build(deps): bump esbuild-loader from 2.10.0 to 2.13.0 (redwoodjs#2518)
  build(deps): bump @graphql-tools/merge from 6.2.13 to 6.2.14 (redwoodjs#2516)
  updating minor dependency versions across packages (redwoodjs#2532)
  Add JSON headers to Function generator template (redwoodjs#2457)
  fixed firebase promises so that they can be caught (redwoodjs#2503)
  Prevent re-initialization of a Firebase app that is already initialized (redwoodjs#2504)
  build(deps-dev): bump magic-sdk from 2.7.0 to 4.3.0 (redwoodjs#2463)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants