-
$ # Go 1.15 and below $ go get -tags 'postgres' -u github.com/golang-migrate/migrate/cmd/migrate $ # Go 1.16+ $ go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
-
$ # Go 1.17 and below go get github.com/sqlc-dev/sqlc/cmd/sqlc $ # Go 1.17+ go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
-
$ # Go 1.16 below GO111MODULE=on go get github.com/golang/mock/[email protected] $ # Go 1.16+ go install github.com/golang/mock/[email protected]
-
npm install -g dbdocs dbdocs login
-
npm install -g @dbml/cli dbml2sql --version
-
Start postgres container:
make postgresup
-
Stop postgres container:
make postgresdown
-
Create doki database:
make createdb
-
Drop doki database:
make dropdb
-
Run db migration up all versions:
make migrateup
-
Run db migration up 1 version:
make migrateup1
-
Run db migration down all versions:
make migratedown
-
Run db migration down 1 version:
make migratedown1
-
Generate schema SQL file with DBML:
make db_schema
-
Generate SQL CRUD with sqlc:
make sqlc
-
Generate DB mock with gomock:
make mock
-
Create a new db migration:
make new_migration name=<migration_name>
-
Generate DB documentation:
make db_docs
-
Access the DB documentation at this address. Password: secret
-
Run server:
make server
-
Run test:
make test