-
Notifications
You must be signed in to change notification settings - Fork 3
/
configure.sh
executable file
·39 lines (31 loc) · 1 KB
/
configure.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
pgconn="postgres://$PG_USERNAME:$PG_PWD@$PG_ADDR/$PG_DB?sslmode=disable"
PSQL=psql
PSQL_ARGS="-h $PG_HOST -d $PG_DB -U $PG_USERNAME -p $PG_PORT -q -A -X"
case "$1" in
"migrate-pg-new" )
echo "Postgres selected"
echo "Please enter name of new migrate file:"
read name
echo "Entered name: $name"
migrate create -ext sql -dir ./migrations/postgres -seq $name
;;
"migrate-pg-up" )
echo
echo "Migrate postgres"
echo "Current version:"
migrate -database $pgconn -path ./migrations/postgres version
echo "Up:"
migrate -database $pgconn -path ./migrations/postgres up
echo "Postres migrations DONE."
;;
* | "--help" )
if [ "$1" != "--help" ]; then
echo "Command '$1' does not exist."
echo
fi
echo "Commands:"
echo "- [migrate-pg-new] - Создание нового файла миграций для Postgtes."
echo "- [migrate-pg-up] - Выполнение обновления миграций для Posrgres"
;;
esac