Skip to content

Quick Tutorials

Song Zheng edited this page Jan 30, 2022 · 7 revisions

Introduction

This page serves as a list of code samples to help you navigate certain concepts. When a pull request introduces a new concept, add it to this list!

Test

  • Mocking - sometimes you may not want libraries to be run during your tests. To auto mock out libraries, you just have to put the module-name.js into the __mocks__ folder. code sample for auto mocking.

Database

Prisma

Prisma Docs

  • If you want to create, update, or destroy a table, here are the steps:
    • Edit prisma.schema file
    • Run prisma migrate dev on the terminal.
    • Sample PR for adding a table, Sample PR for updating a table

Postgres

  • Dump (backups): pg_dump -h hostIP databaseName > ~/feb28-2022-c0d3_prod.sql
  • Connect: psql -U dbuser -h hostIP databaseName

Sequelize

Promise.all vs Includes - When implementing session query, we had to decide between:

We all thought using 1 queries would be the fastest, so it turned out to be the slowest.

Clone this wiki locally