Update create_tables.sh

gestion millesime
This commit is contained in:
MaelREBOUX 2021-04-17 08:52:52 +02:00
parent e135c22ee0
commit 90ddfded3b

View file

@ -1,12 +1,23 @@
#!/bin/sh #!/bin/bash
millesime=2022 set -e
set -u
# argument 1 = millesime redadeg
millesime=$1
PSQL=/usr/bin/psql PSQL=/usr/bin/psql
DB_HOST=localhost DB_HOST=localhost
DB_NAME=redadeg_$millesime DB_NAME=redadeg_$millesime
DB_USER=redadeg
DB_PASSWD=redadeg
echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++"
echo " Création des tables dans la base de données $DB_NAME"
echo ""
echo ""
# suppression d'abord # suppression d'abord
psql -h $DB_HOST -U redadeg -d $DB_NAME < drop_tables.sql psql -h $DB_HOST -U redadeg -d $DB_NAME < drop_tables.sql