-
Notifications
You must be signed in to change notification settings - Fork 28
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
feat: (enhancement) Seeds and Scripts #239
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple thoughts:
- Instead of
APP_ENV
, would it be better to useNODE_ENV
so we don't have to introduce a new variable? run:script
- I'm wondering if this is worth adding since it just runs
yarn ts-node
? If we didn't haveyarn run:script {filename}
, you would runyarn ts-node prisma/scripts/{filename}
. Just trying to figure out ifrun:script
provides enough convenience to keep it. - If we do want to keep it, I think this should be renamed, probably prefixed with
db
. I think the current name suggests that I can run a script in the rootscripts
folder: https://github.com/echobind/bisonapp/tree/canary/packages/create-bison-app/template/scripts
- I'm wondering if this is worth adding since it just runs
@@ -19,6 +19,7 @@ | |||
"db:deploy": "yarn prisma migrate deploy", | |||
"db:reset": "yarn prisma migrate reset", | |||
"db:seed": "yarn prisma db seed", | |||
"db:seed:prod": "APP_ENV=production prisma db seed", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should update this to use cross-env
so it will work on Windows.
Similar to this script: https://github.com/echobind/bisonapp/blob/canary/packages/create-bison-app/template/package.json.ejs#L13
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated c0e2f58
@@ -46,6 +48,9 @@ | |||
"watch:nexus": "yarn ts-node --transpile-only --respawn --watch graphql/schema.ts,prisma/schema.prisma graphql/schema.ts", | |||
"watch:ts": "yarn dev:typecheck --watch" | |||
}, | |||
"prisma": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prisma configuration already exists here so one of them should be removed: https://github.com/echobind/bisonapp/blob/canary/packages/create-bison-app/template/package.json.ejs#L131
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overlooked, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated c0e2f58
I don't like using NODE_ENV, there are times in deployment environments where NODE_ENV is production, even though the environment may be Staging, Test, Demo, etc.
I don't think this should be prefixed with You are right, we can run |
I too do not like using NODE_ENV as I have WAY too often seen it say production when I'm not actually in production, I think it is better to be explicit even if it is an extra environment variable. These can also help with things like sentry reporting where you can split out the "environments" with tags in the same project so it has more uses there. I also like the pattern of |
- Updates types for Profile relation - Adds initial structure for dev/prod seeds
- Adds example for users - Adds Readme - Adds Example Script - Adds Script Runner - updates pacakage json - adds scripts for seed:prod and run:script
c0e2f58
to
44d1f63
Compare
Changes
https://github.com/echobind/bisonapp/blob/3f9ff1bec88dcb1cdfa696f64a09f2f456960858/packages/create-bison-app/template/prisma/SeedsAndScripts.md
Checklist