From 9913dfa406881b74c3faecdadd94589ec39b7375 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 19 Feb 2015 11:10:27 -0500 Subject: [PATCH] JBAS-481 update sequences for sample data When cherry-picking data to insert for various large tables (bibs, auths, copies, etc.), update the ID sequence for each table to match the maximum ID used, so that the correct sequence values may be used on future inserts. Signed-off-by: Bill Erickson --- KCLS/sql/dev-data/create-dev-db.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/KCLS/sql/dev-data/create-dev-db.sh b/KCLS/sql/dev-data/create-dev-db.sh index 0e1bcf7a09..a2f4a5f2d6 100755 --- a/KCLS/sql/dev-data/create-dev-db.sh +++ b/KCLS/sql/dev-data/create-dev-db.sh @@ -23,6 +23,8 @@ echo "Loading org unit settings..." echo " BEGIN; COPY actor.org_unit_setting FROM '$DIR/kcls-dev-aous.sql'; +SELECT SETVAL('actor.org_unit_setting_id_seq', + (SELECT MAX(id) FROM actor.org_unit_setting)); COMMIT;" | $PSQL echo "Loading sample records..." @@ -30,6 +32,8 @@ echo " BEGIN; COPY biblio.record_entry FROM '$DIR/kcls-dev-recs.sql'; UPDATE biblio.record_entry SET creator = 1, editor = 1; +SELECT SETVAL('biblio.record_entry_id_seq', + (SELECT MAX(id) FROM biblio.record_entry)); COMMIT;" | $PSQL echo "Loading sample call numbers..." @@ -37,6 +41,8 @@ echo " BEGIN; COPY asset.call_number FROM '$DIR/kcls-dev-cns.sql'; UPDATE asset.call_number SET creator = 1, editor = 1; +SELECT SETVAL('asset.call_number_id_seq', + (SELECT MAX(id) FROM asset.call_number)); COMMIT;" | $PSQL echo "Loading sample copies..." @@ -44,6 +50,7 @@ echo " BEGIN; COPY asset.copy FROM '$DIR/kcls-dev-copies.sql'; UPDATE asset.copy SET creator = 1, editor = 1; +SELECT SETVAL('asset.copy_id_seq', (SELECT MAX(id) FROM asset.copy)); COMMIT;" | $PSQL echo "Loading sample authority records..." @@ -51,6 +58,8 @@ echo " BEGIN; COPY authority.record_entry FROM '$DIR/kcls-dev-auths.sql'; UPDATE authority.record_entry SET creator = 1, editor = 1; +SELECT SETVAL('authority.record_entry_id_seq', + (SELECT MAX(id) FROM authority.record_entry)); COMMIT;" | $PSQL -- 2.11.0