Skip to content

clickclackers/typedash-v2

Repository files navigation

typedash

Netlify Status

Production URL: https://typedash.songyang.dev

Getting started

Ensure you have Docker installed, it is used for the backend.

  1. make install (installs all system dependencies and tools)
  2. Add export PATH="$HOME/go/bin:$PATH" to ~/.zshrc for pre-commit and Go tools
  3. make db-migrate
  4. make db-seed
  5. make dev

Push database schema changes

We use go-migrate CLI to generate migrations, and sqlc to generate type-safe queries from the migrations. Manual is found at migrate -help

To update schema

  1. migrate create -ext sql -dir server/db/migrations -seq <migration_name>
  2. Write up and down migrations, ensuring idempotency (refer to the tutorial)
  3. make sqlc to generate queries
  4. make db-migrate to run migrations

To update queries

  1. Update db/queries/*
  2. make sqlc to generate queries
  3. make db-migrate to run migrations

To seed prod db

docker compose -f ~/typedash/compose.prod.yaml exec -T db psql -U typedash -d typedash < ~/typedash/db/seed.sql