]> Git — Sourcephile - gargantext.git/blob - devops/postgres/create
Merge branch 'dev' into 104-dev-john-snow-nlp
[gargantext.git] / devops / postgres / create
1 #!/bin/bash
2
3 # sudo su postgres
4 # postgresql://$USER:$PW@localhost/$DB
5
6 INIFILE=$1
7
8 getter () {
9 grep $1 $INIFILE | sed "s/^.*= //"
10 }
11
12 USER=$(getter "DB_USER")
13 NAME=$(getter "DB_NAME")
14 PASS=$(getter "DB_PASS")
15 HOST=$(getter "DB_HOST")
16 PORT=$(getter "DB_PORT")
17
18
19 #psql -c "CREATE USER \"${USER}\""
20 #psql -c "ALTER USER \"${USER}\" with PASSWORD '${PW}'"
21
22 psql -c "DROP DATABASE IF EXISTS \"${NAME}\""
23 createdb "${NAME}"
24 psql "${NAME}" < extensions.sql
25 #psql "${NAME}" < schema.sql
26
27
28 #../../bin/psql ../../gargantext.ini < gargandb.dump
29
30 psql -c "ALTER DATABASE \"${NAME}\" OWNER to \"${USER}\""
31
32