Skip to content

Commit

Permalink
#2438 combine upgrade sql scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sekmiller committed May 14, 2018
1 parent fa3a55f commit 3575b0d
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 49 deletions.
51 changes: 50 additions & 1 deletion scripts/database/upgrades/upgrade_v4.8.6_to_v4.9.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,53 @@ ALTER TABLE externaltool ALTER COLUMN type SET NOT NULL;
UPDATE guestbookresponse SET downloadtype = 'TwoRavens' WHERE downloadtype = 'Explore';
ALTER TABLE filemetadata ADD COLUMN prov_freeform text;
-- ALTER TABLE datafile ADD COLUMN prov_cplid int;
ALTER TABLE datafile ADD COLUMN prov_entityname text;
ALTER TABLE datafile ADD COLUMN prov_entityname text;

-- Moves DOI fields from Dataset to DVObject
-- so that Identifiers may be added to DataFiles

ALTER TABLE dvobject ADD COLUMN
authority character varying(255),
ADD COLUMN doiseparator character varying(255),
ADD COLUMN globalidcreatetime timestamp without time zone,
ADD COLUMN identifierRegistered boolean,
ADD COLUMN identifier character varying(255),
ADD COLUMN protocol character varying(255);


UPDATE dvobject
SET authority=(SELECT dataset.authority
FROM dataset
WHERE dataset.id=dvobject.id AND dvobject.dtype='Dataset') where dvobject.dtype='Dataset';

UPDATE dvobject
SET doiseparator=(SELECT dataset.doiseparator
FROM dataset
WHERE dataset.id=dvobject.id AND dvobject.dtype='Dataset') where dvobject.dtype='Dataset';

UPDATE dvobject
SET globalidcreatetime=(SELECT dataset.globalidcreatetime
FROM dataset
WHERE dataset.id=dvobject.id AND dvobject.dtype='Dataset') where dvobject.dtype='Dataset';

UPDATE dvobject
SET identifierRegistered= true where globalidcreatetime is not null;

UPDATE dvobject
SET identifier=(SELECT dataset.identifier
FROM dataset
WHERE dataset.id=dvobject.id AND dvobject.dtype='Dataset') where dvobject.dtype='Dataset';

UPDATE dvobject
SET protocol=(SELECT dataset.protocol
FROM dataset
WHERE dataset.id=dvobject.id AND dvobject.dtype='Dataset') where dvobject.dtype='Dataset';

ALTER TABLE dataset ALTER identifier DROP NOT NULL;

ALTER TABLE dataset DROP COLUMN authority;
ALTER TABLE dataset DROP COLUMN doiseparator;
ALTER TABLE dataset DROP COLUMN globalidcreatetime;
ALTER TABLE dataset DROP COLUMN identifier;
ALTER TABLE dataset DROP COLUMN protocol;

48 changes: 0 additions & 48 deletions scripts/database/upgrades/upgrade_v4.8.6_to_v4.9.sql

This file was deleted.

0 comments on commit 3575b0d

Please sign in to comment.