Boilerplate for typescript apollo server using prisma and nexus (AKA Prisma 2).
- cp
./dotenv/test.env
./dotenv/.env
- Include
DATABASE_URL
DATABASE_URL="postgresql://<user>:<password>@<url>:5432/postgres?schema=<scheme>"
Note that you should change appropriate values in
user
,password
,url
,scheme
fields. Or you can even use other database. More about connection urls - Running
yarn start
oryarn dev
will loadenv
fromdotenv/.env
.
yarn generate
- Change models in
schema.prisma
.Note that
prisma/migrations
dir is included in.gitignore
in this repo but it should not be ignored in production. - Run migration script.
Note that this should be targeting the production database. Locally, you can just run
yarn db-push
.yarn migrate
- Deploy migration to production.
Note you may want to run
yarn migrate:dev
beforhand to test your migration.yarn migrate:deploy
➜ ~ createuser --interactive --pwprompt
Enter name of role to add: test
Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) y