add new-migration Makefile target (#56)

This commit is contained in:
Adam Babik 2019-08-29 22:08:10 +02:00 committed by GitHub
parent 7d230faaa7
commit 1f260e9ec1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,3 +41,18 @@ install-dev:
generate:
go generate ./...
.PHONY: generate
new-migration:
@if [ -z "$$DIR" ]; then \
echo 'missing DIR var'; \
exit 1; \
fi
@if [ -z "$$NAME" ]; then \
echo 'missing NAME var'; \
exit 1; \
fi
mkdir -p $(DIR)
touch $(DIR)/`date +"%s"`_$(NAME).down.sql ./$(DIR)/`date +"%s"`_$(NAME).up.sql
.PHONY: create-migration