NCEAS / metacat

Data repository software that helps researchers preserve, share, and discover data
https://knb.ecoinformatics.org/software/metacat
GNU General Public License v2.0
26 stars 12 forks source link

Store more checksums of objects into Metacat #1943

Open taojing2002 opened 2 months ago

taojing2002 commented 2 months ago

We need a database table to store more checksums which come from Hashstore.

Table name: checksums Fields:

guid   text,
checksum VARCHAR(512),
checksum_algorithm VARCHAR(250)

The guid field is a foreign key of the guid field in the systemmetadata table.

taojing2002 commented 2 months ago

The script is here. If you have any concerns, please let me know.

/*
 * Create the checksums table
 */
 CREATE SEQUENCE checksums_id_seq;
 CREATE TABLE checksums (
  checksum_id INT8 default nextval('checksums_id_seq'),
  guid TEXT NOT NULL,  -- the globally unique string identifier of the object that the system metadata describes
  checksum VARCHAR(512) NOT NULL, -- the checksum of the doc using the given algorithm (see below)
  checksum_algorithm VARCHAR(250) NOT NULL, -- the algorithm used to calculate the checksum
  CONSTRAINT checksums_fk
    FOREIGN KEY (guid) REFERENCES systemMetadata DEFERRABLE
 );
 CREATE INDEX checksums_guid on checksums(guid);
 CREATE INDEX checksums_checksum on checksums(checksum);
 CREATE INDEX checksums_checksum_algorithm on checksums(checksum_algorithm);