tree: d1d2286d7a500e3360037a6b33410442dca03bb4 [path history] [tgz]
  1. Dockerfile
  2. Dockerfile.test
  3. main.go
  4. Makefile
  5. README.md
  6. schema.sql
  7. sqlc.yaml
cmd/relui/README.md

golang.org/x/build/cmd/relui

               ▀▀█             ▀
  ▄ ▄▄   ▄▄▄     █    ▄   ▄  ▄▄▄
  █▀  ▀ █▀  █    █    █   █    █
  █     █▀▀▀▀    █    █   █    █
  █     ▀█▄▄▀    ▀▄▄  ▀▄▄▀█  ▄▄█▄▄

relui is a web interface for managing the release process of Go.

Development

Run the command with the appropriate libpq-style environment variables set.

PGHOST=localhost PGDATABASE=relui-dev PGUSER=postgres go run ./

Alternatively, using docker:

make dev

Updating Queries

Create or edit SQL files in internal/relui/queries. After editing the query, run sqlc generate in this directory. The internal/relui/db package contains the generated code.

See sqlc documentation for further details.

Creating & Running Database Migrations

Migrations are managed using github.com/golang-migrate/migrate.

Creating

go run -tags pgx github.com/golang-migrate/migrate/v4/cmd/migrate \
  create \
  --dir ../../internal/relui/migrations/ \
  -ext sql \
  my_fancy_migration
# alternatively, install the migrate command with pgx support.

Running

Migrations are automatically ran on application launch. Updating schema.sql, as documented below, will also run migrations. “Down” migrations are not automatically run and must be manually invoked in psql.

cmd/relui/schema.sql

schema.sql is updated by running the following command in this directory:

make schema.sql

Testing

Run go test with the appropriate libpq-style environment variables set. If the database connection fails, database integration tests will be skipped. If PGDATABASE is unset, relui-test is created, migrated, and used by default.

PGHOST=localhost PGUSER=postgres go test -v ./... ../../internal/relui/...

Alternatively, using docker:

make test