valkyrie 0.0.0 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -3
  3. data/.rubocop.yml +28 -0
  4. data/Gemfile +6 -1
  5. data/README.md +145 -10
  6. data/Rakefile +59 -1
  7. data/bin/console +1 -1
  8. data/config/valkyrie.yml +8 -0
  9. data/db/config.yml +17 -0
  10. data/db/migrate/20160111215816_enable_uuid_extension.rb +6 -0
  11. data/db/migrate/20161007101725_create_orm_resources.rb +10 -0
  12. data/db/migrate/20170124135846_add_model_type_to_orm_resources.rb +6 -0
  13. data/db/migrate/20170531004548_change_model_type_to_internal_model.rb +6 -0
  14. data/db/schema.rb +65 -0
  15. data/db/seeds.rb +8 -0
  16. data/lib/config/database_connection.rb +15 -0
  17. data/lib/generators/valkyrie/resource_generator.rb +27 -0
  18. data/lib/generators/valkyrie/templates/resource.rb.erb +9 -0
  19. data/lib/generators/valkyrie/templates/resource_spec.rb.erb +13 -0
  20. data/lib/valkyrie.rb +76 -1
  21. data/lib/valkyrie/adapter_container.rb +12 -0
  22. data/lib/valkyrie/change_set.rb +84 -0
  23. data/lib/valkyrie/decorators/decorator_list.rb +15 -0
  24. data/lib/valkyrie/decorators/decorator_with_arguments.rb +14 -0
  25. data/lib/valkyrie/derivative_service.rb +42 -0
  26. data/lib/valkyrie/engine.rb +10 -0
  27. data/lib/valkyrie/file_characterization_service.rb +42 -0
  28. data/lib/valkyrie/id.rb +32 -0
  29. data/lib/valkyrie/indexers/access_controls_indexer.rb +19 -0
  30. data/lib/valkyrie/local_file_service.rb +11 -0
  31. data/lib/valkyrie/metadata_adapter.rb +22 -0
  32. data/lib/valkyrie/persist_derivatives.rb +29 -0
  33. data/lib/valkyrie/persistence.rb +14 -0
  34. data/lib/valkyrie/persistence/buffered_persister.rb +28 -0
  35. data/lib/valkyrie/persistence/composite_persister.rb +29 -0
  36. data/lib/valkyrie/persistence/delete_tracking_buffer.rb +21 -0
  37. data/lib/valkyrie/persistence/fedora.rb +11 -0
  38. data/lib/valkyrie/persistence/fedora/list_node.rb +88 -0
  39. data/lib/valkyrie/persistence/fedora/metadata_adapter.rb +45 -0
  40. data/lib/valkyrie/persistence/fedora/ordered_list.rb +146 -0
  41. data/lib/valkyrie/persistence/fedora/ordered_reader.rb +28 -0
  42. data/lib/valkyrie/persistence/fedora/persister.rb +47 -0
  43. data/lib/valkyrie/persistence/fedora/persister/model_converter.rb +199 -0
  44. data/lib/valkyrie/persistence/fedora/persister/orm_converter.rb +338 -0
  45. data/lib/valkyrie/persistence/fedora/persister/resource_factory.rb +21 -0
  46. data/lib/valkyrie/persistence/fedora/query_service.rb +80 -0
  47. data/lib/valkyrie/persistence/memory.rb +8 -0
  48. data/lib/valkyrie/persistence/memory/metadata_adapter.rb +22 -0
  49. data/lib/valkyrie/persistence/memory/persister.rb +58 -0
  50. data/lib/valkyrie/persistence/memory/query_service.rb +86 -0
  51. data/lib/valkyrie/persistence/postgres.rb +6 -0
  52. data/lib/valkyrie/persistence/postgres/metadata_adapter.rb +20 -0
  53. data/lib/valkyrie/persistence/postgres/orm.rb +9 -0
  54. data/lib/valkyrie/persistence/postgres/orm/resource.rb +7 -0
  55. data/lib/valkyrie/persistence/postgres/orm_converter.rb +118 -0
  56. data/lib/valkyrie/persistence/postgres/persister.rb +33 -0
  57. data/lib/valkyrie/persistence/postgres/queries.rb +8 -0
  58. data/lib/valkyrie/persistence/postgres/queries/find_inverse_references_query.rb +31 -0
  59. data/lib/valkyrie/persistence/postgres/queries/find_members_query.rb +33 -0
  60. data/lib/valkyrie/persistence/postgres/queries/find_references_query.rb +33 -0
  61. data/lib/valkyrie/persistence/postgres/query_service.rb +53 -0
  62. data/lib/valkyrie/persistence/postgres/resource_converter.rb +18 -0
  63. data/lib/valkyrie/persistence/postgres/resource_factory.rb +30 -0
  64. data/lib/valkyrie/persistence/solr.rb +6 -0
  65. data/lib/valkyrie/persistence/solr/metadata_adapter.rb +42 -0
  66. data/lib/valkyrie/persistence/solr/model_converter.rb +270 -0
  67. data/lib/valkyrie/persistence/solr/orm_converter.rb +252 -0
  68. data/lib/valkyrie/persistence/solr/persister.rb +32 -0
  69. data/lib/valkyrie/persistence/solr/queries.rb +11 -0
  70. data/lib/valkyrie/persistence/solr/queries/default_paginator.rb +16 -0
  71. data/lib/valkyrie/persistence/solr/queries/find_all_query.rb +33 -0
  72. data/lib/valkyrie/persistence/solr/queries/find_by_id_query.rb +24 -0
  73. data/lib/valkyrie/persistence/solr/queries/find_inverse_references_query.rb +30 -0
  74. data/lib/valkyrie/persistence/solr/queries/find_members_query.rb +43 -0
  75. data/lib/valkyrie/persistence/solr/queries/find_references_query.rb +34 -0
  76. data/lib/valkyrie/persistence/solr/query_service.rb +48 -0
  77. data/lib/valkyrie/persistence/solr/repository.rb +36 -0
  78. data/lib/valkyrie/persistence/solr/resource_factory.rb +24 -0
  79. data/lib/valkyrie/rdf_patches.rb +17 -0
  80. data/lib/valkyrie/resource.rb +106 -0
  81. data/lib/valkyrie/resource/access_controls.rb +13 -0
  82. data/lib/valkyrie/specs/shared_specs.rb +10 -0
  83. data/lib/valkyrie/specs/shared_specs/change_set_persister.rb +60 -0
  84. data/lib/valkyrie/specs/shared_specs/derivative_service.rb +30 -0
  85. data/lib/valkyrie/specs/shared_specs/file.rb +12 -0
  86. data/lib/valkyrie/specs/shared_specs/file_characterization_service.rb +33 -0
  87. data/lib/valkyrie/specs/shared_specs/metadata_adapter.rb +10 -0
  88. data/lib/valkyrie/specs/shared_specs/persister.rb +154 -0
  89. data/lib/valkyrie/specs/shared_specs/queries.rb +128 -0
  90. data/lib/valkyrie/specs/shared_specs/resource.rb +71 -0
  91. data/lib/valkyrie/specs/shared_specs/storage_adapter.rb +44 -0
  92. data/lib/valkyrie/storage.rb +8 -0
  93. data/lib/valkyrie/storage/disk.rb +55 -0
  94. data/lib/valkyrie/storage/fedora.rb +71 -0
  95. data/lib/valkyrie/storage/memory.rb +31 -0
  96. data/lib/valkyrie/storage_adapter.rb +100 -0
  97. data/lib/valkyrie/types.rb +34 -0
  98. data/lib/valkyrie/value_mapper.rb +67 -0
  99. data/lib/valkyrie/version.rb +2 -1
  100. data/lib/valkyrie/vocab/pcdm_use.rb +73 -0
  101. data/valkyrie.gemspec +33 -7
  102. metadata +462 -7
  103. data/.travis.yml +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f119c2f2075460bb5804d672fe7c017834f43474
