Mercurial > lada > lada-server
changeset 930:d3d9cd5e18f8
add initialze sequences in lada_data.sql
author | Michael Stanko <mstanko@bfs.de> |
---|---|
date | Wed, 04 May 2016 16:00:41 +0200 |
parents | 18197a04b713 |
children | 77ab53348966 |
files | db_schema/lada_data.sql db_schema/setup-db.sh |
diffstat | 2 files changed, 30 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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 -- -
--- 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