From d43f46746a73952c7ecf9f25247c01b298445bf6 Mon Sep 17 00:00:00 2001 From: Christian Gendreau Date: Thu, 11 Sep 2014 15:45:00 -0400 Subject: [PATCH] fixed https://github.com/WingLongitude/liger-data-access/issues/6 --- .../migrations/occurrence/2.10.0_to_2.11.0.sql | 4 +++- .../occurrence/model/ResourceModel.java | 16 +++++++++------- .../occurrence/create_occurrence_tables.sql | 2 +- .../occurrence/dao/ResourceDAOTest.java | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/script/migrations/occurrence/2.10.0_to_2.11.0.sql b/script/migrations/occurrence/2.10.0_to_2.11.0.sql index 7a71480..126fb0e 100644 --- a/script/migrations/occurrence/2.10.0_to_2.11.0.sql +++ b/script/migrations/occurrence/2.10.0_to_2.11.0.sql @@ -4,4 +4,6 @@ ALTER TABLE occurrence_extension ADD COLUMN sourcefileid character varying(50); ALTER TABLE occurrence_extension ADD COLUMN resource_uuid character varying(50); --This table should be empty but if not please, transfer the content of 'id' into 'auto_id' and then delete the 'id' column -ALTER TABLE occurrence_extension DROP COLUMN IF EXISTS id; \ No newline at end of file +ALTER TABLE occurrence_extension DROP COLUMN IF EXISTS id; + +ALTER TABLE resource_management RENAME key TO resource_uuid; diff --git a/src/main/java/net/canadensys/dataportal/occurrence/model/ResourceModel.java b/src/main/java/net/canadensys/dataportal/occurrence/model/ResourceModel.java index fdf3f2b..9f15e87 100644 --- a/src/main/java/net/canadensys/dataportal/occurrence/model/ResourceModel.java +++ b/src/main/java/net/canadensys/dataportal/occurrence/model/ResourceModel.java @@ -20,7 +20,7 @@ public class ResourceModel { @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "resource_management_id_seq") private Integer id; private String name; - private String key; + private String resource_uuid; private String archive_url; private String sourcefileid; @@ -31,18 +31,20 @@ public void setId(Integer id) { this.id = id; } + public String getResource_uuid() { + return resource_uuid; + } + public void setResource_uuid(String resource_uuid) { + this.resource_uuid = resource_uuid; + } + public String getName() { return name; } public void setName(String name) { this.name = name; } - public String getKey() { - return key; - } - public void setKey(String key) { - this.key = key; - } + public String getArchive_url() { return archive_url; } diff --git a/src/main/resources/script/occurrence/create_occurrence_tables.sql b/src/main/resources/script/occurrence/create_occurrence_tables.sql index 81c0d5e..98ca440 100644 --- a/src/main/resources/script/occurrence/create_occurrence_tables.sql +++ b/src/main/resources/script/occurrence/create_occurrence_tables.sql @@ -283,7 +283,7 @@ CREATE TABLE IF NOT EXISTS resource_management id integer DEFAULT nextval('resource_management_id_seq') NOT NULL, sourcefileid character varying(50), name character varying(255), - key character varying(36), + resource_uuid character varying(36), archive_url character varying(255), CONSTRAINT resource_management_pkey PRIMARY KEY ( id ), CONSTRAINT resource_management_source_file_id_key UNIQUE (sourcefileid) diff --git a/src/test/java/net/canadensys/dataportal/occurrence/dao/ResourceDAOTest.java b/src/test/java/net/canadensys/dataportal/occurrence/dao/ResourceDAOTest.java index 7403404..8b5110d 100644 --- a/src/test/java/net/canadensys/dataportal/occurrence/dao/ResourceDAOTest.java +++ b/src/test/java/net/canadensys/dataportal/occurrence/dao/ResourceDAOTest.java @@ -31,7 +31,7 @@ public void testSaveAndLoad(){ ResourceModel testModel = new ResourceModel(); testModel.setSourcefileid("test_sourcefileid"); - testModel.setKey("12345"); + testModel.setResource_uuid("12345"); assertTrue(resourceDAO.save(testModel)); int id = testModel.getId();