4
- data.tar.gz: f6669d732ea1c5fa50ca1105a3a763cb7771be0d
3
+ metadata.gz: a5895a08d879fc01c20f546804cb147bb6287f4e
4
+ data.tar.gz: a7934d10ee04ed79c752159001f883aa15a32149
5
5
  SHA512:
6
- metadata.gz: 3b8c59471418f2fe4a55709b80590fb0497817bd5feb6425c0e03cff28e133dd199a0f91ecd316c7f76a5abdbc74066d9ea2ed89210e05f39dfdfa2154d0387b
7
- data.tar.gz: 93a4886173a45f0023db0ffd84da915d36188257a7ad45822b2c9eb0331a8dc162c576cb1fc4008e1cda913f80e0935f7074f7ca09fdfa4f4e7539391091cf73
6
+ metadata.gz: b8e7471ae686bd39aa04dc7e225dffa1348a06716faa4f824f9a11dd50df5e8e55cc8fd6a49fece559391b31840f62395090fa29f8a2a618b648152b1c840d02
7
+ data.tar.gz: da1d0422841bb1f24b902f839c95d754ade7b26b4767b22a22c4f33db9ed84090aab0c53b9d2cab88741d5741ad791a453db52a86cad671c727d454d92d51680
data/.gitignore CHANGED
@@ -7,6 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
-
11
- # rspec failure tracking
12
- .rspec_status
10
+ /vendor
data/.rubocop.yml ADDED
@@ -0,0 +1,28 @@
1
+ inherit_gem:
2
+ bixby: bixby_default.yml
3
+ AllCops:
4
+ DisplayCopNames: true
5
+ TargetRubyVersion: 2.3
6
+ Exclude:
7
+ - 'bin/*'
8
+ - 'db/schema.rb'
9
+ - 'vendor/**/*'
10
+ RSpec/ScatteredSetup:
11
+ Enabled: false
12
+ Metrics/BlockLength:
13
+ Exclude:
14
+ - 'spec/**/*'
15
+ - 'lib/valkyrie/specs/**/*'
16
+ - 'db/schema.rb'
17
+ - 'Rakefile'
18
+ - '*.gemspec'
19
+ RSpec/ExampleLength:
20
+ Enabled: false
21
+ RSpec/MultipleExpectations:
22
+ Enabled: false
23
+ Rails/TimeZone:
24
+ Enabled: false
25
+ Style/PredicateName:
26
+ Exclude:
27
+ - "lib/valkyrie/resource.rb"
28
+ - "lib/valkyrie/persistence/solr/queries/default_paginator.rb"
data/Gemfile CHANGED
@@ -1,4 +1,9 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
+ source 'https://rubygems.org'
2
3
 
