Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Perma Draft] Valkyrie #478

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ gem 'sidekiq-statistic'
gem 'uuidtools', '~> 2.1.4'

# DLSS/domain-specific dependencies
gem 'cocina-models', '~> 0.6.0'
gem 'cocina-models', '~> 0.7.0'
gem 'dor-services', '~> 8.0'
gem 'dor-workflow-client', '~> 3.9'
gem 'marc'
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ GEM
capistrano-sidekiq (1.0.3)
capistrano (>= 3.9.0)
sidekiq (>= 3.4, < 6.0)
cocina-models (0.6.0)
cocina-models (0.7.0)
dry-struct (~> 1.0)
dry-types (~> 1.1)
zeitwerk (~> 2.1)
Expand Down Expand Up @@ -487,7 +487,7 @@ DEPENDENCIES
capistrano-rails
capistrano-shared_configs
capistrano-sidekiq
cocina-models (~> 0.6.0)
cocina-models (~> 0.7.0)
config
coveralls (~> 0.8)
deprecation
Expand Down
19 changes: 19 additions & 0 deletions app/models/orm/resource.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# frozen_string_literal: true

module Orm
# ActiveRecord class which the Postgres adapter uses for persisting data.
# @!attribute id
# @return [UUID] ID of the record
# @!attribute metadata
# @return [Hash] Hash of all metadata.
# @!attribute created_at
# @return [DateTime] Date created
# @!attribute updated_at
# @return [DateTime] Date updated
# @!attribute internal_resource
# @return [String] Name of {Valkyrie::Resource} model - used for casting.
#
class Resource < ApplicationRecord
self.table_name = 'orm_resources'
end
end
3 changes: 3 additions & 0 deletions app/services/cocina/mapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ def dro_props
embargoReleaseDate: item.embargoMetadata.release_date.iso8601
}
end
props[:structural] = {
contains: item.contentMetadata.resource.id
}
end
end

Expand Down
5 changes: 5 additions & 0 deletions config/settings/development.yml
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
fedora_url: 'http://fedoraAdmin:fedoraAdmin@localhost:8983/fedora'

workflow_url: 'http://localhost:3001/'

solr:
url: 'http://localhost:8984/solr/dorservices'
6 changes: 6 additions & 0 deletions db/migrate/20191022214000_enable_uuid_extension.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class EnableUuidExtension < ActiveRecord::Migration[5.2]
def change
enable_extension 'uuid-ossp'
enable_extension 'pgcrypto'
end
end
9 changes: 9 additions & 0 deletions db/migrate/20191022215628_add_dro_table.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class AddDroTable < ActiveRecord::Migration[5.2]
def change
create_table :orm_resources, id: :uuid do |t|
t.jsonb :metadata, null: false, default: {}
t.timestamps
end
add_index :orm_resources, :metadata, using: :gin
end
end
5 changes: 5 additions & 0 deletions db/migrate/20191023142711_add_model_type_to_orm_resources.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddModelTypeToOrmResources < ActiveRecord::Migration[5.2]
def change
add_column :orm_resources, :resource_type, :string
end
end
61 changes: 60 additions & 1 deletion db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,34 @@ CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';


--
-- Name: pgcrypto; Type: EXTENSION; Schema: -; Owner: -
--

CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA public;


--
-- Name: EXTENSION pgcrypto; Type: COMMENT; Schema: -; Owner: -
--

COMMENT ON EXTENSION pgcrypto IS 'cryptographic functions';


--
-- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: -
--

CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;


--
-- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: -
--

COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)';


--
-- Name: background_job_result_status; Type: TYPE; Schema: public; Owner: -
--
Expand Down Expand Up @@ -81,6 +109,19 @@ CREATE SEQUENCE public.background_job_results_id_seq
ALTER SEQUENCE public.background_job_results_id_seq OWNED BY public.background_job_results.id;


--
-- Name: orm_resources; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.orm_resources (
id uuid DEFAULT public.gen_random_uuid() NOT NULL,
metadata jsonb DEFAULT '{}'::jsonb NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
resource_type character varying
);


--
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
--
Expand Down Expand Up @@ -113,6 +154,14 @@ ALTER TABLE ONLY public.background_job_results
ADD CONSTRAINT background_job_results_pkey PRIMARY KEY (id);


--
-- Name: orm_resources orm_resources_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.orm_resources
ADD CONSTRAINT orm_resources_pkey PRIMARY KEY (id);


--
-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
Expand All @@ -121,6 +170,13 @@ ALTER TABLE ONLY public.schema_migrations
ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);


--
-- Name: index_orm_resources_on_metadata; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_orm_resources_on_metadata ON public.orm_resources USING gin (metadata);


--
-- PostgreSQL database dump complete
--
Expand All @@ -129,6 +185,9 @@ SET search_path TO "$user", public;

INSERT INTO "schema_migrations" (version) VALUES
('20190917215521'),
('20191015193638');
('20191015193638'),
('20191022214000'),
('20191022215628'),
('20191023142711');