Commit 11ff9861 authored by Stephane Crozat's avatar Stephane Crozat

Amélioration du script d'installation de la DB

parent def15d51
......@@ -2,7 +2,7 @@
## Create user and db
sudo su postgres
sql/db_init.sh (edit path and password first)
sql/db_init.sh sql (give access to postgres user, and password first)
## Test
psql -h localhost -U apisub -d apisub
......
#!/bin/bash
sqlfiles='/home/stc/git/apisub/sql'
SQL=`dirname $0`
psql -c "DROP DATABASE IF EXISTS apisub"
psql -c "DROP USER IF EXISTS apisub"
psql -c "CREATE USER apisub WITH ENCRYPTED PASSWORD 'password'"
psql -c "CREATE DATABASE apisub WITH OWNER apisub"
psql -d apisub -f "$sqlfiles/apisub_functions.sql"
psql -d apisub -f "$sqlfiles/apisub_admin.sql"
psql -d apisub -f "$sqlfiles/apisub_tables.sql"
psql -d apisub -f "$sqlfiles/apisub_views.sql"
psql -d apisub -f "$sqlfiles/apisub_dataset.sql"
psql -d apisub -f "$SQL/apisub_functions.sql"
psql -d apisub -f "$SQL/apisub_admin.sql"
psql -d apisub -f "$SQL/apisub_tables.sql"
psql -d apisub -f "$SQL/apisub_views.sql"
psql -d apisub -f "$SQL/apisub_dataset.sql"
psql -d apisub -c "GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO apisub"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment