Skip to content

Commit

Permalink
Updated chat server
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreiMartynenko committed Mar 17, 2024
1 parent 7a282d4 commit 9823385
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
22 changes: 20 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ get-deps:
go get -u google.golang.org/protobuf/cmd/protoc-gen-go
go get -u google.golang.org/grpc/cmd/protoc-gen-go-grpc


generate:
make generate-chat-api

Expand All @@ -41,4 +40,23 @@ docker-build-and-push:
# docker-build-and-push:
# docker buildx build --no-cache --platform linux/amd64 -t <REGESTRY>/test-server:v0.0.1 .
# docker login -u <USERNAME> -p <PASSWORD> <REGESTRY>
# docker push <REGESTRY>/test-server:v0.0.1
# docker push <REGESTRY>/test-server:v0.0.1

# Goose functions

include postgres/.env

LOCAL_MIGRATION_DIR=$(MIGRATION_DIR)
LOCAL_MIGRATION_DSN="host=localhost port=$(PG_PORT) dbname=$(PG_DB_NAME) user=$(PG_USER) password=$(PG_PASSWORD) sslmode=disable"

install-goose:
GOBIN=$(LOCAL_BIN) go install github.com/pressly/goose/v3/cmd/[email protected]

local-migration-status:
${LOCAL_BIN}/goose -dir ${LOCAL_MIGRATION_DIR} postgres ${LOCAL_MIGRATION_DSN} status -v

local-migration-up:
${LOCAL_BIN}/goose -dir ${LOCAL_MIGRATION_DIR} postgres ${LOCAL_MIGRATION_DSN} up -v

local-migration-down:
${LOCAL_BIN}/goose -dir ${LOCAL_MIGRATION_DIR} postgres ${LOCAL_MIGRATION_DSN} down -v
1 change: 0 additions & 1 deletion postgres/.env
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ PG_USER=chat-user
PG_PASSWORD=chat-password
PG_PORT=54321
MIGRATION_DIR=./migrations
```
9 changes: 9 additions & 0 deletions postgres/migrations/20240317023516_newmigration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-- +goose Up
-- +goose StatementBegin
SELECT 'up SQL query';
-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
SELECT 'down SQL query';
-- +goose StatementEnd

0 comments on commit 9823385

Please sign in to comment.