# HG changeset patch # User Michael Stanko # Date 1462370441 -7200 # Node ID d3d9cd5e18f87211276f40221192679a31503165 # Parent 18197a04b713637a24db4bdb484c6e1fbfe9352f add initialze sequences in lada_data.sql diff -r 18197a04b713 -r d3d9cd5e18f8 db_schema/lada_data.sql --- a/db_schema/lada_data.sql Wed May 04 09:13:35 2016 +0200 +++ b/db_schema/lada_data.sql Wed May 04 16:00:41 2016 +0200 @@ -1188,9 +1188,20 @@ ALTER TABLE zusatz_wert ENABLE TRIGGER ALL; --- Completed on 2016-05-04 09:10:50 CEST +SET search_path = bund, pg_catalog; + +SELECT pg_catalog.setval('kommentar_id_seq', 661, true); + +SELECT pg_catalog.setval('messung_id_seq', 1009, true); + +SELECT pg_catalog.setval('messwert_id_seq', 6471, true); + +SELECT pg_catalog.setval('ort_id_seq', 921, true); + +SELECT pg_catalog.setval('probe_id_seq', 734, true); + +SELECT pg_catalog.setval('zusatz_wert_id_seq', 30, true); -- -- PostgreSQL database dump complete -- - diff -r 18197a04b713 -r d3d9cd5e18f8 db_schema/setup-db.sh --- a/db_schema/setup-db.sh Wed May 04 09:13:35 2016 +0200 +++ b/db_schema/setup-db.sh Wed May 04 16:00:41 2016 +0200 @@ -1,6 +1,21 @@ -#!/bin/sh +#!/bin/sh -x +# SYNOPSIS +# ./setup-db.sh [-c] [ROLE_NAME] [ROLE_PW] [DB_NAME] +# -c clean - drop an existing database +# ROLE_NAME nema of db user (default = lada) +# ROLE_PW login password (default = ROLE_NAME) +# DB_NAME name of the databaes (default = ROLE_NAME) +# +# There will be used a remote database server if there exists the enviroment variable DB_SRV +# and optional DB_PORT + DIR=`dirname $0` +if [ " $1" == " -c" ] ; then + DROP_DB="true" + shift +fi + ROLE_NAME=${1:-lada} echo "DROLE_NAME = $ROLE_NAME" ROLE_PW=${2:-$ROLE_NAME} @@ -21,7 +36,7 @@ psql $DB_CONNECT_STRING --command "CREATE USER $ROLE_NAME PASSWORD '$ROLE_PW';" fi -if psql -h test-pgsql1-fr.lab.bfs.de -U postgres -l | grep -q "^ $DB_NAME " ; then +if [ "$DROP_DB" == "true" ] && psql $DB_CONNECT_STRING -l | grep -q "^ $DB_NAME " ; then echo drop db $DB_NAME psql $DB_CONNECT_STRING --command "DROP DATABASE $DB_NAME" fi