-
Work Task
-
Resolution: Done
-
Major
-
None
-
None
When an update is done on a database restored from the CADIS release site, the following error occurs:
/Users/hannah/Documents/workspace/gateway-webapp/Ant/liquibase-tasks.ant.xml:145: liquibase.exception.MigrationFailedException: Migration failed for change set /liquibase/update/changesets/20100112-SGF-1124.xml::20100112-SGF-1124::ncw:
Reason: liquibase.exception.JDBCException: Error executing SQL ALTER TABLE metadata.logical_file ALTER COLUMN lineage_id SET NOT NULL:
Caused By: Error executing SQL ALTER TABLE metadata.logical_file ALTER COLUMN lineage_id SET NOT NULL:
Caused By: ERROR: column "lineage_id" contains null values
This changeset sets the lineage_id in the following fashion:
<sql>
UPDATE metadata.logical_file sourcefile SET lineage_id =
(SELECT identifier FROM metadata.persistent_identifier ident where ident.resource_id = sourcefile.id and ident.type_id=0);
</sql>
The empty files added to CADIS as a search workaround only added logical files, not persistent IDs for those logical files so those particular files will not create a lineage_id, causing the error. Persistent IDs will have to be added for all the empty files added for the search workaround as well as logic to add persistent IDs in the metadata editor where a placeholder file is added when a new dataset is created.
/Users/hannah/Documents/workspace/gateway-webapp/Ant/liquibase-tasks.ant.xml:145: liquibase.exception.MigrationFailedException: Migration failed for change set /liquibase/update/changesets/20100112-SGF-1124.xml::20100112-SGF-1124::ncw:
Reason: liquibase.exception.JDBCException: Error executing SQL ALTER TABLE metadata.logical_file ALTER COLUMN lineage_id SET NOT NULL:
Caused By: Error executing SQL ALTER TABLE metadata.logical_file ALTER COLUMN lineage_id SET NOT NULL:
Caused By: ERROR: column "lineage_id" contains null values
This changeset sets the lineage_id in the following fashion:
<sql>
UPDATE metadata.logical_file sourcefile SET lineage_id =
(SELECT identifier FROM metadata.persistent_identifier ident where ident.resource_id = sourcefile.id and ident.type_id=0);
</sql>
The empty files added to CADIS as a search workaround only added logical files, not persistent IDs for those logical files so those particular files will not create a lineage_id, causing the error. Persistent IDs will have to be added for all the empty files added for the search workaround as well as logic to add persistent IDs in the metadata editor where a placeholder file is added when a new dataset is created.