c
An api
Connecting to Postgres
Spinning up Containers
> docker-compose up --build
Connecting to PG container
> docker exec -it $(docker ps --filter name=pg --format "{{.Names}}") /bin/bash
Connecting to DB
> psql -U postgres -W
PostGres Commands
List Dbs
Connect to db
List tables in db
Cleaning up
remove all containers
> docker container rm -f $(docker container ps -a -q)
clear volumes
> docker volume prune -f
DB migrations without stopping the services
migrate db down
go run cmd/dbmigrate/main.go \
-migrate=down \
-dbname=compliagotest \
-dbhost=localhost
now bring it back up
go run cmd/dbmigrate/main.go \
-migrate=up \
-dbname=compliagotest \
-dbhost=localhost