Skip to content

Ingest DB Updates for File tracking

In order to support tracking of Files which belong to a Bag, we will need to add a few tables and move a few others around. As we will also want to track Fixity belonging to a File, we will generalize the current Fixity table and create a new method for validating replications based off of a File instead of the Fixity. In addition we will be removing deprecated fields from the Bag table which are no longer in use.

To support Ace TokenStores we can add a discriminator column to the File table which can use in a join or other operations when trying to determine the type of storage used.

A summary of the changes are as follows:

  • Bag
    • Remove required_replications
  • File New
  id bigint,
  created_at timestamp,
  filename text,
  size bigint,
  bag_id bigint,
  data_type varchar(15) # e.g. for discriminator column
  • AceToken
    • Remove filename
    • Add file_id
  • Fixity
    • Remove storage_id and related constraints
  • StagingStorage
    • Add bag_id
    • Add file_id
  • File Fixity Join Table New
    • Add file_id, fixity_id
    • Need to figure out constraint for file -> fixity_algorithm
      • Opt. 1: PrePersist
      • Opt. 2: Redundant info in FF table (+algorithm)
      • Opt. 3: Trigger in db

Migrations are needed for:

  • StagingStorage
    • bag_id from bag_storage.bag_id and token_storage.bag_id
    • file_id from ??
  • File
    • filename from ace_token.filename
  • FileFixity Join Table
  • BagStorage and TokenStorage Join Table
    • Drop
Edited by Ghost User