enju_nii 0.3.2 → 0.4.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -8
  3. data/{lib/enju_nii/cinii_book.rb → app/models/concerns/enju_nii/enju_manifestation.rb} +19 -17
  4. data/app/models/nii_type.rb +1 -1
  5. data/lib/enju_nii/engine.rb +1 -1
  6. data/lib/enju_nii/version.rb +1 -1
  7. data/lib/enju_nii.rb +1 -22
  8. data/spec/dummy/app/models/user.rb +2 -1
  9. data/spec/dummy/bin/bundle +1 -1
  10. data/spec/dummy/bin/setup +1 -3
  11. data/spec/dummy/bin/update +4 -2
  12. data/spec/dummy/bin/yarn +3 -3
  13. data/spec/dummy/config/application.rb +1 -3
  14. data/spec/dummy/config/database.yml +70 -9
  15. data/spec/dummy/config/environments/test.rb +0 -3
  16. data/spec/dummy/db/migrate/029_create_subjects.rb +3 -6
  17. data/spec/dummy/db/migrate/20081027150907_create_picture_files.rb +2 -0
  18. data/spec/dummy/db/migrate/20100606065209_create_user_has_roles.rb +2 -4
  19. data/spec/dummy/db/migrate/20140122054321_create_profiles.rb +4 -5
  20. data/spec/dummy/db/migrate/20150923173139_add_url_to_classification.rb +5 -0
  21. data/spec/dummy/db/migrate/20150925092505_add_label_to_classification.rb +5 -0
  22. data/spec/dummy/db/migrate/20160319144230_create_issn_records.rb +11 -0
  23. data/spec/dummy/db/migrate/20160506144040_create_isbn_records.rb +11 -0
  24. data/spec/dummy/db/migrate/20170116134107_create_issn_record_and_manifestations.rb +11 -0
  25. data/spec/dummy/db/migrate/20170116134120_create_isbn_record_and_manifestations.rb +11 -0
  26. data/spec/dummy/db/migrate/20190630113817_add_display_name_translations_to_library_group.rb +12 -0
  27. data/spec/dummy/db/migrate/20190630115523_add_login_banner_translations_to_library_group.rb +6 -0
  28. data/spec/dummy/db/migrate/20190630151446_add_display_name_translations_to_role.rb +5 -0
  29. data/spec/dummy/db/migrate/20190712163038_add_display_name_translations_to_carrier_type.rb +21 -0
  30. data/spec/dummy/db/migrate/20190713114940_add_profile_id_to_user.rb +5 -0
  31. data/spec/dummy/db/migrate/20190713115451_add_full_name_translations_to_profile.rb +5 -0
  32. data/spec/dummy/db/schema.rb +157 -231
  33. data/spec/fixtures/agent_types.yml +11 -11
  34. data/spec/fixtures/carrier_types.yml +32 -16
  35. data/spec/fixtures/roles.yml +22 -5
  36. data/spec/models/cinii_book_spec.rb +0 -3
  37. data/spec/rails_helper.rb +5 -2
  38. metadata +239 -355
  39. data/spec/dummy/config/initializers/statesman.rb +0 -3
  40. data/spec/dummy/db/migrate/149_create_message_templates.rb +0 -18
  41. data/spec/dummy/db/migrate/154_create_messages.rb +0 -23
  42. data/spec/dummy/db/migrate/20080819181903_create_message_requests.rb +0 -18
  43. data/spec/dummy/db/migrate/20080830172106_create_exemplifies.rb +0 -13
  44. data/spec/dummy/db/migrate/20090719201843_create_extents.rb +0 -12
  45. data/spec/dummy/db/migrate/20091202124834_create_versions.rb +0 -18
  46. data/spec/dummy/db/migrate/20110913115320_add_lft_and_rgt_to_message.rb +0 -11
  47. data/spec/dummy/db/migrate/20120125050502_add_depth_to_message.rb +0 -6
  48. data/spec/dummy/db/migrate/20121116033446_add_doi_to_manifestation.rb +0 -6
  49. data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +0 -18
  50. data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +0 -18
  51. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +0 -18
  52. data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +0 -22
  53. data/spec/dummy/db/migrate/20160703185015_add_most_recent_to_message_transitions.rb +0 -9
  54. data/spec/dummy/db/migrate/20160814165332_add_most_recent_to_message_request_transitions.rb +0 -9
  55. data/spec/dummy/db/migrate/20190818075603_add_memo_to_manifestation.rb +0 -5
  56. data/spec/dummy/db/migrate/20190818075628_add_memo_to_item.rb +0 -5
  57. data/spec/dummy/db/migrate/20191219122214_create_custom_properties.rb +0 -12
  58. data/spec/dummy/db/migrate/20200425072340_create_manifestation_custom_properties.rb +0 -12
  59. data/spec/dummy/db/migrate/20200425072349_create_item_custom_properties.rb +0 -12
  60. data/spec/dummy/db/migrate/20200425074758_create_manifestation_custom_values.rb +0 -12
  61. data/spec/dummy/db/migrate/20200425074822_create_item_custom_values.rb +0 -12
  62. data/spec/dummy/private/system/resource_export_files/resource_exports/000/000/001/original/resource_export.txt +0 -130
  63. data/spec/factories/identifier.rb +0 -7
  64. data/spec/factories/manifestation.rb +0 -6
  65. data/spec/fixtures/profiles.yml +0 -98
  66. data/spec/models/resource_export_file_spec.rb +0 -38
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79fcbb5dd79539409af40efb05c0a021a7479ded88514a5349db0e4030ef505d
4
- data.tar.gz: 9261f0263245fe76c77e4ce34e914090f9a8dc858a40546a75d25d48cff9a698
3
+ metadata.gz: f93db49ecdf3d0679db81972256c2dca7117fdaa9e35a7a9cd7ec075fac3e853
4
+ data.tar.gz: f3a470f7da35009bc1e6792d9581d055e1d378e2c1e7dc923d4dbff51f6a6b8f
5
5
  SHA512:
