-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is required for adding relatedItem entries on the public xml. Fixes #585
- Loading branch information
Showing
8 changed files
with
135 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class VirtualObjectConstituent < ApplicationRecord | ||
default_scope { order(ordinal: :asc) } | ||
belongs_to :purl | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
db/migrate/20230330202410_create_virtual_object_constituents.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class CreateVirtualObjectConstituents < ActiveRecord::Migration[7.0] | ||
def change | ||
create_table :virtual_object_constituents do |t| | ||
t.references :purl, null: false, foreign_key: true | ||
t.string :has_member, null: false, index: true | ||
t.integer :ordinal, null: false | ||
t.index [:purl_id, :has_member], unique: true | ||
t.index [:purl_id, :ordinal], unique: true | ||
t.timestamps | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
FactoryBot.define do | ||
factory :purl do | ||
sequence :druid do |n| | ||
"druid:zz#{n.to_s * 3}yy#{n.to_s * 4}" | ||
sequence :druid do | ||
"druid:zz#{format('%03d', rand(1000))}yy#{format('%04d', rand(10_000))}" | ||
end | ||
end | ||
end |