Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ group :development, :test do
end

group :development do
gem 'annotaterb'
gem 'dotenv-rails'
gem 'letter_opener'
gem 'listen'
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -465,6 +468,7 @@ PLATFORMS

DEPENDENCIES
administrate (~> 1.0.0)
annotaterb
aws-sdk-rails
aws-sdk-s3
aws-sdk-sqs
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
7 changes: 6 additions & 1 deletion app/models/advisor_thesis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions app/models/archivematica_accession.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions app/models/archivematica_payload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 13 additions & 3 deletions app/models/author.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions app/models/copyright.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 13 additions & 4 deletions app/models/degree.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions app/models/degree_period.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion app/models/degree_thesis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions app/models/degree_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
11 changes: 8 additions & 3 deletions app/models/department.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 8 additions & 2 deletions app/models/department_thesis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 15 additions & 5 deletions app/models/hold.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion app/models/registrar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 11 additions & 3 deletions app/models/submission_information_package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 12 additions & 2 deletions app/models/submitter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 16 additions & 10 deletions app/models/thesis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading