Skip to content

Commit

Permalink
remove delivery_class field from Endpoint model and endpoints table
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartin-sul committed Jul 17, 2018
1 parent e0aaf35 commit d3b32bb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 15 deletions.
8 changes: 0 additions & 8 deletions app/models/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ class Endpoint < ApplicationRecord
has_many :preserved_copies, dependent: :restrict_with_exception
has_and_belongs_to_many :preservation_policies

# @note Hash values cannot be modified without migrating any associated persisted data.
# @see [enum docs] http://api.rubyonrails.org/classes/ActiveRecord/Enum.html
# TODO: deprecated, remove this field (and drop DB col) once this has transitioned to ArchiveEndpoint
enum delivery_class: {
S3WestDeliveryJob => 1,
S3EastDeliveryJob => 2
}

validates :endpoint_name, presence: true, uniqueness: true
validates :endpoint_node, presence: true
validates :storage_location, presence: true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class RemoveDeliveryClassFromEndpoints < ActiveRecord::Migration[5.1]
def change
remove_column :endpoints, :delivery_class, :integer
end
end
4 changes: 2 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20180712203748) do
ActiveRecord::Schema.define(version: 20180717191117) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

Expand Down Expand Up @@ -47,7 +48,6 @@
t.datetime "updated_at", null: false
t.string "endpoint_node", null: false
t.string "storage_location", null: false
t.integer "delivery_class"
t.index ["endpoint_name"], name: "index_endpoints_on_endpoint_name", unique: true
t.index ["endpoint_node"], name: "index_endpoints_on_endpoint_node"
t.index ["storage_location"], name: "index_endpoints_on_storage_location"
Expand Down
1 change: 0 additions & 1 deletion spec/factories/endpoint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@
end

factory :archive_endpoint_deprecated, parent: :endpoint do
delivery_class 1
end
end
4 changes: 0 additions & 4 deletions spec/models/endpoint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
expect { endpoint.dup.save(validate: false) }.to raise_error(ActiveRecord::RecordNotUnique)
end

it 'has multiple delivery_classes' do
expect(described_class.delivery_classes).to include(S3WestDeliveryJob, S3EastDeliveryJob)
end

it { is_expected.to have_many(:preserved_copies) }
it { is_expected.to have_db_index(:endpoint_name) }
it { is_expected.to have_db_index(:endpoint_node) }
Expand Down

0 comments on commit d3b32bb

Please sign in to comment.