Database migration for BBJ's Core System written in raw PostgreSQL using Goose database migration tool.
- Go 1.16+ - https://go.dev/ (Optional)
- Goose - https://pressly.github.io/goose/installation
- PostgreSQL / Other RDBMS (Not Tested)
- Podman / Docker (Not Tested)
- Clone the repository
- Change directory to
core-migration - Run
make runon the root directory - Wait untill PostgreSQL is loaded and ready to receive connection
Ctrl + Cand runmake migrateto populate your database
- Indentation: Use a strict 4-space indentation pattern (configure your tabs).
- Table Naming: All table names must be plural (e.g., users, reimburses, job_slots).
- Foreign Keys: Columns referencing external parent rows must be singular followed by _id (e.g., user_id, job_slot_id).
- ENUM Layouts: Custom database type tokens/enums must be singular (e.g., user_role, sponsor_variant).
- OS: Fedora, Debian
- Containers: Podman
- Text Editor: Zed Editor
- Local port forwarding:
ssh -L - Run goose from local machine to vps:
goose -dir migrations postgres "postgres://username:password@127.0.0.1:port/dbname?sslmode=disable" up - Close port forwarding:
Ctrl + C
- Run
make runto initialize PostgreSQL container, wait until psql is initialized - Run
make migrateto migrate the files frommigrations/directory
- Run
go build ./cmd/seed - Then run the binary
./seed
By BBJ Team