- Create and manage account
- Owner
- Balance
- Currency
- Record all balance changes for each account
- Create an account entry for each change for each account
- Money transfer transaction
- Perform money transfer between 2 accounts consistently within a transaction
- Install
docker for desktop
I am using docker through ssh. You can remove ssh part in the Makefile if you want use your Docker desktop
This project use this binaries:
brew
,go
,go-migrate
,sqlc
- Execute
make check-required-bins
to check the required binaries need for this project - Execute
make mac
for mac user to install all deps automatically
make help # Show all commands
- Execute
make docker-postgres
to get and configure a ready postgres docker container - Execute
make createdb
to create thesimple_bank
database - Execute
make logdb
to see database logs - Execute
make migrateup
to setup tables and initial database state - If required,
- Execute
make dropdb
to drop database - Execute
make migratedown
to migrate or revert database state to a previous version
- Execute
Check others commands using make help
- Design DB schema using dbdiagram.io
- Export the queries from
https://dbdiagram.io/d/63dbb531296d97641d7dfc31
- Export the queries from
- Save and share DB diagram within the team
- Generate SQL code to create database in a target database engine i.e. postgres
- Execute
migrate -version
to verify that thegolang-migrate
has been installed - Execute
migrate create -ext sql -dir db/migration -seq init_schema
to generate migration files*.up.sql
is used to migrate up to a new version usingmigrate up
*.down.sql
is used to migrate down to an older version usingmigrate down
- Execute
make migrateup
to migrate data upwards to a new version - Execute
make migratedown
to revert migration to a previous version - Manage migrations in future with
migration up/down
commands
- Execute
make sqlc
to auto generate CRUD functionalities - Execute
make mock
to generate mock DB
pq
A pure Go postgres driver for Go's database/sql packageTestify
Thou Shalt Write Tests
Execute make test