diff --git a/app/controllers/hyrax/conference_items_controller.rb b/app/controllers/hyrax/conference_items_controller.rb index 3fbdfacf..eeb7ddc4 100644 --- a/app/controllers/hyrax/conference_items_controller.rb +++ b/app/controllers/hyrax/conference_items_controller.rb @@ -14,7 +14,7 @@ class ConferenceItemsController < ApplicationController # Use a Valkyrie aware form service to generate Valkyrie::ChangeSet style # forms. self.work_form_service = Hyrax::FormFactory.new - + # Use this line if you want to use a custom presenter self.show_presenter = Hyrax::ConferenceItemPresenter end diff --git a/app/indexers/hyrax/file_set_indexer_decorator.rb b/app/indexers/hyrax/file_set_indexer_decorator.rb index a241cb70..ecd94f39 100644 --- a/app/indexers/hyrax/file_set_indexer_decorator.rb +++ b/app/indexers/hyrax/file_set_indexer_decorator.rb @@ -16,17 +16,17 @@ def generate_solr_document private - def pdf_text - text = IO.popen(['pdftotext', '-', '-'], 'r+b') do |pdftotext| - pdftotext.write(object.original_file.content) - pdftotext.close_write - pdftotext.read - end - - text.tr("\n", ' ') - .squeeze(' ') - .encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '') # remove non-UTF-8 characters + def pdf_text + text = IO.popen(['pdftotext', '-', '-'], 'r+b') do |pdftotext| + pdftotext.write(object.original_file.content) + pdftotext.close_write + pdftotext.read end + + text.tr("\n", ' ') + .squeeze(' ') + .encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: '') # remove non-UTF-8 characters + end end end diff --git a/app/jobs/application_job_decorator.rb b/app/jobs/application_job_decorator.rb index dc1610bc..867db662 100644 --- a/app/jobs/application_job_decorator.rb +++ b/app/jobs/application_job_decorator.rb @@ -45,7 +45,6 @@ module ApplicationJobDecorator end end - def redirect_priority_jobs return :ingest unless priority_tenants_array.include? tenant_name PRIORITY_QUEUE_NAME diff --git a/app/models/bulkrax/oai_adventist_qdc_entry.rb b/app/models/bulkrax/oai_adventist_qdc_entry.rb index 307c5969..654a89e1 100644 --- a/app/models/bulkrax/oai_adventist_qdc_entry.rb +++ b/app/models/bulkrax/oai_adventist_qdc_entry.rb @@ -12,7 +12,7 @@ def field_to(field) super(field) end - # Note: We're overriding the setting of the thumbnail_url as per prior implementations in + # NOTE: We're overriding the setting of the thumbnail_url as per prior implementations in # Adventist's code-base. def add_thumbnail_url true diff --git a/app/models/bulkrax/oai_adventist_set_entry.rb b/app/models/bulkrax/oai_adventist_set_entry.rb index e6f51943..6caeae57 100644 --- a/app/models/bulkrax/oai_adventist_set_entry.rb +++ b/app/models/bulkrax/oai_adventist_set_entry.rb @@ -18,7 +18,7 @@ def build_metadata end end - # Note: as of the time of writing this comment, the Bulkrax::OaiSetEntry does not handle + # NOTE: as of the time of writing this comment, the Bulkrax::OaiSetEntry does not handle # metadata nor does it do anything with visibility, rights statements, or admin sets. This is # added as an override that I'd love to see "removed" add_visibility diff --git a/app/models/generic_work_decorator.rb b/app/models/generic_work_decorator.rb index eccf5bce..d097711f 100644 --- a/app/models/generic_work_decorator.rb +++ b/app/models/generic_work_decorator.rb @@ -15,7 +15,7 @@ derivative_service_plugins: [ IiifPrint::TextExtractionDerivativeService ] -)) + )) # This must come after the properties because it finalizes the metadata # schema (by adding accepts_nested_attributes) diff --git a/app/models/image_decorator.rb b/app/models/image_decorator.rb index 614c997a..8e97c4e2 100644 --- a/app/models/image_decorator.rb +++ b/app/models/image_decorator.rb @@ -15,7 +15,7 @@ derivative_service_plugins: [ IiifPrint::TextExtractionDerivativeService ] -)) + )) # This must come after the properties because it finalizes the metadata # schema (by adding accepts_nested_attributes) diff --git a/app/parsers/bulkrax/adventist_csv_parser_decorator.rb b/app/parsers/bulkrax/adventist_csv_parser_decorator.rb index 71d662f3..73b6c37f 100644 --- a/app/parsers/bulkrax/adventist_csv_parser_decorator.rb +++ b/app/parsers/bulkrax/adventist_csv_parser_decorator.rb @@ -14,35 +14,35 @@ def missing_elements(record) private - def extract_keys_from_record(record) - keys = record.reject { |_, v| v.blank? } - .keys - .compact - .uniq - .map(&:to_s) - .map(&:strip) - .map { |k| Bulkrax.normalize_string(k) } - keys_without_numbers(keys) - end + def extract_keys_from_record(record) + keys = record.reject { |_, v| v.blank? } + .keys + .compact + .uniq + .map(&:to_s) + .map(&:strip) + .map { |k| Bulkrax.normalize_string(k) } + keys_without_numbers(keys) + end - def collect_keys_from_mapping(keys_from_record) - keys = [] - importerexporter.mapping.stringify_keys.each do |k, v| - Array.wrap(v['from']).each do |vf| - vf_str = Bulkrax.normalize_string(vf.to_s.strip) - keys << k.to_s.strip if keys_from_record.include?(vf_str) - end + def collect_keys_from_mapping(keys_from_record) + keys = [] + importerexporter.mapping.stringify_keys.each do |k, v| + Array.wrap(v['from']).each do |vf| + vf_str = Bulkrax.normalize_string(vf.to_s.strip) + keys << k.to_s.strip if keys_from_record.include?(vf_str) end - keys.uniq.map(&:to_s).map(&:strip).map { |k| Bulkrax.normalize_string(k) } end + keys.uniq.map(&:to_s).map(&:strip).map { |k| Bulkrax.normalize_string(k) } + end - def normalize_elements(elements) - elements.map(&:to_s).map(&:strip).map { |k| Bulkrax.normalize_string(k) } - end + def normalize_elements(elements) + elements.map(&:to_s).map(&:strip).map { |k| Bulkrax.normalize_string(k) } + end - def identify_missing_elements(required_elements, keys) - required_elements - keys - end + def identify_missing_elements(required_elements, keys) + required_elements - keys + end end end diff --git a/app/presenters/adl/iiif_manifest_presenter_factory_decorator.rb b/app/presenters/adl/iiif_manifest_presenter_factory_decorator.rb index b4b3f457..5afadf4e 100644 --- a/app/presenters/adl/iiif_manifest_presenter_factory_decorator.rb +++ b/app/presenters/adl/iiif_manifest_presenter_factory_decorator.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# OVERRIDE IiifPrint v3.0.1 to check has_model instead of hydra_model. +# OVERRIDE IiifPrint v3.0.1 to check has_model instead of hydra_model. # Hyrax.config.curation_concerns does not include "Resource" module Adl diff --git a/app/presenters/hyku/work_show_presenter_decorator.rb b/app/presenters/hyku/work_show_presenter_decorator.rb index 55482817..921d1c72 100644 --- a/app/presenters/hyku/work_show_presenter_decorator.rb +++ b/app/presenters/hyku/work_show_presenter_decorator.rb @@ -31,11 +31,12 @@ def pdf_extension? def viewer? iiif_viewer? || video_embed_viewer? || pdf_viewer? end + private - def model_klass - model_name.instance_variable_get(:@klass) - end + def model_klass + model_name.instance_variable_get(:@klass) + end end end diff --git a/app/renderers/publication_status_renderer.rb b/app/renderers/publication_status_renderer.rb index 6b857bfd..01b7c9ed 100644 --- a/app/renderers/publication_status_renderer.rb +++ b/app/renderers/publication_status_renderer.rb @@ -5,13 +5,13 @@ class PublicationStatusRenderer < Hyrax::Renderers::AttributeRenderer private - def li_value(value) - link_to(ERB::Util.h(publication_status_label(value)), search_path(value)) - end + def li_value(value) + link_to(ERB::Util.h(publication_status_label(value)), search_path(value)) + end - def search_path(value) - Rails.application.routes.url_helpers.search_catalog_path( - 'f([publication_status_sim[]])': ERB::Util.h(value), locale: I18n.locale - ) - end + def search_path(value) + Rails.application.routes.url_helpers.search_catalog_path( + 'f([publication_status_sim[]])': ERB::Util.h(value), locale: I18n.locale + ) + end end diff --git a/app/services/wings/custom_queries/find_by_slug.rb b/app/services/wings/custom_queries/find_by_slug.rb index af0d2e88..310adb24 100644 --- a/app/services/wings/custom_queries/find_by_slug.rb +++ b/app/services/wings/custom_queries/find_by_slug.rb @@ -6,11 +6,11 @@ class FindBySlug def self.queries [:find_by_slug] end - + def initialize(query_service:) @query_service = query_service end - + attr_reader :query_service delegate :resource_factory, to: :query_service diff --git a/app/uploaders/hyrax/uploaded_file_uploader_decorator.rb b/app/uploaders/hyrax/uploaded_file_uploader_decorator.rb index 16bc2da7..51c96f28 100644 --- a/app/uploaders/hyrax/uploaded_file_uploader_decorator.rb +++ b/app/uploaders/hyrax/uploaded_file_uploader_decorator.rb @@ -7,9 +7,9 @@ def filename end def original_file_name - model.filename + model.filename end end end -Hyrax::UploadedFileUploader.prepend(Hyrax::UploadedFileUploaderDecorator) \ No newline at end of file +Hyrax::UploadedFileUploader.prepend(Hyrax::UploadedFileUploaderDecorator) diff --git a/bundler.d/example.rb b/bundler.d/example.rb index 7f98c30c..0143112b 100644 --- a/bundler.d/example.rb +++ b/bundler.d/example.rb @@ -6,8 +6,7 @@ # or `ensure_gem` to make sure a gem is there w/o worrying about if it is an # override or not -# Note: these injected gems are very sticky... it appears that you must rebuild -# your docker container and rebundle to get rid of an injected gem. +# NOTE: these injected gems are very sticky... it appears that you must rebuild +# your docker container and rebundle to get rid of an injected gem. ensure_gem 'derivative-rodeo', '~> 0.5', '>= 0.5.3' - diff --git a/db/migrate/20240815211201_create_version_committers.hyrax.rb b/db/migrate/20240815211201_create_version_committers.hyrax.rb new file mode 100644 index 00000000..073d97fc --- /dev/null +++ b/db/migrate/20240815211201_create_version_committers.hyrax.rb @@ -0,0 +1,15 @@ +class CreateVersionCommitters < ActiveRecord::Migration[6.1] + def self.up + create_table :version_committers do |t| + t.string :obj_id + t.string :datastream_id + t.string :version_id + t.string :committer_login + t.timestamps null: false + end + end + + def self.down + drop_table :version_committers + end +end diff --git a/db/migrate/20240815211202_create_checksum_audit_logs.hyrax.rb b/db/migrate/20240815211202_create_checksum_audit_logs.hyrax.rb new file mode 100644 index 00000000..a88052c8 --- /dev/null +++ b/db/migrate/20240815211202_create_checksum_audit_logs.hyrax.rb @@ -0,0 +1,19 @@ +class CreateChecksumAuditLogs < ActiveRecord::Migration[6.1] + def self.up + create_table :checksum_audit_logs do |t| + t.string :file_set_id + t.string :file_id + t.string :version + t.integer :pass + t.string :expected_result + t.string :actual_result + t.timestamps null: false + end + add_index :checksum_audit_logs, [:file_set_id, :file_id], name: 'by_file_set_id_and_file_id', order: { created_at: 'DESC' } + end + + def self.down + remove_index(:checksum_audit_logs, name: 'by_file_set_id_and_file_id') + drop_table :checksum_audit_logs + end +end diff --git a/db/migrate/20240815211203_create_single_use_links.hyrax.rb b/db/migrate/20240815211203_create_single_use_links.hyrax.rb new file mode 100644 index 00000000..64a03b31 --- /dev/null +++ b/db/migrate/20240815211203_create_single_use_links.hyrax.rb @@ -0,0 +1,12 @@ +class CreateSingleUseLinks < ActiveRecord::Migration[6.1] + def change + create_table :single_use_links do |t| + t.string :downloadKey + t.string :path + t.string :itemId + t.datetime :expires + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20240815211204_add_social_to_users.hyrax.rb b/db/migrate/20240815211204_add_social_to_users.hyrax.rb new file mode 100644 index 00000000..328603ec --- /dev/null +++ b/db/migrate/20240815211204_add_social_to_users.hyrax.rb @@ -0,0 +1,13 @@ +class AddSocialToUsers < ActiveRecord::Migration[6.1] + def self.up + add_column :users, :facebook_handle, :string + add_column :users, :twitter_handle, :string + add_column :users, :googleplus_handle, :string + end + + def self.down + remove_column :users, :facebook_handle, :string + remove_column :users, :twitter_handle, :string + remove_column :users, :googleplus_handle, :string + end +end diff --git a/db/migrate/20240815211205_add_ldap_attrs_to_user.hyrax.rb b/db/migrate/20240815211205_add_ldap_attrs_to_user.hyrax.rb new file mode 100644 index 00000000..6435adf2 --- /dev/null +++ b/db/migrate/20240815211205_add_ldap_attrs_to_user.hyrax.rb @@ -0,0 +1,27 @@ +class AddLdapAttrsToUser < ActiveRecord::Migration[6.1] + def self.up + add_column :users, :display_name, :string + add_column :users, :address, :string + add_column :users, :admin_area, :string + add_column :users, :department, :string + add_column :users, :title, :string + add_column :users, :office, :string + add_column :users, :chat_id, :string + add_column :users, :website, :string + add_column :users, :affiliation, :string + add_column :users, :telephone, :string + end + + def self.down + remove_column :users, :display_name + remove_column :users, :address + remove_column :users, :admin_area + remove_column :users, :department + remove_column :users, :title + remove_column :users, :office + remove_column :users, :chat_id + remove_column :users, :website + remove_column :users, :affiliation + remove_column :users, :telephone + end +end diff --git a/db/migrate/20240815211206_add_avatars_to_users.hyrax.rb b/db/migrate/20240815211206_add_avatars_to_users.hyrax.rb new file mode 100644 index 00000000..44da5bd9 --- /dev/null +++ b/db/migrate/20240815211206_add_avatars_to_users.hyrax.rb @@ -0,0 +1,15 @@ +class AddAvatarsToUsers < ActiveRecord::Migration[6.1] + def self.up + add_column :users, "avatar_file_name", :string + add_column :users, "avatar_content_type", :string + add_column :users, "avatar_file_size", :integer + add_column :users, "avatar_updated_at", :datetime + end + + def self.down + remove_column :users, "avatar_file_name" + remove_column :users, "avatar_content_type" + remove_column :users, "avatar_file_size" + remove_column :users, "avatar_updated_at" + end +end diff --git a/db/migrate/20240815211207_create_trophies.hyrax.rb b/db/migrate/20240815211207_create_trophies.hyrax.rb new file mode 100644 index 00000000..6056dd7c --- /dev/null +++ b/db/migrate/20240815211207_create_trophies.hyrax.rb @@ -0,0 +1,10 @@ +class CreateTrophies < ActiveRecord::Migration[6.1] + def change + create_table :trophies do |t| + t.integer :user_id + t.string :generic_file_id + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20240815211208_add_linkedin_to_users.hyrax.rb b/db/migrate/20240815211208_add_linkedin_to_users.hyrax.rb new file mode 100644 index 00000000..80128c04 --- /dev/null +++ b/db/migrate/20240815211208_add_linkedin_to_users.hyrax.rb @@ -0,0 +1,5 @@ +class AddLinkedinToUsers < ActiveRecord::Migration[6.1] + def change + add_column :users, :linkedin_handle, :string + end +end diff --git a/db/migrate/20240815211209_create_tinymce_assets.hyrax.rb b/db/migrate/20240815211209_create_tinymce_assets.hyrax.rb new file mode 100644 index 00000000..790d6a3d --- /dev/null +++ b/db/migrate/20240815211209_create_tinymce_assets.hyrax.rb @@ -0,0 +1,8 @@ +class CreateTinymceAssets < ActiveRecord::Migration[6.1] + def change + create_table :tinymce_assets do |t| + t.string :file + t.timestamps null: false + end + end +end diff --git a/db/migrate/20240815211210_create_content_blocks.hyrax.rb b/db/migrate/20240815211210_create_content_blocks.hyrax.rb new file mode 100644 index 00000000..b051411f --- /dev/null +++ b/db/migrate/20240815211210_create_content_blocks.hyrax.rb @@ -0,0 +1,10 @@ +class CreateContentBlocks < ActiveRecord::Migration[6.1] + def change + create_table :content_blocks do |t| + t.string :name + t.text :value + t.timestamps null: false + end + add_index :content_blocks, :name, unique: true + end +end diff --git a/db/migrate/20240815211211_create_featured_works.hyrax.rb b/db/migrate/20240815211211_create_featured_works.hyrax.rb new file mode 100644 index 00000000..b4c49f27 --- /dev/null +++ b/db/migrate/20240815211211_create_featured_works.hyrax.rb @@ -0,0 +1,12 @@ +class CreateFeaturedWorks < ActiveRecord::Migration[6.1] + def change + create_table :featured_works do |t| + t.integer :order, default: 5 + t.string :work_id + + t.timestamps null: false + end + add_index :featured_works, :work_id + add_index :featured_works, :order + end +end diff --git a/db/migrate/20240815211212_add_external_key_to_content_blocks.hyrax.rb b/db/migrate/20240815211212_add_external_key_to_content_blocks.hyrax.rb new file mode 100644 index 00000000..4a2eca6e --- /dev/null +++ b/db/migrate/20240815211212_add_external_key_to_content_blocks.hyrax.rb @@ -0,0 +1,6 @@ +class AddExternalKeyToContentBlocks < ActiveRecord::Migration[6.1] + def change + add_column :content_blocks, :external_key, :string + remove_index :content_blocks, :name + end +end diff --git a/db/migrate/20240815211213_create_proxy_deposit_rights.hyrax.rb b/db/migrate/20240815211213_create_proxy_deposit_rights.hyrax.rb new file mode 100644 index 00000000..77075a65 --- /dev/null +++ b/db/migrate/20240815211213_create_proxy_deposit_rights.hyrax.rb @@ -0,0 +1,10 @@ +class CreateProxyDepositRights < ActiveRecord::Migration[6.1] + def change + create_table :proxy_deposit_rights do |t| + t.references :grantor + t.references :grantee + t.timestamps null: false + end + + end +end diff --git a/db/migrate/20240815211214_create_proxy_deposit_requests.hyrax.rb b/db/migrate/20240815211214_create_proxy_deposit_requests.hyrax.rb new file mode 100644 index 00000000..670d42dc --- /dev/null +++ b/db/migrate/20240815211214_create_proxy_deposit_requests.hyrax.rb @@ -0,0 +1,15 @@ +class CreateProxyDepositRequests < ActiveRecord::Migration[6.1] + def change + create_table :proxy_deposit_requests do |t| + t.string :generic_file_id, null: false + t.references :sending_user, null: false + t.references :receiving_user, null: false + t.datetime :fulfillment_date + t.string :status, null: false, default: 'pending' + t.text :sender_comment + t.text :receiver_comment + t.timestamps null: false + end + + end +end diff --git a/db/migrate/20240815211215_create_file_view_stats.hyrax.rb b/db/migrate/20240815211215_create_file_view_stats.hyrax.rb new file mode 100644 index 00000000..7e5300db --- /dev/null +++ b/db/migrate/20240815211215_create_file_view_stats.hyrax.rb @@ -0,0 +1,12 @@ +class CreateFileViewStats < ActiveRecord::Migration[6.1] + def change + create_table :file_view_stats do |t| + t.datetime :date + t.integer :views + t.string :file_id + + t.timestamps null: false + end + add_index :file_view_stats, :file_id + end +end diff --git a/db/migrate/20240815211216_create_file_download_stats.hyrax.rb b/db/migrate/20240815211216_create_file_download_stats.hyrax.rb new file mode 100644 index 00000000..89710bd4 --- /dev/null +++ b/db/migrate/20240815211216_create_file_download_stats.hyrax.rb @@ -0,0 +1,12 @@ +class CreateFileDownloadStats < ActiveRecord::Migration[6.1] + def change + create_table :file_download_stats do |t| + t.datetime :date + t.integer :downloads + t.string :file_id + + t.timestamps null: false + end + add_index :file_download_stats, :file_id + end +end diff --git a/db/migrate/20240815211217_add_orcid_to_users.hyrax.rb b/db/migrate/20240815211217_add_orcid_to_users.hyrax.rb new file mode 100644 index 00000000..661aa120 --- /dev/null +++ b/db/migrate/20240815211217_add_orcid_to_users.hyrax.rb @@ -0,0 +1,5 @@ +class AddOrcidToUsers < ActiveRecord::Migration[6.1] + def change + add_column :users, :orcid, :string + end +end diff --git a/db/migrate/20240815211218_create_user_stats.hyrax.rb b/db/migrate/20240815211218_create_user_stats.hyrax.rb new file mode 100644 index 00000000..cea7b9ac --- /dev/null +++ b/db/migrate/20240815211218_create_user_stats.hyrax.rb @@ -0,0 +1,19 @@ +class CreateUserStats < ActiveRecord::Migration[6.1] + def change + create_table :user_stats do |t| + t.integer :user_id + t.datetime :date + t.integer :file_views + t.integer :file_downloads + + t.timestamps null: false + end + + add_column :file_view_stats, :user_id, :integer + add_column :file_download_stats, :user_id, :integer + + add_index :user_stats, :user_id + add_index :file_view_stats, :user_id + add_index :file_download_stats, :user_id + end +end diff --git a/db/migrate/20240815211219_create_work_view_stats.hyrax.rb b/db/migrate/20240815211219_create_work_view_stats.hyrax.rb new file mode 100644 index 00000000..aeb79811 --- /dev/null +++ b/db/migrate/20240815211219_create_work_view_stats.hyrax.rb @@ -0,0 +1,12 @@ +class CreateWorkViewStats < ActiveRecord::Migration[6.1] + def change + create_table :work_view_stats do |t| + t.datetime :date + t.integer :work_views + t.string :work_id + + t.timestamps null: false + end + add_index :work_view_stats, :work_id + end +end diff --git a/db/migrate/20240815211220_add_works_to_user_stats.hyrax.rb b/db/migrate/20240815211220_add_works_to_user_stats.hyrax.rb new file mode 100644 index 00000000..b75793f8 --- /dev/null +++ b/db/migrate/20240815211220_add_works_to_user_stats.hyrax.rb @@ -0,0 +1,13 @@ +class AddWorksToUserStats < ActiveRecord::Migration[6.1] + def self.up + add_column :user_stats, :work_views, :integer + add_column :work_view_stats, :user_id, :integer + add_index :work_view_stats, :user_id + end + + def self.down + remove_column :user_stats, :work_views, :integer + remove_column :work_view_stats, :user_id, :integer + remove_index :work_view_stats, :user_id + end +end diff --git a/db/migrate/20240815211221_change_trophy_generic_file_id_to_work_id.hyrax.rb b/db/migrate/20240815211221_change_trophy_generic_file_id_to_work_id.hyrax.rb new file mode 100644 index 00000000..4263359f --- /dev/null +++ b/db/migrate/20240815211221_change_trophy_generic_file_id_to_work_id.hyrax.rb @@ -0,0 +1,5 @@ +class ChangeTrophyGenericFileIdToWorkId < ActiveRecord::Migration[6.1] + def change + rename_column :trophies, :generic_file_id, :work_id + end +end diff --git a/db/migrate/20240815211222_change_proxy_deposit_generic_file_id_to_work_id.hyrax.rb b/db/migrate/20240815211222_change_proxy_deposit_generic_file_id_to_work_id.hyrax.rb new file mode 100644 index 00000000..4d73d07a --- /dev/null +++ b/db/migrate/20240815211222_change_proxy_deposit_generic_file_id_to_work_id.hyrax.rb @@ -0,0 +1,5 @@ +class ChangeProxyDepositGenericFileIdToWorkId < ActiveRecord::Migration[6.1] + def change + rename_column :proxy_deposit_requests, :generic_file_id, :work_id + end +end diff --git a/db/migrate/20240815211223_change_audit_log_generic_file_id_to_file_set_id.hyrax.rb b/db/migrate/20240815211223_change_audit_log_generic_file_id_to_file_set_id.hyrax.rb new file mode 100644 index 00000000..bd5b6dd7 --- /dev/null +++ b/db/migrate/20240815211223_change_audit_log_generic_file_id_to_file_set_id.hyrax.rb @@ -0,0 +1,5 @@ +class ChangeAuditLogGenericFileIdToFileSetId < ActiveRecord::Migration[6.1] + def change + rename_column :checksum_audit_logs, :generic_file_id, :file_set_id unless ChecksumAuditLog.column_names.include?('file_set_id') + end +end diff --git a/db/migrate/20240815211224_change_proxy_deposit_request_generic_file_id_to_work_id.hyrax.rb b/db/migrate/20240815211224_change_proxy_deposit_request_generic_file_id_to_work_id.hyrax.rb new file mode 100644 index 00000000..c4814171 --- /dev/null +++ b/db/migrate/20240815211224_change_proxy_deposit_request_generic_file_id_to_work_id.hyrax.rb @@ -0,0 +1,5 @@ +class ChangeProxyDepositRequestGenericFileIdToWorkId < ActiveRecord::Migration[6.1] + def change + rename_column :proxy_deposit_requests, :generic_file_id, :generic_id if ProxyDepositRequest.column_names.include?('generic_file_id') + end +end diff --git a/db/migrate/20240815211225_create_uploaded_files.hyrax.rb b/db/migrate/20240815211225_create_uploaded_files.hyrax.rb new file mode 100644 index 00000000..2d93ccaf --- /dev/null +++ b/db/migrate/20240815211225_create_uploaded_files.hyrax.rb @@ -0,0 +1,10 @@ +class CreateUploadedFiles < ActiveRecord::Migration[6.1] + def change + create_table :uploaded_files do |t| + t.string :file + t.references :user, index: true, foreign_key: true + t.string :file_set_uri, index: true + t.timestamps null: false + end + end +end diff --git a/db/migrate/20240815211226_create_features.hyrax.rb b/db/migrate/20240815211226_create_features.hyrax.rb new file mode 100644 index 00000000..66971ceb --- /dev/null +++ b/db/migrate/20240815211226_create_features.hyrax.rb @@ -0,0 +1,10 @@ +class CreateFeatures < ActiveRecord::Migration[6.1] + def change + create_table :hyrax_features do |t| + t.string :key, null: false + t.boolean :enabled, null: false, default: false + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20240815211227_create_operations.hyrax.rb b/db/migrate/20240815211227_create_operations.hyrax.rb new file mode 100644 index 00000000..b6d139b2 --- /dev/null +++ b/db/migrate/20240815211227_create_operations.hyrax.rb @@ -0,0 +1,23 @@ +class CreateOperations < ActiveRecord::Migration[6.1] + def change + create_table :curation_concerns_operations do |t| + t.string :status + t.string :operation_type + t.string :job_class + t.string :job_id + t.string :type # For Single Table Inheritance + t.text :message + t.references :user, index: true, foreign_key: true + + t.integer :parent_id, null: true, index: true + t.integer :lft, null: false, index: true + t.integer :rgt, null: false, index: true + + # optional fields + t.integer :depth, null: false, default: 0 + t.integer :children_count, null: false, default: 0 + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20240815211228_change_featured_work_generic_file_id_to_work_id.hyrax.rb b/db/migrate/20240815211228_change_featured_work_generic_file_id_to_work_id.hyrax.rb new file mode 100644 index 00000000..99ddd233 --- /dev/null +++ b/db/migrate/20240815211228_change_featured_work_generic_file_id_to_work_id.hyrax.rb @@ -0,0 +1,6 @@ +class ChangeFeaturedWorkGenericFileIdToWorkId < ActiveRecord::Migration[6.1] + def change + return unless column_exists?(:featured_works, :generic_file_id) + rename_column :featured_works, :generic_file_id, :work_id + end +end diff --git a/db/migrate/20240815211229_add_arkivo_to_users.hyrax.rb b/db/migrate/20240815211229_add_arkivo_to_users.hyrax.rb new file mode 100644 index 00000000..9f2a67d3 --- /dev/null +++ b/db/migrate/20240815211229_add_arkivo_to_users.hyrax.rb @@ -0,0 +1,8 @@ +class AddArkivoToUsers < ActiveRecord::Migration[6.1] + def change + add_column :users, :arkivo_token, :string + add_column :users, :arkivo_subscription, :string + add_column :users, :zotero_token, :binary + add_column :users, :zotero_userid, :string + end +end diff --git a/db/migrate/20240815211230_create_sipity.hyrax.rb b/db/migrate/20240815211230_create_sipity.hyrax.rb new file mode 100644 index 00000000..4f53441a --- /dev/null +++ b/db/migrate/20240815211230_create_sipity.hyrax.rb @@ -0,0 +1,163 @@ +class CreateSipity < ActiveRecord::Migration[6.1] + def change + create_table "sipity_notification_recipients" do |t| + t.integer "notification_id", null: false + t.integer "role_id", null: false + t.string "recipient_strategy", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "sipity_notification_recipients", ["notification_id", "role_id", "recipient_strategy"], name: "sipity_notifications_recipients_surrogate" + add_index "sipity_notification_recipients", ["notification_id"], name: "sipity_notification_recipients_notification" + add_index "sipity_notification_recipients", ["recipient_strategy"], name: "sipity_notification_recipients_recipient_strategy" + add_index "sipity_notification_recipients", ["role_id"], name: "sipity_notification_recipients_role" + + create_table "sipity_notifications" do |t| + t.string "name", null: false + t.string "notification_type", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "sipity_notifications", ["name"], name: "index_sipity_notifications_on_name", unique: true + add_index "sipity_notifications", ["notification_type"], name: "index_sipity_notifications_on_notification_type" + + create_table "sipity_notifiable_contexts" do |t| + t.integer "scope_for_notification_id", null: false + t.string "scope_for_notification_type", null: false + t.string "reason_for_notification", null: false + t.integer "notification_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "sipity_notifiable_contexts", ["notification_id"], name: "sipity_notifiable_contexts_notification_id" + add_index "sipity_notifiable_contexts", ["scope_for_notification_id", "scope_for_notification_type", "reason_for_notification", "notification_id"], name: "sipity_notifiable_contexts_concern_surrogate", unique: true + add_index "sipity_notifiable_contexts", ["scope_for_notification_id", "scope_for_notification_type", "reason_for_notification"], name: "sipity_notifiable_contexts_concern_context" + add_index "sipity_notifiable_contexts", ["scope_for_notification_id", "scope_for_notification_type"], name: "sipity_notifiable_contexts_concern" + + create_table "sipity_agents" do |t| + t.string "proxy_for_id", null: false + t.string "proxy_for_type", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "sipity_agents", ["proxy_for_id", "proxy_for_type"], name: "sipity_agents_proxy_for", unique: true + + create_table "sipity_comments" do |t| + t.integer "entity_id", null: false + t.integer "agent_id", null: false + t.text "comment" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "sipity_comments", ["agent_id"], name: "index_sipity_comments_on_agent_id" + add_index "sipity_comments", ["created_at"], name: "index_sipity_comments_on_created_at" + add_index "sipity_comments", ["entity_id"], name: "index_sipity_comments_on_entity_id" + + create_table "sipity_entities" do |t| + t.string "proxy_for_global_id", null: false + t.integer "workflow_id", null: false + t.integer "workflow_state_id", null: true + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "sipity_entities", ["proxy_for_global_id"], name: "sipity_entities_proxy_for_global_id", unique: true + add_index "sipity_entities", ["workflow_id"], name: "index_sipity_entities_on_workflow_id" + add_index "sipity_entities", ["workflow_state_id"], name: "index_sipity_entities_on_workflow_state_id" + + create_table "sipity_entity_specific_responsibilities" do |t| + t.integer "workflow_role_id", null: false + t.string "entity_id", null: false + t.integer "agent_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "sipity_entity_specific_responsibilities", ["agent_id"], name: "sipity_entity_specific_responsibilities_agent" + add_index "sipity_entity_specific_responsibilities", ["entity_id"], name: "sipity_entity_specific_responsibilities_entity" + add_index "sipity_entity_specific_responsibilities", ["workflow_role_id", "entity_id", "agent_id"], name: "sipity_entity_specific_responsibilities_aggregate", unique: true + add_index "sipity_entity_specific_responsibilities", ["workflow_role_id"], name: "sipity_entity_specific_responsibilities_role" + + create_table "sipity_workflows" do |t| + t.string "name", null: false + t.string "label" + t.text "description" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "sipity_workflows", ["name"], name: "index_sipity_workflows_on_name", unique: true + + create_table "sipity_workflow_actions" do |t| + t.integer "workflow_id", null: false + t.integer "resulting_workflow_state_id" + t.string "name", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "sipity_workflow_actions", ["resulting_workflow_state_id"], name: "sipity_workflow_actions_resulting_workflow_state" + add_index "sipity_workflow_actions", ["workflow_id", "name"], name: "sipity_workflow_actions_aggregate", unique: true + add_index "sipity_workflow_actions", ["workflow_id"], name: "sipity_workflow_actions_workflow" + + create_table "sipity_workflow_responsibilities" do |t| + t.integer "agent_id", null: false + t.integer "workflow_role_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "sipity_workflow_responsibilities", ["agent_id", "workflow_role_id"], name: "sipity_workflow_responsibilities_aggregate", unique: true + + create_table "sipity_workflow_roles" do |t| + t.integer "workflow_id", null: false + t.integer "role_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "sipity_workflow_roles", ["workflow_id", "role_id"], name: "sipity_workflow_roles_aggregate", unique: true + + create_table "sipity_workflow_state_action_permissions" do |t| + t.integer "workflow_role_id", null: false + t.integer "workflow_state_action_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "sipity_workflow_state_action_permissions", ["workflow_role_id", "workflow_state_action_id"], name: "sipity_workflow_state_action_permissions_aggregate", unique: true + + create_table "sipity_workflow_state_actions" do |t| + t.integer "originating_workflow_state_id", null: false + t.integer "workflow_action_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "sipity_workflow_state_actions", ["originating_workflow_state_id", "workflow_action_id"], name: "sipity_workflow_state_actions_aggregate", unique: true + + create_table "sipity_workflow_states" do |t| + t.integer "workflow_id", null: false + t.string "name", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "sipity_workflow_states", ["name"], name: "index_sipity_workflow_states_on_name" + add_index "sipity_workflow_states", ["workflow_id", "name"], name: "sipity_type_state_aggregate", unique: true + + create_table "sipity_roles" do |t| + t.string "name", null: false + t.text "description" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "sipity_roles", ["name"], name: "index_sipity_roles_on_name", unique: true + end +end diff --git a/db/migrate/20240815211231_create_sipity_workflow_methods.hyrax.rb b/db/migrate/20240815211231_create_sipity_workflow_methods.hyrax.rb new file mode 100644 index 00000000..b6ed4358 --- /dev/null +++ b/db/migrate/20240815211231_create_sipity_workflow_methods.hyrax.rb @@ -0,0 +1,10 @@ +class CreateSipityWorkflowMethods < ActiveRecord::Migration[6.1] + def change + create_table :sipity_workflow_methods do |t| + t.string "service_name", null: false + t.integer "weight", null: false + t.integer "workflow_action_id", index: true, null: false + t.timestamps null: false + end + end +end diff --git a/db/migrate/20240815211232_create_permission_template.hyrax.rb b/db/migrate/20240815211232_create_permission_template.hyrax.rb new file mode 100644 index 00000000..eb5284c0 --- /dev/null +++ b/db/migrate/20240815211232_create_permission_template.hyrax.rb @@ -0,0 +1,11 @@ +class CreatePermissionTemplate < ActiveRecord::Migration[6.1] + def change + create_table :permission_templates do |t| + t.belongs_to :workflow + t.string :admin_set_id + t.string :visibility + t.timestamps + end + add_index :permission_templates, :admin_set_id + end +end diff --git a/db/migrate/20240815211233_create_permission_template_access.hyrax.rb b/db/migrate/20240815211233_create_permission_template_access.hyrax.rb new file mode 100644 index 00000000..487e0b77 --- /dev/null +++ b/db/migrate/20240815211233_create_permission_template_access.hyrax.rb @@ -0,0 +1,11 @@ +class CreatePermissionTemplateAccess < ActiveRecord::Migration[6.1] + def change + create_table :permission_template_accesses do |t| + t.references :permission_template, foreign_key: true + t.string :agent_type + t.string :agent_id + t.string :access + t.timestamps + end + end +end diff --git a/db/migrate/20240815211234_add_release_to_permission_templates.hyrax.rb b/db/migrate/20240815211234_add_release_to_permission_templates.hyrax.rb new file mode 100644 index 00000000..85573ee3 --- /dev/null +++ b/db/migrate/20240815211234_add_release_to_permission_templates.hyrax.rb @@ -0,0 +1,6 @@ +class AddReleaseToPermissionTemplates < ActiveRecord::Migration[6.1] + def change + add_column :permission_templates, :release_date, :date + add_column :permission_templates, :release_period, :string + end +end diff --git a/db/migrate/20240815211235_add_permission_template_to_sipity_workflow.hyrax.rb b/db/migrate/20240815211235_add_permission_template_to_sipity_workflow.hyrax.rb new file mode 100644 index 00000000..332d156a --- /dev/null +++ b/db/migrate/20240815211235_add_permission_template_to_sipity_workflow.hyrax.rb @@ -0,0 +1,26 @@ +class AddPermissionTemplateToSipityWorkflow < ActiveRecord::Migration[6.1] + def change + add_column :sipity_workflows, :permission_template_id, :integer, index: true + remove_index :sipity_workflows, :name + add_index :sipity_workflows, [:permission_template_id, :name], name: :index_sipity_workflows_on_permission_template_and_name, unique: true + remove_index :permission_templates, :admin_set_id + add_index :permission_templates, :admin_set_id, unique: true + + # Only allow one to be true; Note the options should be nil or true to enforce uniqueness + add_column :sipity_workflows, :active, :boolean, default: nil, index: :unique + + # Doing an inline data migration + begin + if Hyrax::PermissionTemplate.column_names.include?('workflow_id') + Hyrax::PermissionTemplate.each do |permission_template| + workflow_id = permission_template.workflow_id + next unless workflow_id + Sipity::Workflow.find(workflow_id).update(active: true) + end + remove_column :permission_templates, :workflow_id + end + rescue + # It's okay, we didn't have the column + end + end +end diff --git a/db/migrate/20240815211236_tidy_up_because_of_bad_exception.hyrax.rb b/db/migrate/20240815211236_tidy_up_because_of_bad_exception.hyrax.rb new file mode 100644 index 00000000..1485fccb --- /dev/null +++ b/db/migrate/20240815211236_tidy_up_because_of_bad_exception.hyrax.rb @@ -0,0 +1,13 @@ +class TidyUpBecauseOfBadException < ActiveRecord::Migration[6.1] + def change + if column_exists?(Hyrax::PermissionTemplate.table_name, :workflow_id) + Hyrax::PermissionTemplate.all.each do |permission_template| + workflow_id = permission_template.workflow_id + next unless workflow_id + Sipity::Workflow.find(workflow_id).update(active: true) + end + + remove_column Hyrax::PermissionTemplate.table_name, :workflow_id + end + end +end diff --git a/db/migrate/20240815211237_add_allows_access_grant_to_workflow.hyrax.rb b/db/migrate/20240815211237_add_allows_access_grant_to_workflow.hyrax.rb new file mode 100644 index 00000000..5c4f2678 --- /dev/null +++ b/db/migrate/20240815211237_add_allows_access_grant_to_workflow.hyrax.rb @@ -0,0 +1,5 @@ +class AddAllowsAccessGrantToWorkflow < ActiveRecord::Migration[6.1] + def change + add_column :sipity_workflows, :allows_access_grant, :boolean + end +end diff --git a/db/migrate/20240815211238_change_checksum_audit_log.hyrax.rb b/db/migrate/20240815211238_change_checksum_audit_log.hyrax.rb new file mode 100644 index 00000000..73c05c57 --- /dev/null +++ b/db/migrate/20240815211238_change_checksum_audit_log.hyrax.rb @@ -0,0 +1,18 @@ +class ChangeChecksumAuditLog < ActiveRecord::Migration[6.1] + def change + rename_column :checksum_audit_logs, :version, :checked_uri + add_column :checksum_audit_logs, :passed, :boolean + + reversible do |dir| + dir.up do + execute 'UPDATE checksum_audit_logs SET passed = (pass = 1)' + end + dir.down do + execute 'UPDATE checksum_audit_logs SET pass = CASE WHEN passed THEN 1 ELSE 0 END' + end + end + + remove_column :checksum_audit_logs, :pass + add_index :checksum_audit_logs, :checked_uri + end +end diff --git a/db/migrate/20240815211239_create_job_io_wrappers.hyrax.rb b/db/migrate/20240815211239_create_job_io_wrappers.hyrax.rb new file mode 100644 index 00000000..84ef2731 --- /dev/null +++ b/db/migrate/20240815211239_create_job_io_wrappers.hyrax.rb @@ -0,0 +1,15 @@ +class CreateJobIoWrappers < ActiveRecord::Migration[6.1] + def change + create_table :job_io_wrappers do |t| + t.references :user + t.references :uploaded_file + t.string :file_set_id + t.string :mime_type + t.string :original_name + t.string :path + t.string :relation + + t.timestamps + end + end +end diff --git a/db/migrate/20240815211240_create_collection_types.hyrax.rb b/db/migrate/20240815211240_create_collection_types.hyrax.rb new file mode 100644 index 00000000..8cccb414 --- /dev/null +++ b/db/migrate/20240815211240_create_collection_types.hyrax.rb @@ -0,0 +1,17 @@ +class CreateCollectionTypes < ActiveRecord::Migration[6.1] + def change + create_table :hyrax_collection_types do |t| + t.string :title + t.text :description + t.string :machine_id + t.boolean :nestable, null: false, default: true + t.boolean :discovery, null: false, default: true + t.boolean :sharing, null: false, default: true + t.boolean :multiple_membership, null: false, default: true + t.boolean :require_membership, null: false, default: false + t.boolean :workflow, null: false, default: false + t.boolean :visibility, null: false, default: false + end + add_index :hyrax_collection_types, :machine_id + end +end diff --git a/db/migrate/20240815211241_update_collection_type_column_names.hyrax.rb b/db/migrate/20240815211241_update_collection_type_column_names.hyrax.rb new file mode 100644 index 00000000..443ff68e --- /dev/null +++ b/db/migrate/20240815211241_update_collection_type_column_names.hyrax.rb @@ -0,0 +1,9 @@ +class UpdateCollectionTypeColumnNames < ActiveRecord::Migration[6.1] + def change + rename_column :hyrax_collection_types, :discovery, :discoverable + rename_column :hyrax_collection_types, :sharing, :sharable + rename_column :hyrax_collection_types, :multiple_membership, :allow_multiple_membership + rename_column :hyrax_collection_types, :workflow, :assigns_workflow + rename_column :hyrax_collection_types, :visibility, :assigns_visibility + end +end diff --git a/db/migrate/20240815211242_update_collection_type_column_options.hyrax.rb b/db/migrate/20240815211242_update_collection_type_column_options.hyrax.rb new file mode 100644 index 00000000..0ccc1125 --- /dev/null +++ b/db/migrate/20240815211242_update_collection_type_column_options.hyrax.rb @@ -0,0 +1,17 @@ +class UpdateCollectionTypeColumnOptions < ActiveRecord::Migration[6.1] + def up + change_column :hyrax_collection_types, :title, :string, unique: true + change_column :hyrax_collection_types, :machine_id, :string, unique: true + + remove_index :hyrax_collection_types, :machine_id + add_index :hyrax_collection_types, :machine_id, unique: true + end + + def down + change_column :hyrax_collection_types, :title, :string + change_column :hyrax_collection_types, :machine_id, :string + + remove_index :hyrax_collection_types, :machine_id + add_index :hyrax_collection_types, :machine_id + end +end diff --git a/db/migrate/20240815211243_create_collection_branding_infos.hyrax.rb b/db/migrate/20240815211243_create_collection_branding_infos.hyrax.rb new file mode 100644 index 00000000..630363e9 --- /dev/null +++ b/db/migrate/20240815211243_create_collection_branding_infos.hyrax.rb @@ -0,0 +1,15 @@ +class CreateCollectionBrandingInfos < ActiveRecord::Migration[6.1] + def change + create_table :collection_branding_infos do |t| + t.string :collection_id + t.string :role + t.string :local_path + t.string :alt_text + t.string :target_url + t.integer :height + t.integer :width + + t.timestamps + end + end +end diff --git a/db/migrate/20240815211244_create_collection_type_participants.hyrax.rb b/db/migrate/20240815211244_create_collection_type_participants.hyrax.rb new file mode 100644 index 00000000..afd5cade --- /dev/null +++ b/db/migrate/20240815211244_create_collection_type_participants.hyrax.rb @@ -0,0 +1,11 @@ +class CreateCollectionTypeParticipants < ActiveRecord::Migration[6.1] + def change + create_table :collection_type_participants do |t| + t.references :hyrax_collection_type, foreign_key: true, index: {:name => "hyrax_collection_type_id"} + t.string :agent_type + t.string :agent_id + t.string :access + t.timestamps + end + end +end diff --git a/db/migrate/20240815211245_rename_admin_set_id_to_source_id.hyrax.rb b/db/migrate/20240815211245_rename_admin_set_id_to_source_id.hyrax.rb new file mode 100644 index 00000000..20649320 --- /dev/null +++ b/db/migrate/20240815211245_rename_admin_set_id_to_source_id.hyrax.rb @@ -0,0 +1,5 @@ +class RenameAdminSetIdToSourceId < ActiveRecord::Migration[6.1] + def change + rename_column :permission_templates, :admin_set_id, :source_id + end +end diff --git a/db/migrate/20240815211246_add_preferred_locale_to_users.hyrax.rb b/db/migrate/20240815211246_add_preferred_locale_to_users.hyrax.rb new file mode 100644 index 00000000..80f1e5b9 --- /dev/null +++ b/db/migrate/20240815211246_add_preferred_locale_to_users.hyrax.rb @@ -0,0 +1,5 @@ +class AddPreferredLocaleToUsers < ActiveRecord::Migration[6.1] + def change + add_column :users, :preferred_locale, :string + end +end diff --git a/db/migrate/20240815211247_add_collection_type_sharing_options.hyrax.rb b/db/migrate/20240815211247_add_collection_type_sharing_options.hyrax.rb new file mode 100644 index 00000000..35920c60 --- /dev/null +++ b/db/migrate/20240815211247_add_collection_type_sharing_options.hyrax.rb @@ -0,0 +1,5 @@ +class AddCollectionTypeSharingOptions < ActiveRecord::Migration[6.1] + def change + add_column :hyrax_collection_types, :share_applies_to_new_works, :boolean, null: false, default: true + end +end diff --git a/db/migrate/20240815211248_add_unique_constraint_to_permission_template_accesses.hyrax.rb b/db/migrate/20240815211248_add_unique_constraint_to_permission_template_accesses.hyrax.rb new file mode 100644 index 00000000..eecd49b7 --- /dev/null +++ b/db/migrate/20240815211248_add_unique_constraint_to_permission_template_accesses.hyrax.rb @@ -0,0 +1,8 @@ +class AddUniqueConstraintToPermissionTemplateAccesses < ActiveRecord::Migration[6.1] + def change + add_index :permission_template_accesses, + [:permission_template_id, :agent_id, :agent_type, :access], + unique: true, + name: 'uk_permission_template_accesses' + end +end diff --git a/db/migrate/20240815211249_add_branding_to_collection_type.hyrax.rb b/db/migrate/20240815211249_add_branding_to_collection_type.hyrax.rb new file mode 100644 index 00000000..233e5574 --- /dev/null +++ b/db/migrate/20240815211249_add_branding_to_collection_type.hyrax.rb @@ -0,0 +1,5 @@ +class AddBrandingToCollectionType < ActiveRecord::Migration[6.1] + def change + add_column :hyrax_collection_types, :brandable, :boolean, null: false, default: true + end +end diff --git a/db/migrate/20240815211250_add_badge_color_to_collection_types.hyrax.rb b/db/migrate/20240815211250_add_badge_color_to_collection_types.hyrax.rb new file mode 100644 index 00000000..67c882bd --- /dev/null +++ b/db/migrate/20240815211250_add_badge_color_to_collection_types.hyrax.rb @@ -0,0 +1,5 @@ +class AddBadgeColorToCollectionTypes < ActiveRecord::Migration[6.1] + def change + add_column :hyrax_collection_types, :badge_color, :string, default: '#663333' + end +end diff --git a/db/migrate/20240815211251_update_single_use_links_column_names.hyrax.rb b/db/migrate/20240815211251_update_single_use_links_column_names.hyrax.rb new file mode 100644 index 00000000..2d4416be --- /dev/null +++ b/db/migrate/20240815211251_update_single_use_links_column_names.hyrax.rb @@ -0,0 +1,6 @@ +class UpdateSingleUseLinksColumnNames < ActiveRecord::Migration[6.1] + def change + rename_column :single_use_links, :downloadKey, :download_key + rename_column :single_use_links, :itemId, :item_id + end +end diff --git a/db/migrate/20240815211252_change_sipity_entity_specific_responsibility.hyrax.rb b/db/migrate/20240815211252_change_sipity_entity_specific_responsibility.hyrax.rb new file mode 100644 index 00000000..de5d87dc --- /dev/null +++ b/db/migrate/20240815211252_change_sipity_entity_specific_responsibility.hyrax.rb @@ -0,0 +1,9 @@ +class ChangeSipityEntitySpecificResponsibility < ActiveRecord::Migration[6.1] + def change + if ActiveRecord::Base.connection.adapter_name == "PostgreSQL" + change_column :sipity_entity_specific_responsibilities, :entity_id, 'integer USING CAST(entity_id AS integer)' + else + change_column :sipity_entity_specific_responsibilities, :entity_id, :integer + end + end +end diff --git a/db/migrate/20240815211253_create_default_administrative_set.hyrax.rb b/db/migrate/20240815211253_create_default_administrative_set.hyrax.rb new file mode 100644 index 00000000..4128f9ab --- /dev/null +++ b/db/migrate/20240815211253_create_default_administrative_set.hyrax.rb @@ -0,0 +1,8 @@ +class CreateDefaultAdministrativeSet < ActiveRecord::Migration[6.1] + def change + create_table :hyrax_default_administrative_set do |t| + t.string :default_admin_set_id, null: false + t.timestamps null: false + end + end +end diff --git a/db/migrate/20240815211254_create_hyrax_counter_metrics.hyrax.rb b/db/migrate/20240815211254_create_hyrax_counter_metrics.hyrax.rb new file mode 100644 index 00000000..80caf88c --- /dev/null +++ b/db/migrate/20240815211254_create_hyrax_counter_metrics.hyrax.rb @@ -0,0 +1,14 @@ +class CreateHyraxCounterMetrics < ActiveRecord::Migration[6.1] + def change + create_table :hyrax_counter_metrics do |t| + t.string :worktype + t.string :resource_type + t.integer :work_id + t.date :date + t.integer :total_item_investigations + t.integer :total_item_requests + + t.timestamps + end + end +end diff --git a/db/migrate/20240815211255_change_work_id_to_string.hyrax.rb b/db/migrate/20240815211255_change_work_id_to_string.hyrax.rb new file mode 100644 index 00000000..1cdb92a3 --- /dev/null +++ b/db/migrate/20240815211255_change_work_id_to_string.hyrax.rb @@ -0,0 +1,5 @@ +class ChangeWorkIdToString < ActiveRecord::Migration[6.1] + def change + change_column :hyrax_counter_metrics, :work_id, :string + end +end diff --git a/db/migrate/20240815211256_add_indices_to_hyrax_counter_metrics.hyrax.rb b/db/migrate/20240815211256_add_indices_to_hyrax_counter_metrics.hyrax.rb new file mode 100644 index 00000000..b71e0977 --- /dev/null +++ b/db/migrate/20240815211256_add_indices_to_hyrax_counter_metrics.hyrax.rb @@ -0,0 +1,8 @@ +class AddIndicesToHyraxCounterMetrics < ActiveRecord::Migration[6.1] + def change + add_index :hyrax_counter_metrics, :worktype + add_index :hyrax_counter_metrics, :resource_type + add_index :hyrax_counter_metrics, :work_id + add_index :hyrax_counter_metrics, :date + end +end diff --git a/db/migrate/20240815211257_add_fields_to_counter_metric.hyrax.rb b/db/migrate/20240815211257_add_fields_to_counter_metric.hyrax.rb new file mode 100644 index 00000000..7b2ec02f --- /dev/null +++ b/db/migrate/20240815211257_add_fields_to_counter_metric.hyrax.rb @@ -0,0 +1,8 @@ +class AddFieldsToCounterMetric < ActiveRecord::Migration[6.1] + def change + add_column :hyrax_counter_metrics, :title, :string + add_column :hyrax_counter_metrics, :year_of_publication, :integer, index: true + add_column :hyrax_counter_metrics, :publisher, :string, index: true + add_column :hyrax_counter_metrics, :author, :string, index: true + end +end diff --git a/lib/active_job_tenant.rb b/lib/active_job_tenant.rb index fec07c64..c40c09a3 100644 --- a/lib/active_job_tenant.rb +++ b/lib/active_job_tenant.rb @@ -50,19 +50,19 @@ def perform_now private - delegate :non_tenant_job?, to: :class + delegate :non_tenant_job?, to: :class - def current_account - @current_account ||= Account.find_by(tenant: current_tenant) - end + def current_account + @current_account ||= Account.find_by(tenant: current_tenant) + end - def current_tenant - tenant || Apartment::Tenant.current - end + def current_tenant + tenant || Apartment::Tenant.current + end - def switch - Apartment::Tenant.switch(current_tenant) do - yield - end + def switch + Apartment::Tenant.switch(current_tenant) do + yield end + end end diff --git a/lib/dog_biscuits/actors/apply_authorities.rb b/lib/dog_biscuits/actors/apply_authorities.rb index 516452b3..d183855e 100644 --- a/lib/dog_biscuits/actors/apply_authorities.rb +++ b/lib/dog_biscuits/actors/apply_authorities.rb @@ -5,28 +5,28 @@ module Actors module ApplyAuthorities private - # Add new terms to table-based authorities - # - # @param env [Hyrax::Actors::Environment] the env - def apply_authorities(env) - DogBiscuits.config.authorities_add_new.each do |authority_name| - term = authority_name.to_s.singularize.to_sym - next unless env.attributes.key? term - env.attributes[term].each do |attr| - add_new(authority_name.to_s, attr) - end + # Add new terms to table-based authorities + # + # @param env [Hyrax::Actors::Environment] the env + def apply_authorities(env) + DogBiscuits.config.authorities_add_new.each do |authority_name| + term = authority_name.to_s.singularize.to_sym + next unless env.attributes.key? term + env.attributes[term].each do |attr| + add_new(authority_name.to_s, attr) end end + end - # Add new term to the authority; it will be rejected if already present - # - # @param auth [String] the authority to add to - # @param label [String] the label to add - def add_new(authority_name, label) - DogBiscuits::Importers::Authority.new(authority_name).create_record(label) if Qa::Authorities::Local.subauthority_for(authority_name).search(label).empty? - rescue Qa::InvalidSubAuthority - Rails.logger.error("Invalid sub-authority: #{auth}") - end + # Add new term to the authority; it will be rejected if already present + # + # @param auth [String] the authority to add to + # @param label [String] the label to add + def add_new(authority_name, label) + DogBiscuits::Importers::Authority.new(authority_name).create_record(label) if Qa::Authorities::Local.subauthority_for(authority_name).search(label).empty? + rescue Qa::InvalidSubAuthority + Rails.logger.error("Invalid sub-authority: #{auth}") + end end end end diff --git a/lib/dog_biscuits/property_mappings/property_mappings.rb b/lib/dog_biscuits/property_mappings/property_mappings.rb index e81a27e0..dd41cf2c 100644 --- a/lib/dog_biscuits/property_mappings/property_mappings.rb +++ b/lib/dog_biscuits/property_mappings/property_mappings.rb @@ -297,7 +297,7 @@ def property_mappings label: 'Journal name' }, keyword: { - index: [{ link_to_search: true }], + index: [{ link_to_search: true }], label: 'Keywords', schema_org: { property: "keywords" @@ -305,7 +305,7 @@ def property_mappings help_text: "Words or phrases you select to describe what the work is about. These are used to search for content." }, language: { - index: [{ link_to_search: true }], + index: [{ link_to_search: true }], label: 'Language', schema_org: { property: "language" diff --git a/spec/forms/hyrax/forms/collection_form_decorator_spec.rb b/spec/forms/hyrax/forms/collection_form_decorator_spec.rb index ad900e98..eefd9418 100644 --- a/spec/forms/hyrax/forms/collection_form_decorator_spec.rb +++ b/spec/forms/hyrax/forms/collection_form_decorator_spec.rb @@ -11,7 +11,7 @@ let(:repository) { double } # TODO: convert this to a valkyrie test. the factory is creating a valkyrie - # object which is why this fails now. + # object which is why this fails now. xit { is_expected.not_to respond_to :alternative_title } describe 'calling #alternative_title' do diff --git a/spec/services/adventist/text_file_text_extraction_service_spec.rb b/spec/services/adventist/text_file_text_extraction_service_spec.rb index 7791beb7..a1d936ed 100644 --- a/spec/services/adventist/text_file_text_extraction_service_spec.rb +++ b/spec/services/adventist/text_file_text_extraction_service_spec.rb @@ -21,7 +21,7 @@ end describe 'position in the array of Hyrax::DerivativeService.services' do - # TODO: inspect why this is failing + # TODO: inspect why this is failing xit "is in the first position" do expect(Hyrax::DerivativeService.services).to( match_array( diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0e0941bd..ec7b7744 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -12,4 +12,4 @@ end require File.expand_path("hyku_specs/rails_helper.rb", __dir__) -require File.expand_path("hyku_specs/spec_helper.rb", __dir__) \ No newline at end of file +require File.expand_path("hyku_specs/spec_helper.rb", __dir__)