Merge pull request 'add goose' (#7) from smm_add_goose into master
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Reviewed-on: #7
This commit is contained in:
commit
0033970c30
|
@ -31,10 +31,14 @@ steps:
|
|||
- smm_core
|
||||
- docker-compose.yml
|
||||
- Dockerfile
|
||||
- migrations
|
||||
rm: true
|
||||
|
||||
- name: deploy
|
||||
image: appleboy/drone-ssh
|
||||
environment:
|
||||
DB_PASS:
|
||||
from_secret: db_pass
|
||||
settings:
|
||||
host:
|
||||
from_secret: server_ip
|
||||
|
@ -47,6 +51,8 @@ steps:
|
|||
command_timeout: 50s
|
||||
script:
|
||||
- cd deploys/smm_core
|
||||
- export PATH=$PATH:/usr/local/go/bin:/$HOME/go/bin
|
||||
- goose -allow-missing -dir ./migrations postgres "user=crab password=$${DB_PASS} dbname=smm-core host=localhost port=5432 sslmode=disable" up
|
||||
- docker-compose up -d --build --force-recreate
|
||||
|
||||
trigger:
|
||||
|
|
11
Makefile
11
Makefile
|
@ -1,6 +1,17 @@
|
|||
LOCAL_BIN := $(CURDIR)/bin
|
||||
PATH := $(LOCAL_BIN):$(PATH)
|
||||
|
||||
ifeq (local-migrations-create,$(firstword $(MAKECMDGOALS)))
|
||||
migrationName := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
|
||||
$(eval $(migrationName):;@:)
|
||||
endif
|
||||
|
||||
local-migrate-up:
|
||||
@goose -allow-missing -dir ./migrations postgres "user=crab dbname=smm-core host=localhost port=5432 sslmode=disable" up
|
||||
|
||||
local-migrations-create:
|
||||
@goose -dir ./migrations postgres "user=crab dbname=smm-core host=localhost port=5432 sslmode=disable" create "${migrationName}" sql
|
||||
|
||||
local-go-init: export GOBIN := $(LOCAL_BIN)
|
||||
local-go-init:
|
||||
go get github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
-- +goose Up
|
||||
-- +goose StatementBegin
|
||||
CREATE TABLE IF NOT EXISTS "user" (
|
||||
id SERIAL PRIMARY KEY,
|
||||
chat_id TEXT NOT NULL
|
||||
);
|
||||
-- +goose StatementEnd
|
||||
|
||||
-- +goose Down
|
||||
-- +goose StatementBegin
|
||||
DROP TABLE IF EXISTS "user";
|
||||
-- +goose StatementEnd
|
Loading…
Reference in New Issue