Omaha #3454 Adding sequences to tables in events schema

Former-commit-id: 39f00d60ae [formerly 9799cba1a2c525190d297f7e355cda29f1e98ee7]
Former-commit-id: 4af35d83f8
This commit is contained in:
Benjamin Phillippe 2014-10-28 10:30:08 -05:00
parent 2626b9ff33
commit acea99bb5e

View file

@ -0,0 +1,25 @@
#!/bin/bash
STATS_MAX_VAL=$(psql -U awips -d metadata -t -c "select max(id)+1 from events.stats;")
NOTIFICATION_MAX_VAL=$(psql -U awips -d metadata -t -c "select max(id)+1 from events.notification;")
AGGREGATE_MAX_VAL=$(psql -U awips -d metadata -t -c "select max(id)+1 from events.aggregate;")
if [ -z $STATS_MAX_VAL ]
then
STATS_MAX_VAL=1
fi
if [ -z $NOTIFICATION_MAX_VAL ]
then
NOTIFICATION_MAX_VAL=1
fi
if [ -z $AGGREGATE_MAX_VAL ]
then
AGGREGATE_MAX_VAL=1
fi
psql -U awips -d metadata -c \
"CREATE SEQUENCE stats_seq START WITH $STATS_MAX_VAL; \
CREATE SEQUENCE notification_seq START WITH $NOTIFICATION_MAX_VAL; \
CREATE SEQUENCE aggregate_seq START WITH $NOTIFICATION_MAX_VAL;"