Setup environment
- 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
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.
yarn migrate:dev
Prisma ensure that the db migrates correctly after changing Prisma schema (
schema.prisma
). - Deploy migration to production.
yarn migrate:deploy
This migrates your local database.
When you've changed your schema.prisma
, in your pull request
, note that in the readme that the db should be migrated before deploying sourcecode to production.
[2021.05.13] Currently, we don't have any better solution to seamlessly deploy database when sourcecode is merged. This is because we won't let github workflow or anyother workflow to access our database for security reason. We are looking for a better option to run the migration script in Azure side.
➜ ~ 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