3
4
  # Specify your gem's dependencies in valkyrie.gemspec
4
5
  gemspec
6
+
7
+ # Necessary for the --ignore-parent-exclusion feature. Remove when
8
+ # https://github.com/bbatsov/rubocop/pull/4329 is merged.
9
+ gem 'rubocop', github: 'nelsonjr/rubocop', ref: 'a5db18a49b9f318644ae7209c73452fb7bbcdc49'
data/README.md CHANGED
@@ -1,35 +1,170 @@
1
1
  # Valkyrie
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/valkyrie`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ Valkyrie is a gem for enabling multiple backends for storage of files and metadata in Samvera,
4
+ currently developed in a subdirectory of the [proof-of-concept app of the same name](..).
5
+
6
+ [![CircleCI](https://circleci.com/gh/samvera-labs/valkyrie.svg?style=svg)](https://circleci.com/gh/samvera-labs/valkyrie)
7
+ [![Coverage Status](https://coveralls.io/repos/github/samvera-labs/valkyrie/badge.svg?branch=master)](https://coveralls.io/github/samvera-labs/valkyrie?branch=master)
8
+ [![Stories in Ready](https://badge.waffle.io/samvera-labs/valkyrie.png?label=ready&title=Ready)](https://waffle.io/samvera-labs/valkyrie)
4
9
 
5
- TODO: Delete this and the text above, and describe your gem
6
10
 
7
11
  ## Installation
8
12
 
9
13
  Add this line to your application's Gemfile:
10
14
 
11
15
  ```ruby