6
- metadata.gz: f42e3beab9b8ad6135a802c56432051fec8740b3867f1c28805060dd8a7569c34c62586b055c174b03243bd732ff2fadb8b2345366717b27885b6dc2e1035296
7
- data.tar.gz: 9a1ddd6174c8a144c9818b3a25336b879ce5928b26d8bd69d1ce11493a3b2846a2ef2e77177905a1155c4d79c096cd19e8766d5709a164c4da252c16370ee49c
6
+ metadata.gz: ea58b4f3a7c200ddea937bb347d131d193085cebb1e0c19f2a187a1b112b9786aa720a4cc3d9a296b6097b7a19a11f3da226c333fc6f8d8e5b3568a281a78883
7
+ data.tar.gz: 5fd3256f5b23797132e14abfb17a409e932bddf2eea65d69f86577f5c3968fdeef26bb48b6d6d3c67e68bebe74e301f783fbf0cbaa59bfab60394caf44ef7af0
data/README.md CHANGED
@@ -1,11 +1,6 @@
1
1
  # EnjuNii
2
- [<img src="https://travis-ci.com/next-l/enju_nii.svg?branch=1.3" alt="Build
3
- Status" />](https://travis-ci.com/next-l/enju_nii) [<img
4
- src="https://coveralls.io/repos/next-l/enju_nii/badge.svg?branch=1.3&service=g
5
- ithub" alt="Coverage Status"
6
- />](https://coveralls.io/github/next-l/enju_nii?branch=1.3) [<img
7
- src="https://hakiri.io/github/next-l/enju_nii/1.3.svg" alt="security"
8
- />](https://hakiri.io/github/next-l/enju_nii/1.3)
2
+ [![CircleCI](https://circleci.com/gh/next-l/enju_nii/tree/2.x.svg?style=svg)](https://circleci.com/gh/next-l/enju_nii/tree/2.x)
3
+ [![Coverage Status](https://coveralls.io/repos/github/next-l/enju_nii/badge.svg?branch=2.x)](https://coveralls.io/github/next-l/enju_nii?branch=2.x)
9
4
 
10
5
  CiNii Booksから書誌をインポートするための Enju プラグインです。
11
6
 
@@ -13,7 +8,7 @@ CiNii Booksから書誌をインポートするための Enju プラグインで
13
8
 
14
9
  お使いのenju_leafのGemfile に以下の行を追加してください。
15
10
 
16
- gem 'enju_nii', github: "next-l/enju_nii", branch: '1.3'
11
+ gem 'enju_nii', github: "next-l/enju_nii", branch: '2.x'
17
12
 
18
13
  gemをインストールします。
19
14
 
@@ -39,3 +34,4 @@ This project rocks and uses MIT-LICENSE.
39
34
  ## 製作者・貢献者 (Authors and contributors)
40
35
  * [TANABE, Kosuke](https://github.com/nabeta) ([@nabeta](https://twitter.com/nabeta))
41
36
  * [Project Next-L](https://www.next-l.jp) ([@ProjectNextL](https://twitter.com/ProjectNextL))
37
+
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module EnjuNii
2
- module CiNiiBook
3
- def self.included(base)
4
- base.extend ClassMethods
5
- end
4
+ module EnjuManifestation
5
+ extend ActiveSupport::Concern
6
+
7
+ included do
8
+ belongs_to :nii_type, optional: true
6
9
 
7
- module ClassMethods
8
- def import_from_cinii_books(options)
10
+ def self.import_from_cinii_books(options)
9
11
  # if options[:isbn]
10
12
  lisbn = Lisbn.new(options[:isbn])
11
13
  raise EnjuNii::InvalidIsbn unless lisbn.valid?
@@ -20,7 +22,7 @@ module EnjuNii
20
22
  import_record_from_cinii_books(doc)
21
23
  end
22
24
 
23
- def import_record_from_cinii_books(doc)
25
+ def self.import_record_from_cinii_books(doc)
24
26
  # http://ci.nii.ac.jp/info/ja/api/api_outline.html#cib_od
25
27
  # return nil
26
28
 
@@ -118,7 +120,7 @@ module EnjuNii
118
120
  manifestation
119
121
  end
120
122
 
121
- def search_cinii_book(query, options = {})
123
+ def self.search_cinii_book(query, options = {})
122
124
  options = {p: 1, count: 10, raw: false}.merge(options)
123
125
  doc = nil
124
126
  results = {}
@@ -136,7 +138,7 @@ module EnjuNii
136
138
  end
137
139
  end
138
140
 
139
- def return_rdf(isbn)
141
+ def self.return_rdf(isbn)
140
142
  rss = self.search_cinii_by_isbn(isbn)
141
143
  if rss.channel.totalResults.to_i == 0
142
144
  rss = self.search_cinii_by_isbn(cinii_normalize_isbn(isbn))
@@ -150,7 +152,7 @@ module EnjuNii
150
152
  end
151
153
  end
152
154
 
153
- def search_cinii_by_isbn(isbn)
155
+ def self.search_cinii_by_isbn(isbn)
154
156
  url = "https://ci.nii.ac.jp/books/opensearch/search?isbn=#{isbn}&format=rss"
155
157
  RSS::RDF::Channel.install_text_element("opensearch:totalResults", "http://a9.com/-/spec/opensearch/1.1/", "?", "totalResults", :text, "opensearch:totalResults")
156
158
  RSS::BaseListener.install_get_text_element("http://a9.com/-/spec/opensearch/1.1/", "totalResults", "totalResults=")
@@ -158,7 +160,7 @@ module EnjuNii
158
160
  end
159
161
 
160
162
  private
161
- def cinii_normalize_isbn(isbn)
163
+ def self.cinii_normalize_isbn(isbn)
162
164
  if isbn.length == 10
163
165
  Lisbn.new(isbn).isbn13
164
166
  else
@@ -166,7 +168,7 @@ module EnjuNii
166
168
  end
167
169
  end
168
170
 
169
- def get_cinii_creator(doc)
171
+ def self.get_cinii_creator(doc)
170
172
  doc.xpath("//foaf:maker/foaf:Person").map{|e|
171
173
  {
172
174
  full_name: e.at("./foaf:name").content,
@@ -176,11 +178,11 @@ module EnjuNii
176
178
  }
177
179
  end
178
180
 
179
- def get_cinii_publisher(doc)
181
+ def self.get_cinii_publisher(doc)
180
182
  doc.xpath("//dc:publisher").map{|e| {full_name: e.content}}
181
183
  end
182
184
 
183
- def get_cinii_title(doc)
185
+ def self.get_cinii_title(doc)
184
186
  {
185
187
  original_title: doc.at("//dc:title[not(@xml:lang)]").children.first.content,
186
188
  title_transcription: doc.xpath("//dc:title[@xml:lang]", 'dc': 'http://purl.org/dc/elements/1.1/').map{|e| e.try(:content)}.join("\n"),
@@ -188,7 +190,7 @@ module EnjuNii
188
190
  }
189
191
  end
190
192
 
191
- def get_cinii_language(doc)
193
+ def self.get_cinii_language(doc)
192
194
  language = doc.at("//dc:language").try(:content)
193
195
  if language.size > 3
194
196
  language[0..2]
@@ -197,7 +199,7 @@ module EnjuNii
197
199
  end
198
200
  end
199
201
 
200
- def get_cinii_subjects(doc)
202
+ def self.get_cinii_subjects(doc)
201
203
  subjects = []
202
204
  doc.xpath('//foaf:topic').each do |s|
203
205
  subjects << { term: s["dc:title"] }
@@ -205,7 +207,7 @@ module EnjuNii
205
207
  subjects
206
208
  end
207
209
 
208
- def create_cinii_series_statements(doc, manifestation)
210
+ def self.create_cinii_series_statements(doc, manifestation)
209
211
  series = doc.at("//dcterms:isPartOf")
210
212
  if series and parent_url = series["rdf:resource"]
211
213
  ptbl = series["dc:title"]
@@ -1,4 +1,4 @@
1
- class NiiType < ApplicationRecord
1
+ class NiiType < ActiveRecord::Base
2
2
  include MasterModel
3
3
  has_many :manifestations
4
4
  end
@@ -1,5 +1,5 @@
1
1
  require 'enju_subject'
2
- require 'rss/1.0'
2
+ require 'rss'
3
3
  require 'faraday_middleware'
4
4
 
5
5
  module EnjuNii
@@ -1,3 +1,3 @@
1
1
  module EnjuNii
2
- VERSION = "0.3.2".freeze
2
+ VERSION = "0.4.0.beta.1"
3
3
  end
data/lib/enju_nii.rb CHANGED
@@ -1,31 +1,10 @@
1
- require "enju_nii/engine"
1
+ require 'enju_nii/engine'
2
2
  require 'open-uri'
3
- require 'enju_nii/cinii_book'
4
3
 
5
4
  module EnjuNii
6
- module ActsAsMethods
7
- def self.included(base)
8
- base.extend ClassMethods
9
- end
10
-
11
- module ClassMethods
12
- def enju_nii_cinii_books
13
- include EnjuNii::CiNiiBook
14
- belongs_to :nii_type, optional: true
15
- end
16
-
17
- def import_isbn(isbn)
18
- manifestation = Manifestation.import_from_cinii_books(isbn: isbn)
19
- manifestation
20
- end
21
- end
22
- end
23
-
24
5
  class RecordNotFound < StandardError
25
6
  end
26
7
 
27
8
  class InvalidIsbn < StandardError
28
9
  end
29
10
  end
30
-
31
- ActiveRecord::Base.send :include, EnjuNii::ActsAsMethods
@@ -1,4 +1,4 @@
1
- class User < ApplicationRecord
1
+ class User < ActiveRecord::Base
2
2
  devise :database_authenticatable, #:registerable,
3
3
  :recoverable, :rememberable, :trackable, #, :validatable
4
4
  :lockable, lock_strategy: :none, unlock_strategy: :none
@@ -6,4 +6,5 @@ class User < ApplicationRecord
6
6
  include EnjuSeed::EnjuUser
7
7
  end
8
8
 
9
+ Manifestation.include(EnjuNii::EnjuManifestation)
9
10
  Manifestation.include(EnjuSubject::EnjuManifestation)
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
3
  load Gem.bin_path('bundler', 'bundle')
data/spec/dummy/bin/setup CHANGED
@@ -1,10 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
- require 'pathname'
3
2
  require 'fileutils'
4
3
  include FileUtils
5
4
 
6
5
  # path to your application root.
7
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+ APP_ROOT = File.expand_path('..', __dir__)
8
7
 
9
8
  def system!(*args)
10
9
  system(*args) || abort("\n== Command #{args} failed ==")
@@ -21,7 +20,6 @@ chdir APP_ROOT do
21
20
  # Install JavaScript dependencies if using Yarn
22
21
  # system('bin/yarn')
23
22
 
24
-
25
23
  # puts "\n== Copying sample files =="
26
24
  # unless File.exist?('config/database.yml')
27
25
  # cp 'config/database.yml.sample', 'config/database.yml'
@@ -1,10 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
- require 'pathname'
3
2
  require 'fileutils'
4
3
  include FileUtils
5
4
 
6
5
  # path to your application root.
7
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+ APP_ROOT = File.expand_path('..', __dir__)
8
7
 
9
8
  def system!(*args)
10
9
  system(*args) || abort("\n== Command #{args} failed ==")
@@ -18,6 +17,9 @@ chdir APP_ROOT do
18
17
  system! 'gem install bundler --conservative'
19
18
  system('bundle check') || system!('bundle install')
20
19
 
20
+ # Install JavaScript dependencies if using Yarn
21
+ # system('bin/yarn')
22
+
21
23
  puts "\n== Updating database =="
22
24
  system! 'bin/rails db:migrate'
23
25
 
data/spec/dummy/bin/yarn CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
- VENDOR_PATH = File.expand_path('..', __dir__)
3
- Dir.chdir(VENDOR_PATH) do
2
+ APP_ROOT = File.expand_path('..', __dir__)
3
+ Dir.chdir(APP_ROOT) do
4
4
  begin
5
- exec "yarnpkg #{ARGV.join(" ")}"
5
+ exec "yarnpkg", *ARGV
6
6
  rescue Errno::ENOENT
7
7
  $stderr.puts "Yarn executable was not detected in the system."
8
8
  $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
@@ -4,13 +4,11 @@ require 'rails/all'
4
4
 
5
5
  Bundler.require(*Rails.groups)
6
6
  require "enju_nii"
7
- require "enju_leaf"
8
- require "enju_message"
9
7
 
10
8
  module Dummy
11
9
  class Application < Rails::Application
12
10
  # Initialize configuration defaults for originally generated Rails version.
13
- config.load_defaults 5.2
11
+ config.load_defaults 5.1
14
12
 
15
13
  # Settings in config/environments/* take precedence over those specified here.
16
14
  # Application configuration should go into files in config/initializers
@@ -1,25 +1,86 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
1
+ # PostgreSQL. Versions 9.1 and up are supported.
3
2
  #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
3
+ # Install the pg driver:
4
+ # gem install pg
5
+ # On OS X with Homebrew:
6
+ # gem install pg -- --with-pg-config=/usr/local/bin/pg_config
7
+ # On OS X with MacPorts:
8
+ # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
9
+ # On Windows:
10
+ # gem install pg
11
+ # Choose the win32 build.
12
+ # Install PostgreSQL and put its /bin directory on your path.
13
+ #
14
+ # Configure Using Gemfile
15
+ # gem 'pg'
6
16
  #
7
17
  default: &default
8
- adapter: sqlite3
18
+ adapter: postgresql
19
+ encoding: unicode
20
+ # For details on connection pooling, see Rails configuration guide
21
+ # http://guides.rubyonrails.org/configuring.html#database-pooling
9
22
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
- timeout: 5000
23
+ username: postgres
11
24
 
12
25
  development:
13
26
  <<: *default
14
- database: db/development.sqlite3
27
+ database: enju_nii_dummy_development
28
+
29
+ # The specified database role being used to connect to postgres.
30
+ # To create additional roles in postgres see `$ createuser --help`.
31
+ # When left blank, postgres will use the default role. This is
32
+ # the same name as the operating system user that initialized the database.
33
+ #username: enju_nii_dummy
34
+
35
+ # The password associated with the postgres role (username).
36
+ #password:
37
+
38
+ # Connect on a TCP socket. Omitted by default since the client uses a
39
+ # domain socket that doesn't need configuration. Windows does not have
40
+ # domain sockets, so uncomment these lines.
41
+ #host: localhost
42
+
43
+ # The TCP port the server listens on. Defaults to 5432.
44
+ # If your server runs on a different port number, change accordingly.
45
+ #port: 5432
46
+
47
+ # Schema search path. The server defaults to $user,public
48
+ #schema_search_path: myapp,sharedapp,public
49
+
50
+ # Minimum log levels, in increasing order:
51
+ # debug5, debug4, debug3, debug2, debug1,
52
+ # log, notice, warning, error, fatal, and panic
53
+ # Defaults to warning.
54
+ #min_messages: notice
15
55
 
16
56
  # Warning: The database defined as "test" will be erased and
17
57
  # re-generated from your development database when you run "rake".
18
58
  # Do not set this db to the same as development or production.
19
59
  test:
20
60
  <<: *default
21
- database: db/test.sqlite3
61
+ database: enju_nii_dummy_test
22
62
 
63
+ # As with config/secrets.yml, you never want to store sensitive information,
64
+ # like your database password, in your source code. If your source code is
65
+ # ever seen by anyone, they now have access to your database.
66
+ #
67
+ # Instead, provide the password as a unix environment variable when you boot
68
+ # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
69
+ # for a full rundown on how to provide these environment variables in a
70
+ # production deployment.
71
+ #
72
+ # On Heroku and other platform providers, you may have a full connection URL
73
+ # available as an environment variable. For example:
74
+ #
75
+ # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
76
+ #
77
+ # You can use this database configuration with:
78
+ #
79
+ # production:
80
+ # url: <%= ENV['DATABASE_URL'] %>
81
+ #
23
82
  production:
24
83
  <<: *default
25
- database: db/production.sqlite3
84
+ database: enju_nii_dummy_production
85
+ username: enju_nii_dummy
86
+ password: <%= ENV['DUMMY_DATABASE_PASSWORD'] %>
@@ -39,7 +39,4 @@ Rails.application.configure do
39
39
 
40
40
  # Raises error for missing translations
41
41
  # config.action_view.raise_on_missing_translations = true
42
-
43
- config.action_mailer.default_url_options = {host: 'localhost:3000'}
44
- config.active_job.queue_adapter = :inline
45
42
  end
@@ -1,24 +1,21 @@
1
1
  class CreateSubjects < ActiveRecord::Migration[4.2]
2
2
  def self.up
3
3
  create_table :subjects do |t|
4
- t.integer :parent_id
4
+ t.references :parent, index: true
5
5
  t.integer :use_term_id
6
6
  t.string :term
7
7
  t.text :term_transcription
8
- t.integer :subject_type_id, null: false
8
+ t.references :subject_type, index: true, null: false
9
9
  t.text :scope_note
10
10
  t.text :note
11
- t.integer :required_role_id, default: 1, null: false
11
+ t.references :required_role, index: true, default: 1, null: false
12
12
  t.integer :lock_version, default: 0, null: false
13
13
  t.datetime :created_at
14
14
  t.datetime :updated_at
15
15
  t.datetime :deleted_at
16
16
  end
17
17
  add_index :subjects, :term
18
- add_index :subjects, :parent_id
19
18
  add_index :subjects, :use_term_id
20
- add_index :subjects, :subject_type_id
21
- add_index :subjects, :required_role_id
22
19
  end
23
20
 
24
21
  def self.down
@@ -3,7 +3,9 @@ class CreatePictureFiles < ActiveRecord::Migration[4.2]
3
3
  create_table :picture_files do |t|
4
4
  t.integer :picture_attachable_id
5
5
  t.string :picture_attachable_type
6
+ t.string :content_type
6
7
  t.text :title
8
+ t.string :thumbnail
7
9
  t.integer :position
8
10
 
9
11
  t.timestamps
@@ -1,12 +1,10 @@
1
1
  class CreateUserHasRoles < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :user_has_roles do |t|
4
- t.integer :user_id
5
- t.integer :role_id
4
+ t.references :user, index: true, foreign_key: true, null: false
5
+ t.references :role, index: true, foreign_key: true, null: false
6
6
 
7
7
  t.timestamps
8
8
  end
9
- add_index :user_has_roles, :user_id
10
- add_index :user_has_roles, :role_id
11
9
  end
12
10
  end
@@ -1,20 +1,19 @@
1
1
  class CreateProfiles < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :profiles do |t|
4
- t.integer :user_id
5
- t.integer :user_group_id
6
- t.integer :library_id
4
+ t.references :user, index: true, foreign_key: true
5
+ t.references :user_group, index: true
6
+ t.references :library, index: true
7
7
  t.string :locale
8
8
  t.string :user_number
9
9
  t.text :full_name
10
10
  t.text :note
11
11
  t.text :keyword_list
12
- t.integer :required_role_id
12
+ t.references :required_role, index: false
13
13
 
14
14
  t.timestamps
15
15
  end
16
16
 
17
- add_index :profiles, :user_id
18
17
  add_index :profiles, :user_number, unique: true
19
18
  end
20
19
  end
@@ -0,0 +1,5 @@
1
+ class AddUrlToClassification < ActiveRecord::Migration[4.2]
2
+ def change
3
+ add_column :classifications, :url, :string
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddLabelToClassification < ActiveRecord::Migration[4.2]
2
+ def change
3
+ add_column :classifications, :label, :string
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ class CreateIssnRecords < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :issn_records do |t|
4
+ t.string :body, index: {unique: true}, null: false
5
+ t.string :issn_type
6
+ t.string :source
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ class CreateIsbnRecords < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :isbn_records do |t|
4
+ t.string :body, index: {unique: true}, null: false
5
+ t.string :isbn_type
6
+ t.string :source
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ class CreateIssnRecordAndManifestations < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :issn_record_and_manifestations do |t|
4
+ t.references :issn_record, foreign_key: true, on_delete: :cascade, null: false
5
+ t.references :manifestation, foreign_key: true, on_delete: :cascade, null: false
6
+ t.integer :position
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ class CreateIsbnRecordAndManifestations < ActiveRecord::Migration[5.2]
2
+ def change
3
+ create_table :isbn_record_and_manifestations do |t|
4
+ t.references :isbn_record, foreign_key: true, on_delete: :cascade, null: false
5
+ t.references :manifestation, foreign_key: true, null: false, on_delete: :cascade
6
+ t.integer :position
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,12 @@
1
+ class AddDisplayNameTranslationsToLibraryGroup < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :budget_types, :display_name_translations, :jsonb, default: {}, null: false
4
+ add_column :libraries, :display_name_translations, :jsonb, default: {}, null: false
5
+ add_column :library_groups, :display_name_translations, :jsonb, default: {}, null: false
6
+ add_column :request_status_types, :display_name_translations, :jsonb, default: {}, null: false
7
+ add_column :request_types, :display_name_translations, :jsonb, default: {}, null: false
8
+ add_column :search_engines, :display_name_translations, :jsonb, default: {}, null: false
9
+ add_column :shelves, :display_name_translations, :jsonb, default: {}, null: false
10
+ add_column :user_groups, :display_name_translations, :jsonb, default: {}, null: false
11
+ end
12
+ end
@@ -0,0 +1,6 @@
1
+ class AddLoginBannerTranslationsToLibraryGroup < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :library_groups, :login_banner_translations, :jsonb, default: {}, null: false
4
+ add_column :library_groups, :footer_banner_translations, :jsonb, default: {}, null: false
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class AddDisplayNameTranslationsToRole < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :roles, :display_name_translations, :jsonb, default: {}, null: false
4
+ end
5
+ end
@@ -0,0 +1,21 @@
1
+ class AddDisplayNameTranslationsToCarrierType < ActiveRecord::Migration[5.2]
2
+ def change
3
+ [
4
+ :agent_relationship_types,
5
+ :agent_types,
6
+ :carrier_types,
7
+ :content_types,
8
+ :create_types,
9
+ :form_of_works,
10
+ :frequencies,
11
+ :languages,
12
+ :licenses,
13
+ :manifestation_relationship_types,
14
+ :medium_of_performances,
15
+ :produce_types,
16
+ :realize_types
17
+ ].each do |table|
18
+ add_column table, :display_name_translations, :jsonb, default: {}, null: false
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ class AddProfileIdToUser < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_reference :users, :profile, foreign_key: true
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddFullNameTranslationsToProfile < ActiveRecord::Migration[5.2]
2
+ def change
3
+ add_column :profiles, :full_name_translations, :jsonb, default: {}, null: false
4
+ end
5
+ end