diff --git a/Gemfile b/Gemfile index 90dd3a05..38d9df3d 100644 --- a/Gemfile +++ b/Gemfile @@ -55,6 +55,7 @@ group :development, :test do end group :development do + gem 'annotaterb' gem 'dotenv-rails' gem 'letter_opener' gem 'listen' diff --git a/Gemfile.lock b/Gemfile.lock index 146bb578..34e170a7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -91,6 +91,9 @@ GEM actionview (>= 6.0, < 9.0) activerecord (>= 6.0, < 9.0) kaminari (~> 1.2.2) + annotaterb (4.23.0) + activerecord (>= 6.0.0) + activesupport (>= 6.0.0) ansi (1.6.0) ast (2.4.3) aws-eventstream (1.4.0) @@ -465,6 +468,7 @@ PLATFORMS DEPENDENCIES administrate (~> 1.0.0) + annotaterb aws-sdk-rails aws-sdk-s3 aws-sdk-sqs diff --git a/README.md b/README.md index fcaad47c..80811c0b 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ other changes. ### Annotating the database schema -When changing the db schema, please run `bundle exec annotate` to update the +When changing the db schema, please run `bundle exec annotaterb models` to update the model and associated tests to reflect the changes in a nice convenient, consistent way. diff --git a/app/models/advisor_thesis.rb b/app/models/advisor_thesis.rb index d40aba69..f53173d3 100644 --- a/app/models/advisor_thesis.rb +++ b/app/models/advisor_thesis.rb @@ -2,8 +2,13 @@ # # Table name: advisor_theses # -# thesis_id :integer # advisor_id :integer +# thesis_id :integer +# +# Indexes +# +# index_advisor_theses_on_advisor_id (advisor_id) +# index_advisor_theses_on_thesis_id (thesis_id) # class AdvisorThesis < ApplicationRecord belongs_to :thesis diff --git a/app/models/archivematica_accession.rb b/app/models/archivematica_accession.rb index 65a89731..43a55a0f 100644 --- a/app/models/archivematica_accession.rb +++ b/app/models/archivematica_accession.rb @@ -8,6 +8,15 @@ # updated_at :datetime not null # degree_period_id :integer not null # +# Indexes +# +# index_archivematica_accessions_on_accession_number (accession_number) UNIQUE +# index_archivematica_accessions_on_degree_period_id (degree_period_id) UNIQUE +# +# Foreign Keys +# +# degree_period_id (degree_period_id => degree_periods.id) +# # Accession is where we store the Accession Number that is generated in our Archivematica system. It is used in this # application to generate an S3 key that automations in Archivematica can detect and associate with Submission diff --git a/app/models/archivematica_payload.rb b/app/models/archivematica_payload.rb index 42922131..134fe855 100644 --- a/app/models/archivematica_payload.rb +++ b/app/models/archivematica_payload.rb @@ -3,12 +3,20 @@ # Table name: archivematica_payloads # # id :integer not null, primary key -# preservation_status :integer default("unpreserved"), not null # payload_json :text +# preservation_status :integer default("unpreserved"), not null # preserved_at :datetime -# thesis_id :integer not null # created_at :datetime not null # updated_at :datetime not null +# thesis_id :integer not null +# +# Indexes +# +# index_archivematica_payloads_on_thesis_id (thesis_id) +# +# Foreign Keys +# +# thesis_id (thesis_id => theses.id) # # This class assembles a payload to send to the Archival Packaging Tool (APT), which then creates a bag for # preservation. It includes the thesis files, metadata, and checksums. The payload is then serialized to JSON diff --git a/app/models/author.rb b/app/models/author.rb index 6731ac2a..1c12acc5 100644 --- a/app/models/author.rb +++ b/app/models/author.rb @@ -3,12 +3,22 @@ # Table name: authors # # id :integer not null, primary key -# user_id :integer not null -# thesis_id :integer not null # graduation_confirmed :boolean default(FALSE), not null +# proquest_allowed :boolean # created_at :datetime not null # updated_at :datetime not null -# proquest_allowed :boolean +# thesis_id :integer not null +# user_id :integer not null +# +# Indexes +# +# index_authors_on_thesis_id (thesis_id) +# index_authors_on_user_id (user_id) +# +# Foreign Keys +# +# thesis_id (thesis_id => theses.id) +# user_id (user_id => users.id) # class Author < ApplicationRecord belongs_to :user diff --git a/app/models/copyright.rb b/app/models/copyright.rb index 53eb2761..94276495 100644 --- a/app/models/copyright.rb +++ b/app/models/copyright.rb @@ -3,9 +3,9 @@ # Table name: copyrights # # id :integer not null, primary key -# holder :text not null -# display_to_author :boolean not null # display_description :text not null +# display_to_author :boolean not null +# holder :text not null # statement_dspace :text not null # url :text # created_at :datetime not null diff --git a/app/models/degree.rb b/app/models/degree.rb index dd000f62..34e892a5 100644 --- a/app/models/degree.rb +++ b/app/models/degree.rb @@ -3,14 +3,23 @@ # Table name: degrees # # id :integer not null, primary key -# created_at :datetime not null -# updated_at :datetime not null -# code_dw :string not null -# name_dw :string # abbreviation :string +# code_dw :string not null # name_dspace :string +# name_dw :string +# created_at :datetime not null +# updated_at :datetime not null # degree_type_id :integer # +# Indexes +# +# index_degrees_on_code_dw (code_dw) UNIQUE +# index_degrees_on_degree_type_id (degree_type_id) +# +# Foreign Keys +# +# degree_type_id (degree_type_id => degree_types.id) +# class Degree < ApplicationRecord has_many :degree_theses diff --git a/app/models/degree_period.rb b/app/models/degree_period.rb index aa72922d..8b8435f9 100644 --- a/app/models/degree_period.rb +++ b/app/models/degree_period.rb @@ -8,6 +8,10 @@ # created_at :datetime not null # updated_at :datetime not null # +# Indexes +# +# index_degree_periods_on_grad_month_and_grad_year (grad_month,grad_year) UNIQUE +# class DegreePeriod < ApplicationRecord has_paper_trail has_one :archivematica_accession, dependent: :destroy diff --git a/app/models/degree_thesis.rb b/app/models/degree_thesis.rb index 140996ef..3aa664f9 100644 --- a/app/models/degree_thesis.rb +++ b/app/models/degree_thesis.rb @@ -2,8 +2,13 @@ # # Table name: degree_theses # -# thesis_id :integer # degree_id :integer +# thesis_id :integer +# +# Indexes +# +# index_degree_theses_on_degree_id (degree_id) +# index_degree_theses_on_thesis_id (thesis_id) # class DegreeThesis < ApplicationRecord diff --git a/app/models/degree_type.rb b/app/models/degree_type.rb index 58b5fac4..2c7309d0 100644 --- a/app/models/degree_type.rb +++ b/app/models/degree_type.rb @@ -7,6 +7,10 @@ # created_at :datetime not null # updated_at :datetime not null # +# Indexes +# +# index_degree_types_on_name (name) UNIQUE +# class DegreeType < ApplicationRecord validates :name, presence: true end diff --git a/app/models/department.rb b/app/models/department.rb index db4e100b..8028847e 100644 --- a/app/models/department.rb +++ b/app/models/department.rb @@ -3,12 +3,17 @@ # Table name: departments # # id :integer not null, primary key +# authority_key_dspace :string +# code_dw :string default(""), not null +# name_dspace :string # name_dw :string not null # created_at :datetime not null # updated_at :datetime not null -# code_dw :string default(""), not null -# name_dspace :string -# authority_key_dspace :string +# +# Indexes +# +# index_departments_on_code_dw (code_dw) UNIQUE +# index_departments_on_name_dw (name_dw) # class Department < ApplicationRecord diff --git a/app/models/department_thesis.rb b/app/models/department_thesis.rb index 105dd309..0de9c782 100644 --- a/app/models/department_thesis.rb +++ b/app/models/department_thesis.rb @@ -2,10 +2,16 @@ # # Table name: department_theses # -# thesis_id :integer -# department_id :integer # id :integer not null, primary key # primary :boolean default(FALSE), not null +# department_id :integer +# thesis_id :integer +# +# Indexes +# +# department_and_thesis (department_id,thesis_id) UNIQUE +# index_department_theses_on_department_id (department_id) +# index_department_theses_on_thesis_id (thesis_id) # class DepartmentThesis < ApplicationRecord diff --git a/app/models/hold.rb b/app/models/hold.rb index 3d1a19fb..ceece1bb 100644 --- a/app/models/hold.rb +++ b/app/models/hold.rb @@ -3,16 +3,26 @@ # Table name: holds # # id :integer not null, primary key -# thesis_id :integer not null +# case_number :string +# date_end :date not null # date_requested :date not null # date_start :date not null -# date_end :date not null -# hold_source_id :integer not null -# case_number :string -# status :integer not null # processing_notes :text +# status :integer not null # created_at :datetime not null # updated_at :datetime not null +# hold_source_id :integer not null +# thesis_id :integer not null +# +# Indexes +# +# index_holds_on_hold_source_id (hold_source_id) +# index_holds_on_thesis_id (thesis_id) +# +# Foreign Keys +# +# hold_source_id (hold_source_id => hold_sources.id) +# thesis_id (thesis_id => theses.id) # class Hold < ApplicationRecord has_paper_trail diff --git a/app/models/registrar.rb b/app/models/registrar.rb index a7432a7d..33969dc6 100644 --- a/app/models/registrar.rb +++ b/app/models/registrar.rb @@ -3,9 +3,17 @@ # Table name: registrars # # id :integer not null, primary key -# user_id :integer not null # created_at :datetime not null # updated_at :datetime not null +# user_id :integer not null +# +# Indexes +# +# index_registrars_on_user_id (user_id) +# +# Foreign Keys +# +# user_id (user_id => users.id) # class Registrar < ApplicationRecord belongs_to :user diff --git a/app/models/submission_information_package.rb b/app/models/submission_information_package.rb index 216ecfc0..1678b899 100644 --- a/app/models/submission_information_package.rb +++ b/app/models/submission_information_package.rb @@ -3,15 +3,23 @@ # Table name: submission_information_packages # # id :integer not null, primary key -# preserved_at :datetime -# preservation_status :integer default("unpreserved"), not null # bag_declaration :string # bag_name :string # manifest :text # metadata :text -# thesis_id :integer not null +# preservation_status :integer default("unpreserved"), not null +# preserved_at :datetime # created_at :datetime not null # updated_at :datetime not null +# thesis_id :integer not null +# +# Indexes +# +# index_submission_information_packages_on_thesis_id (thesis_id) +# +# Foreign Keys +# +# thesis_id (thesis_id => theses.id) # # This model is no longer used, but it is retained for historical purposes and to preserve existing diff --git a/app/models/submitter.rb b/app/models/submitter.rb index a1eaa74d..8a477378 100644 --- a/app/models/submitter.rb +++ b/app/models/submitter.rb @@ -3,10 +3,20 @@ # Table name: submitters # # id :integer not null, primary key -# user_id :integer not null -# department_id :integer not null # created_at :datetime not null # updated_at :datetime not null +# department_id :integer not null +# user_id :integer not null +# +# Indexes +# +# index_submitters_on_department_id (department_id) +# index_submitters_on_user_id (user_id) +# +# Foreign Keys +# +# department_id (department_id => departments.id) +# user_id (user_id => users.id) # class Submitter < ApplicationRecord belongs_to :user diff --git a/app/models/thesis.rb b/app/models/thesis.rb index af8217ad..59c0d676 100644 --- a/app/models/thesis.rb +++ b/app/models/thesis.rb @@ -3,25 +3,31 @@ # Table name: theses # # id :integer not null, primary key -# title :string # abstract :text -# grad_date :date not null -# created_at :datetime not null -# updated_at :datetime not null -# processor_note :text # author_note :text +# authors_count :integer +# coauthors :string +# dspace_handle :string # files_complete :boolean default(FALSE), not null +# grad_date :date not null +# issues_found :boolean default(FALSE), not null # metadata_complete :boolean default(FALSE), not null +# processor_note :text +# proquest_exported :integer default("Not exported"), not null # publication_status :string default("Not ready for publication"), not null -# coauthors :string +# title :string +# created_at :datetime not null +# updated_at :datetime not null # copyright_id :integer # license_id :integer -# dspace_handle :string -# issues_found :boolean default(FALSE), not null -# authors_count :integer -# proquest_exported :integer default("Not exported"), not null # proquest_export_batch_id :integer # +# Indexes +# +# index_theses_on_copyright_id (copyright_id) +# index_theses_on_license_id (license_id) +# index_theses_on_proquest_export_batch_id (proquest_export_batch_id) +# class Thesis < ApplicationRecord include Baggable diff --git a/app/models/transfer.rb b/app/models/transfer.rb index 8cac9fbc..36d337c2 100644 --- a/app/models/transfer.rb +++ b/app/models/transfer.rb @@ -3,14 +3,24 @@ # Table name: transfers # # id :integer not null, primary key -# user_id :integer not null -# department_id :integer not null +# files_count :integer default(0), not null # grad_date :date not null -# created_at :datetime not null -# updated_at :datetime not null # note :text -# files_count :integer default(0), not null # unassigned_files_count :integer default(0), not null +# created_at :datetime not null +# updated_at :datetime not null +# department_id :integer not null +# user_id :integer not null +# +# Indexes +# +# index_transfers_on_department_id (department_id) +# index_transfers_on_user_id (user_id) +# +# Foreign Keys +# +# department_id (department_id => departments.id) +# user_id (user_id => users.id) # class Transfer < ApplicationRecord belongs_to :user diff --git a/app/models/user.rb b/app/models/user.rb index 15ea53f8..3ff13120 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -3,19 +3,26 @@ # Table name: users # # id :integer not null, primary key -# uid :string not null -# email :string not null # admin :boolean default(FALSE) -# created_at :datetime not null -# updated_at :datetime not null -# role :string default("basic") -# given_name :string -# surname :string -# kerberos_id :string not null # display_name :string not null +# email :string not null +# given_name :string # middle_name :string -# preferred_name :string # orcid :string +# preferred_name :string +# role :string default("basic") +# surname :string +# uid :string not null +# created_at :datetime not null +# updated_at :datetime not null +# kerberos_id :string not null +# +# Indexes +# +# index_users_on_email (email) UNIQUE +# index_users_on_kerberos_id (kerberos_id) UNIQUE +# index_users_on_orcid (orcid) UNIQUE +# index_users_on_uid (uid) UNIQUE # class User < ApplicationRecord diff --git a/test/fixtures/archivematica_accessions.yml b/test/fixtures/archivematica_accessions.yml index 78788f48..6a62db3a 100644 --- a/test/fixtures/archivematica_accessions.yml +++ b/test/fixtures/archivematica_accessions.yml @@ -8,6 +8,15 @@ # updated_at :datetime not null # degree_period_id :integer not null # +# Indexes +# +# index_archivematica_accessions_on_accession_number (accession_number) UNIQUE +# index_archivematica_accessions_on_degree_period_id (degree_period_id) UNIQUE +# +# Foreign Keys +# +# degree_period_id (degree_period_id => degree_periods.id) +# # This model initially had no columns defined. If you add columns to the # model remove the "{}" from the fixture names and add the columns immediately diff --git a/test/fixtures/authors.yml b/test/fixtures/authors.yml index 8f9649b7..4c18b3d5 100644 --- a/test/fixtures/authors.yml +++ b/test/fixtures/authors.yml @@ -3,12 +3,22 @@ # Table name: authors # # id :integer not null, primary key -# user_id :integer not null -# thesis_id :integer not null # graduation_confirmed :boolean default(FALSE), not null +# proquest_allowed :boolean # created_at :datetime not null # updated_at :datetime not null -# proquest_allowed :boolean +# thesis_id :integer not null +# user_id :integer not null +# +# Indexes +# +# index_authors_on_thesis_id (thesis_id) +# index_authors_on_user_id (user_id) +# +# Foreign Keys +# +# thesis_id (thesis_id => theses.id) +# user_id (user_id => users.id) # one: diff --git a/test/fixtures/copyrights.yml b/test/fixtures/copyrights.yml index a304a564..aef334e8 100644 --- a/test/fixtures/copyrights.yml +++ b/test/fixtures/copyrights.yml @@ -3,9 +3,9 @@ # Table name: copyrights # # id :integer not null, primary key -# holder :text not null -# display_to_author :boolean not null # display_description :text not null +# display_to_author :boolean not null +# holder :text not null # statement_dspace :text not null # url :text # created_at :datetime not null diff --git a/test/fixtures/degree_periods.yml b/test/fixtures/degree_periods.yml index 2f1b71aa..be9b964d 100644 --- a/test/fixtures/degree_periods.yml +++ b/test/fixtures/degree_periods.yml @@ -8,6 +8,10 @@ # created_at :datetime not null # updated_at :datetime not null # +# Indexes +# +# index_degree_periods_on_grad_month_and_grad_year (grad_month,grad_year) UNIQUE +# june_2023: grad_month: 'June' diff --git a/test/fixtures/degree_types.yml b/test/fixtures/degree_types.yml index 4e8f21b8..332b8a47 100644 --- a/test/fixtures/degree_types.yml +++ b/test/fixtures/degree_types.yml @@ -7,6 +7,10 @@ # created_at :datetime not null # updated_at :datetime not null # +# Indexes +# +# index_degree_types_on_name (name) UNIQUE +# # This model initially had no columns defined. If you add columns to the # model remove the '{}' from the fixture names and add the columns immediately diff --git a/test/fixtures/degrees.yml b/test/fixtures/degrees.yml index f1c54777..b8ac0c47 100644 --- a/test/fixtures/degrees.yml +++ b/test/fixtures/degrees.yml @@ -3,14 +3,23 @@ # Table name: degrees # # id :integer not null, primary key -# created_at :datetime not null -# updated_at :datetime not null -# code_dw :string not null -# name_dw :string # abbreviation :string +# code_dw :string not null # name_dspace :string +# name_dw :string +# created_at :datetime not null +# updated_at :datetime not null # degree_type_id :integer # +# Indexes +# +# index_degrees_on_code_dw (code_dw) UNIQUE +# index_degrees_on_degree_type_id (degree_type_id) +# +# Foreign Keys +# +# degree_type_id (degree_type_id => degree_types.id) +# # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html diff --git a/test/fixtures/department_theses.yml b/test/fixtures/department_theses.yml index 73dc5ea7..d2790de9 100644 --- a/test/fixtures/department_theses.yml +++ b/test/fixtures/department_theses.yml @@ -2,10 +2,16 @@ # # Table name: department_theses # -# thesis_id :integer -# department_id :integer # id :integer not null, primary key # primary :boolean default(FALSE), not null +# department_id :integer +# thesis_id :integer +# +# Indexes +# +# department_and_thesis (department_id,thesis_id) UNIQUE +# index_department_theses_on_department_id (department_id) +# index_department_theses_on_thesis_id (thesis_id) # primary: @@ -16,4 +22,4 @@ primary: other: thesis: multi_depts department: two - primary: false \ No newline at end of file + primary: false diff --git a/test/fixtures/departments.yml b/test/fixtures/departments.yml index a1b9191e..13d59b0b 100644 --- a/test/fixtures/departments.yml +++ b/test/fixtures/departments.yml @@ -3,12 +3,17 @@ # Table name: departments # # id :integer not null, primary key +# authority_key_dspace :string +# code_dw :string default(""), not null +# name_dspace :string # name_dw :string not null # created_at :datetime not null # updated_at :datetime not null -# code_dw :string default(""), not null -# name_dspace :string -# authority_key_dspace :string +# +# Indexes +# +# index_departments_on_code_dw (code_dw) UNIQUE +# index_departments_on_name_dw (name_dw) # # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html diff --git a/test/fixtures/holds.yml b/test/fixtures/holds.yml index 01f96a8d..f9de2145 100644 --- a/test/fixtures/holds.yml +++ b/test/fixtures/holds.yml @@ -3,16 +3,26 @@ # Table name: holds # # id :integer not null, primary key -# thesis_id :integer not null +# case_number :string +# date_end :date not null # date_requested :date not null # date_start :date not null -# date_end :date not null -# hold_source_id :integer not null -# case_number :string -# status :integer not null # processing_notes :text +# status :integer not null # created_at :datetime not null # updated_at :datetime not null +# hold_source_id :integer not null +# thesis_id :integer not null +# +# Indexes +# +# index_holds_on_hold_source_id (hold_source_id) +# index_holds_on_thesis_id (thesis_id) +# +# Foreign Keys +# +# hold_source_id (hold_source_id => hold_sources.id) +# thesis_id (thesis_id => theses.id) # valid: thesis: with_hold diff --git a/test/fixtures/submission_information_packages.yml b/test/fixtures/submission_information_packages.yml index 970a3d91..34cbb674 100644 --- a/test/fixtures/submission_information_packages.yml +++ b/test/fixtures/submission_information_packages.yml @@ -3,15 +3,23 @@ # Table name: submission_information_packages # # id :integer not null, primary key -# preserved_at :datetime -# preservation_status :integer default("unpreserved"), not null # bag_declaration :string # bag_name :string # manifest :text # metadata :text -# thesis_id :integer not null +# preservation_status :integer default("unpreserved"), not null +# preserved_at :datetime # created_at :datetime not null # updated_at :datetime not null +# thesis_id :integer not null +# +# Indexes +# +# index_submission_information_packages_on_thesis_id (thesis_id) +# +# Foreign Keys +# +# thesis_id (thesis_id => theses.id) # sip_one: preserved_at: Master of Fine Arts diff --git a/test/fixtures/submitters.yml b/test/fixtures/submitters.yml index 0031b218..40c138b3 100644 --- a/test/fixtures/submitters.yml +++ b/test/fixtures/submitters.yml @@ -3,10 +3,20 @@ # Table name: submitters # # id :integer not null, primary key -# user_id :integer not null -# department_id :integer not null # created_at :datetime not null # updated_at :datetime not null +# department_id :integer not null +# user_id :integer not null +# +# Indexes +# +# index_submitters_on_department_id (department_id) +# index_submitters_on_user_id (user_id) +# +# Foreign Keys +# +# department_id (department_id => departments.id) +# user_id (user_id => users.id) # # Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html diff --git a/test/fixtures/theses.yml b/test/fixtures/theses.yml index e201f901..bc3cdbdb 100644 --- a/test/fixtures/theses.yml +++ b/test/fixtures/theses.yml @@ -3,25 +3,31 @@ # Table name: theses # # id :integer not null, primary key -# title :string # abstract :text -# grad_date :date not null -# created_at :datetime not null -# updated_at :datetime not null -# processor_note :text # author_note :text +# authors_count :integer +# coauthors :string +# dspace_handle :string # files_complete :boolean default(FALSE), not null +# grad_date :date not null +# issues_found :boolean default(FALSE), not null # metadata_complete :boolean default(FALSE), not null +# processor_note :text +# proquest_exported :integer default("Not exported"), not null # publication_status :string default("Not ready for publication"), not null -# coauthors :string +# title :string +# created_at :datetime not null +# updated_at :datetime not null # copyright_id :integer # license_id :integer -# dspace_handle :string -# issues_found :boolean default(FALSE), not null -# authors_count :integer -# proquest_exported :integer default("Not exported"), not null # proquest_export_batch_id :integer # +# Indexes +# +# index_theses_on_copyright_id (copyright_id) +# index_theses_on_license_id (license_id) +# index_theses_on_proquest_export_batch_id (proquest_export_batch_id) +# # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html diff --git a/test/fixtures/transfers.yml b/test/fixtures/transfers.yml index 7b256834..561132d7 100644 --- a/test/fixtures/transfers.yml +++ b/test/fixtures/transfers.yml @@ -3,14 +3,24 @@ # Table name: transfers # # id :integer not null, primary key -# user_id :integer not null -# department_id :integer not null +# files_count :integer default(0), not null # grad_date :date not null -# created_at :datetime not null -# updated_at :datetime not null # note :text -# files_count :integer default(0), not null # unassigned_files_count :integer default(0), not null +# created_at :datetime not null +# updated_at :datetime not null +# department_id :integer not null +# user_id :integer not null +# +# Indexes +# +# index_transfers_on_department_id (department_id) +# index_transfers_on_user_id (user_id) +# +# Foreign Keys +# +# department_id (department_id => departments.id) +# user_id (user_id => users.id) # valid: department: one diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index 7647f6f8..9c373572 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -3,19 +3,26 @@ # Table name: users # # id :integer not null, primary key -# uid :string not null -# email :string not null # admin :boolean default(FALSE) -# created_at :datetime not null -# updated_at :datetime not null -# role :string default("basic") -# given_name :string -# surname :string -# kerberos_id :string not null # display_name :string not null +# email :string not null +# given_name :string # middle_name :string -# preferred_name :string # orcid :string +# preferred_name :string +# role :string default("basic") +# surname :string +# uid :string not null +# created_at :datetime not null +# updated_at :datetime not null +# kerberos_id :string not null +# +# Indexes +# +# index_users_on_email (email) UNIQUE +# index_users_on_kerberos_id (kerberos_id) UNIQUE +# index_users_on_orcid (orcid) UNIQUE +# index_users_on_uid (uid) UNIQUE # # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html diff --git a/test/models/archivematica_accession_test.rb b/test/models/archivematica_accession_test.rb index 76f42f33..fca2fab0 100644 --- a/test/models/archivematica_accession_test.rb +++ b/test/models/archivematica_accession_test.rb @@ -8,6 +8,15 @@ # updated_at :datetime not null # degree_period_id :integer not null # +# Indexes +# +# index_archivematica_accessions_on_accession_number (accession_number) UNIQUE +# index_archivematica_accessions_on_degree_period_id (degree_period_id) UNIQUE +# +# Foreign Keys +# +# degree_period_id (degree_period_id => degree_periods.id) +# require "test_helper" class ArchivematicaAccessionTest < ActiveSupport::TestCase diff --git a/test/models/archivematica_payload_test.rb b/test/models/archivematica_payload_test.rb index 6de45836..20b269f6 100644 --- a/test/models/archivematica_payload_test.rb +++ b/test/models/archivematica_payload_test.rb @@ -3,12 +3,20 @@ # Table name: archivematica_payloads # # id :integer not null, primary key -# preservation_status :integer default("unpreserved"), not null # payload_json :text +# preservation_status :integer default("unpreserved"), not null # preserved_at :datetime -# thesis_id :integer not null # created_at :datetime not null # updated_at :datetime not null +# thesis_id :integer not null +# +# Indexes +# +# index_archivematica_payloads_on_thesis_id (thesis_id) +# +# Foreign Keys +# +# thesis_id (thesis_id => theses.id) # require 'test_helper' diff --git a/test/models/author_test.rb b/test/models/author_test.rb index ceb87a92..e791d4f2 100644 --- a/test/models/author_test.rb +++ b/test/models/author_test.rb @@ -3,12 +3,22 @@ # Table name: authors # # id :integer not null, primary key -# user_id :integer not null -# thesis_id :integer not null # graduation_confirmed :boolean default(FALSE), not null +# proquest_allowed :boolean # created_at :datetime not null # updated_at :datetime not null -# proquest_allowed :boolean +# thesis_id :integer not null +# user_id :integer not null +# +# Indexes +# +# index_authors_on_thesis_id (thesis_id) +# index_authors_on_user_id (user_id) +# +# Foreign Keys +# +# thesis_id (thesis_id => theses.id) +# user_id (user_id => users.id) # require 'csv' require 'test_helper' diff --git a/test/models/copyright_test.rb b/test/models/copyright_test.rb index e6081af2..90138930 100644 --- a/test/models/copyright_test.rb +++ b/test/models/copyright_test.rb @@ -3,9 +3,9 @@ # Table name: copyrights # # id :integer not null, primary key -# holder :text not null -# display_to_author :boolean not null # display_description :text not null +# display_to_author :boolean not null +# holder :text not null # statement_dspace :text not null # url :text # created_at :datetime not null diff --git a/test/models/degree_period_test.rb b/test/models/degree_period_test.rb index 7b08a63e..041f3393 100644 --- a/test/models/degree_period_test.rb +++ b/test/models/degree_period_test.rb @@ -8,6 +8,10 @@ # created_at :datetime not null # updated_at :datetime not null # +# Indexes +# +# index_degree_periods_on_grad_month_and_grad_year (grad_month,grad_year) UNIQUE +# require 'test_helper' class DegreePeriodTest < ActiveSupport::TestCase diff --git a/test/models/degree_test.rb b/test/models/degree_test.rb index 841edd58..0e856819 100644 --- a/test/models/degree_test.rb +++ b/test/models/degree_test.rb @@ -3,14 +3,23 @@ # Table name: degrees # # id :integer not null, primary key -# created_at :datetime not null -# updated_at :datetime not null -# code_dw :string not null -# name_dw :string # abbreviation :string +# code_dw :string not null # name_dspace :string +# name_dw :string +# created_at :datetime not null +# updated_at :datetime not null # degree_type_id :integer # +# Indexes +# +# index_degrees_on_code_dw (code_dw) UNIQUE +# index_degrees_on_degree_type_id (degree_type_id) +# +# Foreign Keys +# +# degree_type_id (degree_type_id => degree_types.id) +# require 'test_helper' diff --git a/test/models/degree_type_test.rb b/test/models/degree_type_test.rb index 42cdf8b1..a8f05e7c 100644 --- a/test/models/degree_type_test.rb +++ b/test/models/degree_type_test.rb @@ -7,6 +7,10 @@ # created_at :datetime not null # updated_at :datetime not null # +# Indexes +# +# index_degree_types_on_name (name) UNIQUE +# require 'test_helper' class DegreeTypeTest < ActiveSupport::TestCase diff --git a/test/models/department_test.rb b/test/models/department_test.rb index 9e79302f..200e2557 100644 --- a/test/models/department_test.rb +++ b/test/models/department_test.rb @@ -3,12 +3,17 @@ # Table name: departments # # id :integer not null, primary key +# authority_key_dspace :string +# code_dw :string default(""), not null +# name_dspace :string # name_dw :string not null # created_at :datetime not null # updated_at :datetime not null -# code_dw :string default(""), not null -# name_dspace :string -# authority_key_dspace :string +# +# Indexes +# +# index_departments_on_code_dw (code_dw) UNIQUE +# index_departments_on_name_dw (name_dw) # require 'test_helper' diff --git a/test/models/department_thesis_test.rb b/test/models/department_thesis_test.rb index e364700d..c5a16d45 100644 --- a/test/models/department_thesis_test.rb +++ b/test/models/department_thesis_test.rb @@ -2,10 +2,16 @@ # # Table name: department_theses # -# thesis_id :integer -# department_id :integer # id :integer not null, primary key # primary :boolean default(FALSE), not null +# department_id :integer +# thesis_id :integer +# +# Indexes +# +# department_and_thesis (department_id,thesis_id) UNIQUE +# index_department_theses_on_department_id (department_id) +# index_department_theses_on_thesis_id (thesis_id) # require 'test_helper' diff --git a/test/models/hold_test.rb b/test/models/hold_test.rb index 66e2b2e2..90395222 100644 --- a/test/models/hold_test.rb +++ b/test/models/hold_test.rb @@ -3,16 +3,26 @@ # Table name: holds # # id :integer not null, primary key -# thesis_id :integer not null +# case_number :string +# date_end :date not null # date_requested :date not null # date_start :date not null -# date_end :date not null -# hold_source_id :integer not null -# case_number :string -# status :integer not null # processing_notes :text +# status :integer not null # created_at :datetime not null # updated_at :datetime not null +# hold_source_id :integer not null +# thesis_id :integer not null +# +# Indexes +# +# index_holds_on_hold_source_id (hold_source_id) +# index_holds_on_thesis_id (thesis_id) +# +# Foreign Keys +# +# hold_source_id (hold_source_id => hold_sources.id) +# thesis_id (thesis_id => theses.id) # require 'test_helper' diff --git a/test/models/registrar_test.rb b/test/models/registrar_test.rb index 732ee1e7..e4dd6a91 100644 --- a/test/models/registrar_test.rb +++ b/test/models/registrar_test.rb @@ -3,9 +3,17 @@ # Table name: registrars # # id :integer not null, primary key -# user_id :integer not null # created_at :datetime not null # updated_at :datetime not null +# user_id :integer not null +# +# Indexes +# +# index_registrars_on_user_id (user_id) +# +# Foreign Keys +# +# user_id (user_id => users.id) # require 'test_helper' diff --git a/test/models/submission_information_package_test.rb b/test/models/submission_information_package_test.rb index 5d548d0a..658a7a78 100644 --- a/test/models/submission_information_package_test.rb +++ b/test/models/submission_information_package_test.rb @@ -3,15 +3,23 @@ # Table name: submission_information_packages # # id :integer not null, primary key -# preserved_at :datetime -# preservation_status :integer default("unpreserved"), not null # bag_declaration :string # bag_name :string # manifest :text # metadata :text -# thesis_id :integer not null +# preservation_status :integer default("unpreserved"), not null +# preserved_at :datetime # created_at :datetime not null # updated_at :datetime not null +# thesis_id :integer not null +# +# Indexes +# +# index_submission_information_packages_on_thesis_id (thesis_id) +# +# Foreign Keys +# +# thesis_id (thesis_id => theses.id) # require 'test_helper' diff --git a/test/models/thesis_test.rb b/test/models/thesis_test.rb index 66e7fbf3..744d87cf 100644 --- a/test/models/thesis_test.rb +++ b/test/models/thesis_test.rb @@ -3,25 +3,31 @@ # Table name: theses # # id :integer not null, primary key -# title :string # abstract :text -# grad_date :date not null -# created_at :datetime not null -# updated_at :datetime not null -# processor_note :text # author_note :text +# authors_count :integer +# coauthors :string +# dspace_handle :string # files_complete :boolean default(FALSE), not null +# grad_date :date not null +# issues_found :boolean default(FALSE), not null # metadata_complete :boolean default(FALSE), not null +# processor_note :text +# proquest_exported :integer default("Not exported"), not null # publication_status :string default("Not ready for publication"), not null -# coauthors :string +# title :string +# created_at :datetime not null +# updated_at :datetime not null # copyright_id :integer # license_id :integer -# dspace_handle :string -# issues_found :boolean default(FALSE), not null -# authors_count :integer -# proquest_exported :integer default("Not exported"), not null # proquest_export_batch_id :integer # +# Indexes +# +# index_theses_on_copyright_id (copyright_id) +# index_theses_on_license_id (license_id) +# index_theses_on_proquest_export_batch_id (proquest_export_batch_id) +# require 'csv' require 'test_helper' diff --git a/test/models/transfer_test.rb b/test/models/transfer_test.rb index de9c6081..15771eee 100644 --- a/test/models/transfer_test.rb +++ b/test/models/transfer_test.rb @@ -3,14 +3,24 @@ # Table name: transfers # # id :integer not null, primary key -# user_id :integer not null -# department_id :integer not null +# files_count :integer default(0), not null # grad_date :date not null -# created_at :datetime not null -# updated_at :datetime not null # note :text -# files_count :integer default(0), not null # unassigned_files_count :integer default(0), not null +# created_at :datetime not null +# updated_at :datetime not null +# department_id :integer not null +# user_id :integer not null +# +# Indexes +# +# index_transfers_on_department_id (department_id) +# index_transfers_on_user_id (user_id) +# +# Foreign Keys +# +# department_id (department_id => departments.id) +# user_id (user_id => users.id) # require 'test_helper' diff --git a/test/models/user_test.rb b/test/models/user_test.rb index 742551e9..11bfa6ab 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -3,19 +3,26 @@ # Table name: users # # id :integer not null, primary key -# uid :string not null -# email :string not null # admin :boolean default(FALSE) -# created_at :datetime not null -# updated_at :datetime not null -# role :string default("basic") -# given_name :string -# surname :string -# kerberos_id :string not null # display_name :string not null +# email :string not null +# given_name :string # middle_name :string -# preferred_name :string # orcid :string +# preferred_name :string +# role :string default("basic") +# surname :string +# uid :string not null +# created_at :datetime not null +# updated_at :datetime not null +# kerberos_id :string not null +# +# Indexes +# +# index_users_on_email (email) UNIQUE +# index_users_on_kerberos_id (kerberos_id) UNIQUE +# index_users_on_orcid (orcid) UNIQUE +# index_users_on_uid (uid) UNIQUE # require 'csv'