enju_event 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -0
- data/app/controllers/concerns/enju_event/enju_libraries_controller.rb +17 -0
- data/app/controllers/event_categories_controller.rb +1 -1
- data/app/controllers/event_export_files_controller.rb +1 -1
- data/app/controllers/event_import_files_controller.rb +3 -2
- data/app/controllers/event_import_results_controller.rb +2 -2
- data/app/controllers/events_controller.rb +7 -1
- data/app/controllers/participates_controller.rb +1 -1
- data/app/jobs/event_export_file_job.rb +1 -1
- data/app/jobs/event_import_file_job.rb +1 -1
- data/app/mailers/event_export_mailer.rb +17 -0
- data/app/mailers/event_import_mailer.rb +17 -0
- data/app/models/concerns/enju_event/enju_library.rb +15 -0
- data/app/models/event.rb +37 -24
- data/app/models/event_category.rb +1 -1
- data/app/models/event_export_file.rb +15 -10
- data/app/models/event_export_file_transition.rb +1 -1
- data/app/models/event_import_file.rb +13 -3
- data/app/models/event_import_file_transition.rb +1 -1
- data/app/models/event_import_result.rb +1 -2
- data/app/models/participate.rb +1 -1
- data/app/models/place.rb +1 -1
- data/app/views/event_export_mailer/completed.en.text.erb +9 -0
- data/app/views/event_export_mailer/completed.ja.text.erb +9 -0
- data/app/views/event_export_mailer/failed.en.text.erb +9 -0
- data/app/views/event_export_mailer/failed.ja.text.erb +9 -0
- data/app/views/event_import_files/_results.html.erb +26 -0
- data/app/views/event_import_files/show.html.erb +70 -74
- data/app/views/event_import_mailer/completed.en.text.erb +9 -0
- data/app/views/event_import_mailer/completed.ja.text.erb +9 -0
- data/app/views/event_import_mailer/failed.en.text.erb +9 -0
- data/app/views/event_import_mailer/failed.ja.text.erb +9 -0
- data/app/views/event_import_results/index.html.erb +0 -11
- data/app/views/events/index.html.erb +22 -22
- data/app/views/events/index.txt.ruby +7 -0
- data/app/views/layouts/mailer.html.erb +13 -0
- data/app/views/layouts/mailer.text.erb +1 -0
- data/config/locales/translation_en.yml +12 -0
- data/config/locales/translation_ja.yml +12 -0
- data/lib/enju_event/version.rb +1 -1
- data/spec/controllers/event_import_files_controller_spec.rb +2 -2
- data/spec/controllers/event_import_results_controller_spec.rb +2 -2
- data/spec/controllers/libraries_controller_spec.rb +41 -0
- data/spec/dummy/app/assets/config/manifest.js +5 -0
- data/spec/dummy/app/jobs/application_job.rb +7 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/models/user.rb +1 -1
- data/spec/dummy/config/application.rb +1 -1
- data/spec/dummy/config/initializers/assets.rb +1 -0
- data/spec/dummy/config/storage.yml +34 -0
- data/spec/dummy/db/migrate/20100606065209_create_user_has_roles.rb +2 -4
- data/spec/dummy/db/migrate/20140122054321_create_profiles.rb +4 -5
- data/spec/dummy/db/migrate/20150421023923_create_identities.rb +14 -0
- data/spec/dummy/db/migrate/20151126005552_add_provider_to_identity.rb +5 -0
- data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +0 -8
- data/spec/dummy/db/migrate/20160319144230_create_issn_records.rb +11 -0
- data/spec/dummy/db/migrate/20160506144040_create_isbn_records.rb +11 -0
- data/spec/dummy/db/migrate/20170116134107_create_issn_record_and_manifestations.rb +11 -0
- data/spec/dummy/db/migrate/20170116134120_create_isbn_record_and_manifestations.rb +11 -0
- data/spec/dummy/db/migrate/20180107162659_add_constraints_to_most_recent_for_message_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20180107162711_add_constraints_to_most_recent_for_message_request_transitions.rb +13 -0
- data/spec/dummy/db/migrate/20181026064038_add_login_banner_to_library_group.rb +6 -0
- data/spec/dummy/db/migrate/20181030072731_add_not_null_to_position_on_carrier_type.rb +14 -0
- data/spec/dummy/db/migrate/20181030074920_add_not_null_to_position_on_library.rb +14 -0
- data/spec/dummy/db/migrate/20190208135957_create_active_storage_tables.active_storage.rb +27 -0
- data/spec/dummy/db/migrate/20190311154610_create_periodicals.rb +10 -0
- data/spec/dummy/db/migrate/20190314151124_add_full_name_translations_to_create.rb +7 -0
- data/spec/dummy/db/schema.rb +114 -25
- data/spec/factories/event_export_file.rb +5 -0
- data/spec/factories/event_import_file.rb +7 -0
- data/spec/factories/event_import_result.rb +6 -0
- data/spec/mailers/event_export_spec.rb +5 -0
- data/spec/mailers/event_import_spec.rb +5 -0
- data/spec/mailers/previews/event_export_preview.rb +4 -0
- data/spec/mailers/previews/event_import_preview.rb +4 -0
- data/spec/models/event_export_file_spec.rb +1 -1
- data/spec/models/event_import_file_spec.rb +1 -1
- data/spec/rails_helper.rb +6 -0
- data/spec/system/event_import_results_spec.rb +17 -0
- data/spec/system/events_spec.rb +22 -0
- data/spec/views/events/index.json.jbuilder_spec.rb +22 -0
- metadata +153 -9
- data/README.rdoc +0 -10
- data/spec/support/resque.rb +0 -32
@@ -36,15 +36,4 @@
|
|
36
36
|
</div>
|
37
37
|
|
38
38
|
<div id="submenu" class="ui-corner-all ui-widget-content">
|
39
|
-
<ul>
|
40
|
-
<li>
|
41
|
-
<% if @event_import_file %>
|
42
|
-
<%= link_to (image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), event_import_results_path(event_import_file_id: @event_import_file.id, format: :txt, locale: @locale.to_s) -%>
|
43
|
-
(<%= link_to 'TSV', event_import_results_path(event_import_file_id: @event_import_file.id, format: :txt, locale: @locale.to_s) -%>)
|
44
|
-
<% else %>
|
45
|
-
<%= link_to (image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), event_import_results_path(format: :txt, locale: @locale.to_s) -%>
|
46
|
-
(<%= link_to 'TSV', event_import_results_path(format: :txt, locale: @locale.to_s) -%>)
|
47
|
-
<% end %>
|
48
|
-
</li>
|
49
|
-
</ul>
|
50
39
|
</div>
|
@@ -22,17 +22,17 @@
|
|
22
22
|
<p>
|
23
23
|
<%- case params[:mode]
|
24
24
|
when 'upcoming' -%>
|
25
|
-
<%= link_to t('event.all'), url_for(
|
25
|
+
<%= link_to t('event.all'), url_for(filtered_params.merge(mode: nil, only_path: true)) -%>
|
26
26
|
<strong><%= t('event.upcoming') -%></strong>
|
27
|
-
<%= link_to t('event.past'), url_for(
|
27
|
+
<%= link_to t('event.past'), url_for(filtered_params.merge(mode: 'past', only_path: true)) -%>
|
28
28
|
<%- when 'past' -%>
|
29
|
-
<%= link_to t('event.all'), url_for(
|
30
|
-
<%= link_to t('event.upcoming'), url_for(
|
29
|
+
<%= link_to t('event.all'), url_for(filtered_params.merge(mode: nil, only_path: true)) -%>
|
30
|
+
<%= link_to t('event.upcoming'), url_for(filtered_params.merge(mode: 'upcoming', only_path: true)) -%>
|
31
31
|
<strong><%= t('event.past') -%></strong>
|
32
32
|
<%- else -%>
|
33
33
|
<strong><%= t('event.all') -%></strong>
|
34
|
-
<%= link_to t('event.upcoming'), url_for(
|
35
|
-
<%= link_to t('event.past'), url_for(
|
34
|
+
<%= link_to t('event.upcoming'), url_for(filtered_params.merge(mode: 'upcoming', only_path: true)) -%>
|
35
|
+
<%= link_to t('event.past'), url_for(filtered_params.merge(mode: 'past', only_path: true)) -%>
|
36
36
|
<%- end -%>
|
37
37
|
</p>
|
38
38
|
|
@@ -77,9 +77,9 @@
|
|
77
77
|
<div id="submenu" class="ui-corner-all ui-widget-content">
|
78
78
|
<ul>
|
79
79
|
<% if params[:mode] == 'calendar' %>
|
80
|
-
<li><%= link_to t('event.table'), url_for(
|
80
|
+
<li><%= link_to t('event.table'), url_for(filtered_params.merge(mode: nil)) -%></li>
|
81
81
|
<% else %>
|
82
|
-
<li><%= link_to t('event.calendar'), url_for(
|
82
|
+
<li><%= link_to t('event.calendar'), url_for(filtered_params.merge(mode: 'calendar')) -%></li>
|
83
83
|
<% end %>
|
84
84
|
</ul>
|
85
85
|
<ul>
|
@@ -95,28 +95,28 @@
|
|
95
95
|
<%- end -%>
|
96
96
|
</ul>
|
97
97
|
<ul>
|
98
|
-
<li><%= link_to t('event.all_libraries'),
|
98
|
+
<li><%= link_to t('event.all_libraries'), url_for(filtered_params.merge(library_id: nil, page: nil)) -%></li>
|
99
99
|
<%- @libraries.each do |library| -%>
|
100
|
-
<li><%= link_to library.display_name.localize,
|
100
|
+
<li><%= link_to library.display_name.localize, url_for(filtered_params.merge(library_id: library.name, mode: params[:mode])) -%></li>
|
101
101
|
<%- end -%>
|
102
102
|
</ul>
|
103
103
|
<p>
|
104
104
|
<%- if @library -%>
|
105
|
-
<%= link_to (image_tag 'icons/feed.png', size: '16x16', class: 'enju_icon', alt: t('page.feed')),
|
106
|
-
(<%= link_to 'RSS',
|
107
|
-
<%= link_to (image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'),
|
108
|
-
(<%= link_to 'TSV',
|
105
|
+
<%= link_to (image_tag 'icons/feed.png', size: '16x16', class: 'enju_icon', alt: t('page.feed')), url_for(filtered_params.merge(library_id: @library.name, format: :rss, page: nil)) -%>
|
106
|
+
(<%= link_to 'RSS', url_for(filtered_params.merge(library_id: @library.name, format: :rss, page: nil)) -%>)
|
107
|
+
<%= link_to (image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), url_for(filtered_params.merge(library_id: @library.name, format: :txt, locale: @locale.to_s)) -%>
|
108
|
+
(<%= link_to 'TSV', url_for(filtered_params.merge(library_id: @library.name, format: :txt, locale: @locale.to_s)) -%>)
|
109
109
|
<br />
|
110
|
-
<%= link_to (image_tag 'icons/calendar.png', size: '16x16', class: 'enju_icon', alt: 'iCalendar'),
|
111
|
-
(<%= link_to 'iCalendar',
|
110
|
+
<%= link_to (image_tag 'icons/calendar.png', size: '16x16', class: 'enju_icon', alt: 'iCalendar'), url_for(filtered_params.merge(library_id: @library.name, format: :ics, locale: @locale.to_s)) -%>
|
111
|
+
(<%= link_to 'iCalendar', url_for(filtered_params.merge(library_id: @library.name, format: :ics, locale: @locale.to_s)) -%>)
|
112
112
|
<%- else -%>
|
113
|
-
<%= link_to (image_tag 'icons/feed.png', size: '16x16', class: 'enju_icon', alt: t('page.feed')),
|
114
|
-
(<%= link_to 'RSS',
|
115
|
-
<%= link_to (image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'),
|
116
|
-
(<%= link_to 'TSV',
|
113
|
+
<%= link_to (image_tag 'icons/feed.png', size: '16x16', class: 'enju_icon', alt: t('page.feed')), url_for(filtered_params.merge(format: :rss)) -%>
|
114
|
+
(<%= link_to 'RSS', url_for(filtered_params.merge(format: :rss)) -%>)
|
115
|
+
<%= link_to (image_tag 'icons/page_white_excel.png', size: '16x16', class: 'enju_icon', alt: 'TSV'), url_for(filtered_params.merge(format: :txt, locale: @locale.to_s)) -%>
|
116
|
+
(<%= link_to 'TSV', url_for(filtered_params.merge(format: :txt, locale: @locale.to_s)) -%>)
|
117
117
|
<br />
|
118
|
-
<%= link_to (image_tag 'icons/calendar.png', size: '16x16', class: 'enju_icon', alt: 'iCalendar'),
|
119
|
-
(<%= link_to 'iCalendar',
|
118
|
+
<%= link_to (image_tag 'icons/calendar.png', size: '16x16', class: 'enju_icon', alt: 'iCalendar'), url_for(filtered_params.merge(format: :ics, locale: @locale.to_s)) -%>
|
119
|
+
(<%= link_to 'iCalendar', url_for(filtered_params.merge(format: :ics, locale: @locale.to_s)) -%>)
|
120
120
|
<%- end -%>
|
121
121
|
</p>
|
122
122
|
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -38,6 +38,7 @@ en:
|
|
38
38
|
default_event_category_id: Default event category
|
39
39
|
event_import_result:
|
40
40
|
body: Body
|
41
|
+
lineno: Line
|
41
42
|
event_export_file:
|
42
43
|
event_export_file_name: Filename
|
43
44
|
event_export_file_size: Size
|
@@ -56,3 +57,14 @@ en:
|
|
56
57
|
event_import_file:
|
57
58
|
default_library: If "library" column is not set in the TSV file, this library is set to the new event.
|
58
59
|
default_event_category: If "event_category" column is not set in the TSV file, this event category is set to the new event.
|
60
|
+
|
61
|
+
event_import_mailer:
|
62
|
+
completed:
|
63
|
+
subject: 'Import completed'
|
64
|
+
failed:
|
65
|
+
subject: 'Import failed'
|
66
|
+
event_export_mailer:
|
67
|
+
completed:
|
68
|
+
subject: 'Export completed'
|
69
|
+
failed:
|
70
|
+
subject: 'Export failed'
|
@@ -38,6 +38,7 @@ ja:
|
|
38
38
|
default_event_category_id: 既定の催し物の種別
|
39
39
|
event_import_result:
|
40
40
|
body: 本文
|
41
|
+
lineno: 行数
|
41
42
|
event_export_file:
|
42
43
|
event_export_file_name: ファイル名
|
43
44
|
event_export_file_size: ファイルサイズ
|
@@ -58,3 +59,14 @@ ja:
|
|
58
59
|
event_import_file:
|
59
60
|
default_library: TSVファイルで"library"列が指定されていない場合、この図書館が登録されます。
|
60
61
|
default_event_category: TSVファイルで"event_category"列が指定されていない場合、この種別が登録されます。
|
62
|
+
|
63
|
+
event_import_mailer:
|
64
|
+
completed:
|
65
|
+
subject: 'インポートが完了しました'
|
66
|
+
failed:
|
67
|
+
subject: 'インポートに失敗しました'
|
68
|
+
event_export_mailer:
|
69
|
+
completed:
|
70
|
+
subject: 'エクスポートが完了しました'
|
71
|
+
failed:
|
72
|
+
subject: 'エクスポートに失敗しました'
|
data/lib/enju_event/version.rb
CHANGED
@@ -9,7 +9,7 @@ describe EventImportFilesController do
|
|
9
9
|
|
10
10
|
it "assigns all event_import_files as @event_import_files" do
|
11
11
|
get :index
|
12
|
-
assigns(:event_import_files).should eq(EventImportFile.page(1))
|
12
|
+
assigns(:event_import_files).should eq(EventImportFile.order(created_at: :desc).page(1))
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -18,7 +18,7 @@ describe EventImportFilesController do
|
|
18
18
|
|
19
19
|
it "assigns all event_import_files as @event_import_files" do
|
20
20
|
get :index
|
21
|
-
assigns(:event_import_files).should eq(EventImportFile.page(1))
|
21
|
+
assigns(:event_import_files).should eq(EventImportFile.order(created_at: :desc).page(1))
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -9,7 +9,7 @@ describe EventImportResultsController do
|
|
9
9
|
|
10
10
|
it "assigns all event_import_results as @event_import_results" do
|
11
11
|
get :index
|
12
|
-
assigns(:event_import_results).should eq(EventImportResult.page(1))
|
12
|
+
assigns(:event_import_results).should eq(EventImportResult.order(created_at: :desc).page(1))
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -18,7 +18,7 @@ describe EventImportResultsController do
|
|
18
18
|
|
19
19
|
it "assigns all event_import_results as @event_import_results" do
|
20
20
|
get :index
|
21
|
-
assigns(:event_import_results).should eq(EventImportResult.page(1))
|
21
|
+
assigns(:event_import_results).should eq(EventImportResult.order(created_at: :desc).page(1))
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'rails_helper'
|
2
|
+
|
3
|
+
describe LibrariesController do
|
4
|
+
fixtures :all
|
5
|
+
|
6
|
+
describe 'GET show', solr: true do
|
7
|
+
describe 'When logged in as Administrator' do
|
8
|
+
login_fixture_admin
|
9
|
+
|
10
|
+
it 'assigns the requested library as @library' do
|
11
|
+
get :show, params: { id: libraries(:library_00001).id }
|
12
|
+
assigns(:library).should eq(libraries(:library_00001))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'When logged in as Librarian' do
|
17
|
+
login_fixture_librarian
|
18
|
+
|
19
|
+
it 'assigns the requested library as @library' do
|
20
|
+
get :show, params: { id: libraries(:library_00001).id }
|
21
|
+
assigns(:library).should eq(libraries(:library_00001))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe 'When logged in as User' do
|
26
|
+
login_fixture_user
|
27
|
+
|
28
|
+
it 'assigns the requested library as @library' do
|
29
|
+
get :show, params: { id: libraries(:library_00001).id }
|
30
|
+
assigns(:library).should eq(libraries(:library_00001))
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'When not logged in' do
|
35
|
+
it 'assigns the requested library as @library' do
|
36
|
+
get :show, params: { id: libraries(:library_00001).id }
|
37
|
+
assigns(:library).should eq(libraries(:library_00001))
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class ApplicationJob < ActiveJob::Base
|
2
|
+
# Automatically retry jobs that encountered a deadlock
|
3
|
+
# retry_on ActiveRecord::Deadlocked
|
4
|
+
|
5
|
+
# Most jobs are safe to ignore if the underlying records are no longer available
|
6
|
+
# discard_on ActiveJob::DeserializationError
|
7
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class User <
|
1
|
+
class User < ApplicationRecord
|
2
2
|
# Include default devise modules. Others available are:
|
3
3
|
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
|
4
4
|
devise :database_authenticatable, #:registerable,
|
@@ -10,7 +10,7 @@ require "resque/server"
|
|
10
10
|
module Dummy
|
11
11
|
class Application < Rails::Application
|
12
12
|
# Initialize configuration defaults for originally generated Rails version.
|
13
|
-
config.load_defaults 5.
|
13
|
+
config.load_defaults 5.2
|
14
14
|
|
15
15
|
# Settings in config/environments/* take precedence over those specified here.
|
16
16
|
# Application configuration should go into files in config/initializers
|
@@ -12,3 +12,4 @@ Rails.application.config.assets.paths << Rails.root.join('node_modules')
|
|
12
12
|
# application.js, application.css, and all non-JS/CSS in the app/assets
|
13
13
|
# folder are already added.
|
14
14
|
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
|
15
|
+
Rails.application.config.assets.precompile += %w( icons/*.png )
|
@@ -0,0 +1,34 @@
|
|
1
|
+
test:
|
2
|
+
service: Disk
|
3
|
+
root: <%= Rails.root.join("tmp/storage") %>
|
4
|
+
|
5
|
+
local:
|
6
|
+
service: Disk
|
7
|
+
root: <%= Rails.root.join("storage") %>
|
8
|
+
|
9
|
+
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
|
10
|
+
# amazon:
|
11
|
+
# service: S3
|
12
|
+
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
13
|
+
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
14
|
+
# region: us-east-1
|
15
|
+
# bucket: your_own_bucket
|
16
|
+
|
17
|
+
# Remember not to checkin your GCS keyfile to a repository
|
18
|
+
# google:
|
19
|
+
# service: GCS
|
20
|
+
# project: your_project
|
21
|
+
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
|
22
|
+
# bucket: your_own_bucket
|
23
|
+
|
24
|
+
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
25
|
+
# microsoft:
|
26
|
+
# service: AzureStorage
|
27
|
+
# storage_account_name: your_account_name
|
28
|
+
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
|
29
|
+
# container: your_container_name
|
30
|
+
|
31
|
+
# mirror:
|
32
|
+
# service: Mirror
|
33
|
+
# primary: local
|
34
|
+
# mirrors: [ amazon, google, microsoft ]
|
@@ -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.
|
5
|
-
t.
|
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.
|
5
|
-
t.
|
6
|
-
t.
|
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.
|
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,14 @@
|
|
1
|
+
class CreateIdentities < ActiveRecord::Migration[4.2]
|
2
|
+
def change
|
3
|
+
create_table :identities do |t|
|
4
|
+
t.string :name
|
5
|
+
t.string :email
|
6
|
+
t.string :password_digest
|
7
|
+
t.references :profile, index: true
|
8
|
+
|
9
|
+
t.timestamps null: false
|
10
|
+
end
|
11
|
+
add_index :identities, :name
|
12
|
+
add_index :identities, :email
|
13
|
+
end
|
14
|
+
end
|
@@ -8,19 +8,11 @@ class AddTranslationTableToLibraryGroup < ActiveRecord::Migration[4.2]
|
|
8
8
|
migrate_data: true
|
9
9
|
})
|
10
10
|
end
|
11
|
-
|
12
|
-
if defined?(AwesomeHstoreTranslate)
|
13
|
-
add_column :library_groups, :login_banner, :hstore
|
14
|
-
end
|
15
11
|
end
|
16
12
|
|
17
13
|
def down
|
18
14
|
if defined?(Globalize)
|
19
15
|
LibraryGroup.drop_translation_table! migrate_data: true
|
20
16
|
end
|
21
|
-
|
22
|
-
if defined?(AwesomeHstoreTranslate)
|
23
|
-
remove_column :library_groups, :login_banner
|
24
|
-
end
|
25
17
|
end
|
26
18
|
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
|
data/spec/dummy/db/migrate/20180107162659_add_constraints_to_most_recent_for_message_transitions.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
class AddConstraintsToMostRecentForMessageTransitions < ActiveRecord::Migration[5.2]
|
2
|
+
disable_ddl_transaction!
|
3
|
+
|
4
|
+
def up
|
5
|
+
add_index :message_transitions, [:message_id, :most_recent], unique: true, where: "most_recent", name: "index_message_transitions_parent_most_recent" # , algorithm: :concurrently
|
6
|
+
change_column_null :message_transitions, :most_recent, false
|
7
|
+
end
|
8
|
+
|
9
|
+
def down
|
10
|
+
remove_index :message_transitions, name: "index_message_transitions_parent_most_recent"
|
11
|
+
change_column_null :message_transitions, :most_recent, true
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class AddConstraintsToMostRecentForMessageRequestTransitions < ActiveRecord::Migration[5.2]
|
2
|
+
disable_ddl_transaction!
|
3
|
+
|
4
|
+
def up
|
5
|
+
add_index :message_request_transitions, [:message_request_id, :most_recent], unique: true, where: "most_recent", name: "index_message_request_transitions_parent_most_recent" # , algorithm: :concurrently
|
6
|
+
change_column_null :message_request_transitions, :most_recent, false
|
7
|
+
end
|
8
|
+
|
9
|
+
def down
|
10
|
+
remove_index :message_request_transitions, name: "index_message_request_transitions_parent_most_recent"
|
11
|
+
change_column_null :message_request_transitions, :most_recent, true
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
class AddLoginBannerToLibraryGroup < 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,14 @@
|
|
1
|
+
class AddNotNullToPositionOnCarrierType < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
change_column :carrier_types, :position, :integer, null: false, default: 1
|
4
|
+
change_column :content_types, :position, :integer, null: false, default: 1
|
5
|
+
change_column :frequencies, :position, :integer, null: false, default: 1
|
6
|
+
change_column :licenses, :position, :integer, null: false, default: 1
|
7
|
+
change_column :creates, :position, :integer, null: false, default: 1
|
8
|
+
change_column :realizes, :position, :integer, null: false, default: 1
|
9
|
+
change_column :produces, :position, :integer, null: false, default: 1
|
10
|
+
change_column :owns, :position, :integer, null: false, default: 1
|
11
|
+
change_column :form_of_works, :position, :integer, null: false, default: 1
|
12
|
+
change_column :agent_types, :position, :integer, null: false, default: 1
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class AddNotNullToPositionOnLibrary < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
change_column :libraries, :position, :integer, null: false, default: 1
|
4
|
+
change_column :shelves, :position, :integer, null: false, default: 1
|
5
|
+
change_column :library_groups, :position, :integer, null: false, default: 1
|
6
|
+
change_column :user_groups, :position, :integer, null: false, default: 1
|
7
|
+
change_column :bookstores, :position, :integer, null: false, default: 1
|
8
|
+
change_column :budget_types, :position, :integer, null: false, default: 1
|
9
|
+
change_column :colors, :position, :integer, null: false, default: 1
|
10
|
+
change_column :request_types, :position, :integer, null: false, default: 1
|
11
|
+
change_column :request_status_types, :position, :integer, null: false, default: 1
|
12
|
+
change_column :search_engines, :position, :integer, null: false, default: 1
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# This migration comes from active_storage (originally 20170806125915)
|
2
|
+
class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
|
3
|
+
def change
|
4
|
+
create_table :active_storage_blobs do |t|
|
5
|
+
t.string :key, null: false
|
6
|
+
t.string :filename, null: false
|
7
|
+
t.string :content_type
|
8
|
+
t.text :metadata
|
9
|
+
t.bigint :byte_size, null: false
|
10
|
+
t.string :checksum, null: false
|
11
|
+
t.datetime :created_at, null: false
|
12
|
+
|
13
|
+
t.index [ :key ], unique: true
|
14
|
+
end
|
15
|
+
|
16
|
+
create_table :active_storage_attachments do |t|
|
17
|
+
t.string :name, null: false
|
18
|
+
t.references :record, null: false, polymorphic: true, index: false
|
19
|
+
t.references :blob, null: false
|
20
|
+
|
21
|
+
t.datetime :created_at, null: false
|
22
|
+
|
23
|
+
t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
|
24
|
+
t.foreign_key :active_storage_blobs, column: :blob_id
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class AddFullNameTranslationsToCreate < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
add_column :creates, :full_name_translations, :jsonb, default: {}
|
4
|
+
add_column :realizes, :full_name_translations, :jsonb, default: {}
|
5
|
+
add_column :produces, :full_name_translations, :jsonb, default: {}
|
6
|
+
end
|
7
|
+
end
|