1
|
-- on KNB, we copy this to the file to transfer to LTER
|
2
|
-- COPY identifier TO '/tmp/knb_identifier.csv' WITH CSV HEADER;
|
3
|
-- scp to LTER
|
4
|
|
5
|
/**
|
6
|
* LTER begin here
|
7
|
*/
|
8
|
-- create the table to house the information
|
9
|
CREATE TABLE knb_identifier AS SELECT * FROM identifier WHERE false;
|
10
|
-- on LTER, we load this
|
11
|
COPY knb_identifier FROM '/tmp/knb_identifier.csv' WITH CSV HEADER;
|
12
|
-- update the guids on LTER
|
13
|
BEGIN;
|
14
|
|
15
|
UPDATE identifier lter_id
|
16
|
SET guid = knb_id.guid
|
17
|
FROM knb_identifier knb_id
|
18
|
WHERE knb_id.docid = lter_id.docid
|
19
|
AND knb_id.rev = lter_id.rev;
|
20
|
|
21
|
COMMIT;
|
22
|
|
23
|
-- clean up
|
24
|
DROP TABLE knb_identifier;
|