Skip to content
This repository has been archived by the owner on May 7, 2023. It is now read-only.

Latest commit

 

History

History

server

HackaTalk (Server)

Specification

Diagram

Setup environment

  1. cp ./dotenv/test.env ./dotenv/.env
  2. 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

  3. Running yarn start will load env from dotenv/.env.

Generate Prisma Client and Nexus

yarn generate

Migration

Init migration

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

  2. Run migration script.
    yarn migrate:dev
    

    Prisma ensure that the db migrates correctly after changing Prisma schema (schema.prisma).

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

Create test user

~ 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