Skip to content

Latest commit

 

History

History
77 lines (52 loc) · 1.77 KB

README.md

File metadata and controls

77 lines (52 loc) · 1.77 KB

Untitled TTRPG discord bot service thingie

For now setting this up as monorepo of services but might only have one.

.devcontainer

See https://github.com/qdm12/godevcontainer/tree/master

DB

Go Definitions

sqlc generate

Migration Scripts

https://atlasgo.io/versioned/intro

Inspect database

atlas schema inspect -u "postgres://postgres:postgres@db:5432/chronicle?sslmode=disable"

Inspect schema

atlas schema inspect -u "postgres://postgres:postgres@db:5432/chronicle?search_path=public&sslmode=disable"

atlas schema apply \
  -u "postgres://postgres:postgres@db:5432/chronicle?sslmode=disable" \
  --to file://schema.sql \
  --dev-url "postgres://postgres:postgres@db:5432/chronicle?sslmode=disable"

Initialize

atlas migrate diff initial \
  --to file://schema.sql \
  --dev-url "postgres://postgres:postgres@db:5432/chronicle?sslmode=disable" \
  --format '{{ sql . "  " }}'

Update schema

atlas migrate diff add_commits \
  --to file://schema.sql \
  --dev-url "postgres://postgres:postgres@db:5432/chronicle?sslmode=disable" \
  --format '{{ sql . "  " }}'

Run all migrations on a new database

atlas migrate apply \
  --url "postgres://postgres:postgres@db:5432/chronicle?sslmode=disable"  \
  --dir "file://migrations"

Migrate from a baseline, the baseline will be ignored

atlas migrate apply \
  --url "postgres://postgres:postgres@db:5432/chronicle?sslmode=disable"  \
  --dir "file://migrations" \
  --baseline "20240731025606"

Using the free version of Atlas, we need to manually add extensions.

Right now we are adding them to the root migration (probably should make this a separate first migration).

Need to run the following after manually adding extensions.

atlas migrate hash