12
- gem 'valkyrie'
16
+ gem 'valkyrie', github: 'samvera-labs/valkyrie'
13
17
  ```
14
18
 
15
19
  And then execute:
16
20
 
17
21
  $ bundle
18
22
 
19
- Or install it yourself as:
20
23
 
21
- $ gem install valkyrie
24
+ ## Configuration
25
+
26
+ Valkyrie is configured in two places: an initializer that registers the persistence options and a YAML
27
+ configuration file that sets which options are used by default in which environments.
28
+
29
+ ### Sample initializer: `config/initializers/valkyrie.rb`:
30
+
31
+ Here is a sample initializer that registers a couple adapters and storage adapters, in each case linking an
32
+ instance with a short name that can be used to refer to it in your application:
33
+
34
+ ```
35
+ # frozen_string_literal: true
36
+ require 'valkyrie'
37
+ Rails.application.config.to_prepare do
38
+ Valkyrie::MetadataAdapter.register(
39
+ Valkyrie::Persistence::Postgres::MetadataAdapter,
40
+ :postgres
41
+ )
42
+
43
+ Valkyrie::MetadataAdapter.register(
44
+ Valkyrie::Persistence::Memory::MetadataAdapter.new,
45
+ :memory
46
+ )
47
+
48
+ Valkyrie::StorageAdapter.register(
49
+ Valkyrie::Storage::Disk.new(base_path: Rails.root.join("tmp", "files")),
50
+ :disk
51
+ )
52
+
53
+ Valkyrie::StorageAdapter.register(
54
+ Valkyrie::Storage::Fedora.new(connection: ActiveFedora.fedora.connection),
55
+ :fedora
56
+ )
57
+
58
+
59
+ Valkyrie::StorageAdapter.register(
60
+ Valkyrie::Storage::Memory.new,
61
+ :memory
62
+ )
63
+ end
64
+ ```
65
+
66
+ The initializer registers two `Valkyrie::MetadataAdapter` instances for storing metadata:
67
+ * `:postgres` which stores metadata in a PostgreSQL database
68
+ * `:memory` which stores metadata in an in-memory cache (this cache is not persistent, so it is only
69
+ appropriate for testing)
70
+
71
+ Other adapter options include `Valkyrie::Persistence::BufferedPersister` for buffering in memory before bulk
72
+ updating another persister, `Valkyrie::Persistence::CompositePersister` for storing in more than one adapter
73
+ at once, and `Valkyrie::Persistence::Solr` for storing in Solr.
74
+
75
+ The initializer also registers three `Valkyrie::StorageAdapter` instances for storing files:
76
+ * `:disk` which stores files on disk
77
+ * `:fedora` which stores files in Fedora
78
+ * `:memory` which stores files in an in-memory cache (again, not persistent, so this is only appropriate for
79
+ testing)
80
+
81
+ ### Sample configuration: `config/valkyrie.yml`:
82
+
83
+ A sample configuration file that configures your application to use different adapters:
84
+
85
+ ```
86
+ development:
87
+ adapter: postgres
88
+ storage_adapter: disk
89
+
90
+ test:
91
+ adapter: memory
92
+ storage_adapter: memory
93
+
94
+ production:
95
+ adapter: postgres
96
+ storage_adapter: fedora
97
+ ```
98
+
99
+ For each environment, you must set two values:
100
+ * `adapter` is the store where Valkyrie will put the metadata
101
+ * `storage_adapter` is the store where Valkyrie will put the files
102
+
103
+ The values are the short names used in your initializer.
104
+
22
105
 
23
106
  ## Usage
24
107
 
25
- TODO: Write usage instructions here
108
+ ### Define a Custom Work
109
+
110
+ Define a custom work class:
111
+
112
+ ```
113
+ # frozen_string_literal: true
114
+ class MyModel < Valkyrie::Resource
115
+ include Valkyrie::Resource::AccessControls
116
+ attribute :id, Valkyrie::Types::ID.optional # Optional to allow auto-generation of IDs
117
+ attribute :title, Valkyrie::Types::Set # Sets are unordered
118
+ attribute :authors, Valkyrie::Types::Array # Arrays are ordered
119
+ end
120
+ ```
121
+
122
+ #### Work Types Generator
123
+
124
+ To create a custom Valkyrie model in your application, you can use the Rails generator. For example, to
125
+ generate a model named `FooBar` with an unordered `title` field and an ordered `member_ids` field:
126
+
127
+ ```
128
+ rails generate valkyrie:model FooBar title member_ids:array
129
+ ```
130
+
131
+ You can namespace your model class by including a slash in the model name:
132
+
133
+ ```
134
+ rails generate valkyrie:model Foo/Bar title member_ids:array
135
+ ```
136
+
137
+ ### Read and Write Data
138
+
139
+ ```
140
+ # create an object
141
+ object1 = MyModel.new title: 'My Cool Object', authors: ['Jones, Alice', 'Smith, Bob']
142
+ object1 = Persister.save(model: object1)
143
+
144
+ # load an object from the database
145
+ object2 = QueryService.find_by(id: object1.id)
146
+
147
+ # load all objects
148
+ objects = QueryService.find_all
149
+
150
+ # load all MyModel objects
151
+ Valkyrie.config.metadata_adapter.query_service.find_all_of_model(model: MyModel)
152
+ ```
153
+
154
+
155
+ ## Installing a Development environment
156
+
157
+ See the parent app README for [instructions on setting up a development
158
+ environment](../#installing-a-development-environment). To run the test suite:
159
+ 1. Start Solr and Fedora servers for testing with `rake server:test` in the parent app
160
+ 1. Run the gem's RSpec test suite with `cd valkyrie && rspec spec`
161
+
26
162
 
27
- ## Development
163
+ ## License
28
164
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
165
+ Valkyrie is available under [the Apache 2.0 license](../LICENSE).
30
166
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
167
 
33
168
  ## Contributing
34
169
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/valkyrie.
170
+ Bug reports and pull requests are welcome on GitHub at https://github.com/samvera-labs/valkyrie/.
data/Rakefile CHANGED
@@ -1,6 +1,64 @@
1
+ # frozen_string_literal: true
1
2
  require "bundler/gem_tasks"
2
3
  require "rspec/core/rake_task"
4
+ require 'yaml'
5
+ require 'config/database_connection'
6
+ require 'active_record'
3
7
 
4
8
  RSpec::Core::RakeTask.new(:spec)
5
9
 
6
- task :default => :spec
10
+ task default: :spec
11
+ namespace :db do
12
+ task :environment do
13
+ path = File.join(File.dirname(__FILE__), './db/migrate')
14
+ migrations_paths = [path]
15
+ DATABASE_ENV = ENV['RACK_ENV'] || 'test'
16
+ MIGRATIONS_DIR = ENV['MIGRATIONS_DIR'] || migrations_paths
17
+ end
18
+
19
+ task configuration: :environment do
20
+ @config = YAML.safe_load(ERB.new(File.read("db/config.yml")).result)[DATABASE_ENV]
21
+ end
22
+
23
+ task configure_connection: :configuration do
24
+ DatabaseConnection.connect!(DATABASE_ENV)
25
+ ActiveRecord::Base.logger = Logger.new STDOUT if @config['logger']
26
+ end
27
+
28
+ desc 'Create the database from db/config.yml for the current DATABASE_ENV'
29
+ task create: :configure_connection do
30
+ database = ActiveRecord::Tasks::PostgreSQLDatabaseTasks.new(@config)
31
+ database.create
32
+ puts "Database created"
33
+ end
34
+
35
+ desc 'Drops the database for the current DATABASE_ENV'
36
+ task drop: :configure_connection do
37
+ database = ActiveRecord::Tasks::PostgreSQLDatabaseTasks.new(@config)
38
+ database.drop
39
+ puts "Database dropped"
40
+ end
41
+
42
+ desc 'Migrate the database (options: VERSION=x, VERBOSE=false).'
43
+ task migrate: :configure_connection do
44
+ begin
45
+ verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
46
+ version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
47
+ scope = ENV['SCOPE']
48
+ verbose_was = ActiveRecord::Migration.verbose
49
+ ActiveRecord::Migration.verbose = verbose
50
+ ActiveRecord::Migrator.migrate(MIGRATIONS_DIR, version) do |migration|
51
+ scope.blank? || scope == migration.scope
52
+ end
53
+ ActiveRecord::Base.clear_cache!
54
+ ensure
55
+ ActiveRecord::Migration.verbose = verbose_was
56
+ end
57
+ end
58
+
59
+ desc 'Rolls the schema back to the previous version (specify steps w/ STEP=n).'
60
+ task rollback: :configure_connection do
61
+ step = ENV['STEP'] ? ENV['STEP'].to_i : 1
62
+ ActiveRecord::Migrator.rollback(MIGRATIONS_DIR, step)
63
+ end
64
+ end
data/bin/console CHANGED
@@ -11,4 +11,4 @@ require "valkyrie"
11
11
  # Pry.start
12
12
 
13
13
  require "irb"
14
- IRB.start(__FILE__)
14
+ IRB.start
@@ -0,0 +1,8 @@
1
+ ---
2
+ test:
3
+ metadata_adapter: test
4
+ storage_adapter: test
5
+ development:
6
+ metadata_adapter: test
7
+ storage_adapter: test
8
+ production:
data/db/config.yml ADDED
@@ -0,0 +1,17 @@
1
+ development: &default
2
+ adapter: postgresql
3
+ database: Valkyrie_gem_development
4
+ encoding: utf8
5
+ min_messages: warning
6
+ pool: <%= Integer(ENV.fetch("DB_POOL", 5)) %>
7
+ reaping_frequency: <%= Integer(ENV.fetch("DB_REAPING_FREQUENCY", 10)) %>
8
+ timeout: 5000
9
+
10
+ test:
11
+ adapter: postgresql
12
+ encoding: utf8
13
+ min_messages: warning
14
+ pool: <%= Integer(ENV.fetch("DB_POOL", 5)) %>
15
+ reaping_frequency: <%= Integer(ENV.fetch("DB_REAPING_FREQUENCY", 10)) %>
16
+ timeout: 5000
17
+ database: Valkyrie_gem_test
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+ class EnableUuidExtension < ActiveRecord::Migration[5.0]
3
+ def change
4
+ enable_extension 'uuid-ossp'
5
+ end
6
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+ class CreateOrmResources < ActiveRecord::Migration[5.0]
3
+ def change
4
+ create_table :orm_resources, id: :uuid do |t|
5
+ t.jsonb :metadata, null: false, default: {}
6
+ t.timestamps
7
+ end
8
+ add_index :orm_resources, :metadata, using: :gin
9
+ end
10
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+ class AddModelTypeToOrmResources < ActiveRecord::Migration[5.0]
3
+ def change
4
+ add_column :orm_resources, :resource_type, :string
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+ class ChangeModelTypeToInternalModel < ActiveRecord::Migration[5.1]
3
+ def change
4
+ rename_column :orm_resources, :resource_type, :internal_resource
5
+ end
6
+ end
data/db/schema.rb ADDED
@@ -0,0 +1,65 @@
1
+ # This file is auto-generated from the current state of the database. Instead
2
+ # of editing this file, please use the migrations feature of Active Record to
3
+ # incrementally modify your database, and then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your
6
+ # database schema. If you need to create the application database on another
7
+ # system, you should be using db:schema:load, not running all the migrations
8
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
10
+ #
11
+ # It's strongly recommended that you check this file into your version control system.
12
+
13
+ ActiveRecord::Schema.define(version: 20170531004548) do
14
+ # These are extensions that must be enabled in order to support this database
15
+ enable_extension "plpgsql"
16
+ enable_extension "uuid-ossp"
17
+
18
+ create_table "bookmarks", id: :serial, force: :cascade do |t|
19
+ t.integer "user_id", null: false
20
+ t.string "user_type"
21
+ t.string "document_id"
22
+ t.string "document_type"
23
+ t.binary "title"
24
+ t.datetime "created_at", null: false
25
+ t.datetime "updated_at", null: false
26
+ t.index ["document_id"], name: "index_bookmarks_on_document_id"
27
+ t.index ["user_id"], name: "index_bookmarks_on_user_id"
28
+ end
29
+
30
+ create_table "orm_resources", id: :uuid, default: -> { "uuid_generate_v4()" }, force: :cascade do |t|
31
+ t.jsonb "metadata", default: {}, null: false
32
+ t.datetime "created_at", null: false
33
+ t.datetime "updated_at", null: false
34
+ t.string "internal_resource"
35
+ t.index ["metadata"], name: "index_orm_resources_on_metadata", using: :gin
36
+ end
37
+
38
+ create_table "searches", id: :serial, force: :cascade do |t|
39
+ t.binary "query_params"
40
+ t.integer "user_id"
41
+ t.string "user_type"
42
+ t.datetime "created_at", null: false
43
+ t.datetime "updated_at", null: false
44
+ t.index ["user_id"], name: "index_searches_on_user_id"
45
+ end
46
+
47
+ create_table "users", id: :serial, force: :cascade do |t|
48
+ t.string "email", default: "", null: false
49
+ t.string "encrypted_password", default: "", null: false
50
+ t.string "reset_password_token"
51
+ t.datetime "reset_password_sent_at"
52
+ t.datetime "remember_created_at"
53
+ t.integer "sign_in_count", default: 0, null: false
54
+ t.datetime "current_sign_in_at"
55
+ t.datetime "last_sign_in_at"
56
+ t.inet "current_sign_in_ip"
57
+ t.inet "last_sign_in_ip"
58
+ t.datetime "created_at", null: false
59
+ t.datetime "updated_at", null: false
60
+ t.boolean "guest", default: false
61
+ t.index ["email"], name: "index_users_on_email", unique: true
62
+ t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
63
+ end
64
+
65
+ end