enju_event 0.0.24 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- data/app/views/event_categories/index.html.erb +1 -1
- data/app/views/event_import_files/index.html.erb +1 -1
- data/app/views/event_import_results/index.html.erb +1 -1
- data/app/views/events/index.html.erb +1 -1
- data/app/views/participates/index.html.erb +1 -1
- data/config/routes.rb +3 -0
- data/lib/enju_event/engine.rb +1 -8
- data/lib/enju_event/version.rb +1 -1
- data/spec/dummy/app/models/role.rb +39 -1
- data/spec/dummy/app/models/user.rb +61 -10
- data/spec/dummy/app/models/user_group.rb +38 -0
- data/spec/dummy/app/models/user_has_role.rb +1 -0
- data/spec/dummy/config/application.rb +3 -1
- data/spec/dummy/config/initializers/mime_types.rb +0 -1
- data/spec/dummy/db/migrate/001_create_patrons.rb +1 -10
- data/spec/dummy/db/migrate/005_create_manifestations.rb +56 -0
- data/spec/dummy/db/migrate/006_create_items.rb +28 -0
- data/spec/dummy/db/migrate/012_create_owns.rb +12 -0
- data/spec/dummy/db/migrate/015_create_creates.rb +12 -0
- data/spec/dummy/db/migrate/047_create_produces.rb +12 -0
- data/spec/dummy/db/migrate/073_create_carrier_types.rb +11 -0
- data/spec/dummy/db/migrate/112_create_frequencies.rb +12 -0
- data/spec/dummy/db/migrate/117_create_form_of_works.rb +12 -0
- data/spec/dummy/db/migrate/125_create_donates.rb +12 -0
- data/spec/dummy/db/migrate/20080830154109_create_realizes.rb +13 -0
- data/spec/dummy/db/migrate/20080830172106_create_exemplifies.rb +13 -0
- data/spec/dummy/db/migrate/20080905191442_create_patron_types.rb +1 -5
- data/spec/dummy/db/migrate/20081025083905_create_languages.rb +1 -5
- data/spec/dummy/db/migrate/20081027150907_create_picture_files.rb +15 -0
- data/spec/dummy/db/migrate/20081028083142_create_patron_import_files.rb +22 -0
- data/spec/dummy/db/migrate/20081028083208_create_resource_import_files.rb +22 -0
- data/spec/dummy/db/migrate/20090705133942_add_attachments_picture_to_picture_file.rb +15 -0
- data/spec/dummy/db/migrate/20090705212043_add_attachments_attachment_to_manifestation.rb +15 -0
- data/spec/dummy/db/migrate/20090719201843_create_extents.rb +12 -0
- data/spec/dummy/db/migrate/20090720091106_create_medium_of_performances.rb +12 -0
- data/spec/dummy/db/migrate/20090720091429_create_content_types.rb +12 -0
- data/spec/dummy/db/migrate/20090812151902_create_patron_relationship_types.rb +12 -0
- data/spec/dummy/db/migrate/20091012101112_add_dcndl_schema.rb +27 -0
- data/spec/dummy/db/migrate/20091025080447_create_licenses.rb +12 -0
- data/spec/dummy/db/migrate/20091202124834_create_versions.rb +18 -0
- data/spec/dummy/db/migrate/20091214131723_create_series_statements.rb +13 -0
- data/spec/dummy/db/migrate/20100129142347_create_import_requests.rb +15 -0
- data/spec/dummy/db/migrate/20100223121519_rename_series_statement_title_to_original_title.rb +13 -0
- data/spec/dummy/db/migrate/20100321235924_add_series_statement_identifier_to_series_statement.rb +10 -0
- data/spec/dummy/db/migrate/20100525124311_create_manifestation_relationships.rb +13 -0
- data/spec/dummy/db/migrate/20100606073747_create_patron_relationships.rb +13 -0
- data/spec/dummy/db/migrate/20100607044753_create_manifestation_relationship_types.rb +12 -0
- data/spec/dummy/db/migrate/20100814091104_add_position_to_patron_relationship.rb +11 -0
- data/spec/dummy/db/migrate/20100925043847_create_resource_import_results.rb +15 -0
- data/spec/dummy/db/migrate/20100925074559_create_patron_import_results.rb +12 -0
- data/spec/dummy/db/migrate/20101212070145_add_acquired_at_to_item.rb +9 -0
- data/spec/dummy/db/migrate/20110301035123_add_pub_date_to_manifestation.rb +9 -0
- data/spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_patron.rb +11 -0
- data/spec/dummy/db/migrate/20110425133109_add_issn_to_series_statement.rb +9 -0
- data/spec/dummy/db/migrate/20110618091240_add_periodical_to_series_statement.rb +9 -0
- data/spec/dummy/db/migrate/20110619064807_add_edition_string_to_manifestation.rb +9 -0
- data/spec/dummy/db/migrate/20110620173525_add_bookstore_id_to_item.rb +11 -0
- data/spec/dummy/db/migrate/20110627034940_create_series_statement_merge_lists.rb +9 -0
- data/spec/dummy/db/migrate/20110627035057_create_series_statement_merges.rb +12 -0
- data/spec/dummy/db/migrate/20110820131417_create_series_has_manifestations.rb +13 -0
- data/spec/dummy/db/migrate/20110916053430_rename_manifestation_number_list_to_number_string.rb +13 -0
- data/spec/dummy/db/migrate/20110916091020_add_volume_number_to_manifestation.rb +13 -0
- data/spec/dummy/db/migrate/20110916103953_add_manifestaiton_id_to_series_statement.rb +10 -0
- data/spec/dummy/db/migrate/20110918161853_rename_series_statement_manifestation_id_to_root_manifestation_id.rb +13 -0
- data/spec/dummy/db/migrate/20110918162329_add_note_to_series_statement.rb +9 -0
- data/spec/dummy/db/migrate/20111009183423_add_ndc_to_manifestation.rb +9 -0
- data/spec/dummy/db/migrate/20111124110059_create_create_types.rb +12 -0
- data/spec/dummy/db/migrate/20111124110319_create_realize_types.rb +12 -0
- data/spec/dummy/db/migrate/20111124110355_create_produce_types.rb +12 -0
- data/spec/dummy/db/migrate/20111124112131_add_create_type_to_create.rb +7 -0
- data/spec/dummy/db/migrate/20111201155513_add_devise_to_users.rb +31 -10
- data/spec/dummy/db/migrate/20120125152919_add_title_subseries_transcription_to_series_statement.rb +6 -0
- data/spec/dummy/db/migrate/20120129020544_add_budget_type_id_to_item.rb +6 -0
- data/spec/dummy/db/migrate/20120319120638_add_content_type_id_to_manifestation.rb +6 -0
- data/spec/dummy/db/migrate/20120410104851_add_year_of_publication_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20120413072700_add_picture_meta_to_picture_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413100352_add_fingerprint_to_picture_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413161340_add_fingerprint_to_resource_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413161403_add_fingerprint_to_patron_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413170705_add_error_message_to_resource_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20120413170720_add_error_message_to_patron_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20120415060308_rename_resource_import_file_imported_at_to_executed_at.rb +9 -0
- data/spec/dummy/db/migrate/20120415060323_rename_patron_import_file_imported_at_to_executed_at.rb +9 -0
- data/spec/dummy/db/migrate/20120415164821_add_attachment_meta_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20120418081407_add_month_of_publication_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20120602141129_add_edit_mode_to_patron_import_file.rb +5 -0
- data/spec/dummy/db/schema.rb +490 -18
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/solr/data/test/index/_a.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_a.fdx +0 -0
- data/spec/dummy/solr/data/test/index/{_2s.fnm → _a.fnm} +2 -2
- data/spec/dummy/solr/data/test/index/_a.frq +1 -0
- data/spec/dummy/solr/data/test/index/_a.nrm +1 -0
- data/spec/dummy/solr/data/test/index/_a.prx +0 -0
- data/spec/dummy/solr/data/test/index/{_2s.tii → _a.tii} +0 -0
- data/spec/dummy/solr/data/test/index/_a.tis +0 -0
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/{segments_2k → segments_b} +0 -0
- data/spec/dummy/solr/data/test/spellchecker/segments_1 +0 -0
- metadata +178 -153
- data/db/migrate/20120602122753_add_edit_mode_to_event_import_file.rb +0 -5
- data/spec/dummy/app/models/country.rb +0 -44
- data/spec/dummy/app/models/language.rb +0 -4
- data/spec/dummy/app/models/library.rb +0 -128
- data/spec/dummy/app/models/library_group.rb +0 -86
- data/spec/dummy/app/models/patron.rb +0 -163
- data/spec/dummy/app/models/patron_type.rb +0 -19
- data/spec/dummy/app/models/shelf.rb +0 -54
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/lib/enju_leaf/import_file.rb +0 -13
- data/spec/dummy/lib/enju_leaf/localized_name.rb +0 -13
- data/spec/dummy/lib/enju_leaf/master_model.rb +0 -41
- data/spec/dummy/lib/enju_leaf/url_validator.rb +0 -10
- data/spec/dummy/lib/enju_leaf.rb +0 -4
- data/spec/dummy/private/system/event_import_files/event_imports/000/000/001/original/event_import_file_sample1.tsv +0 -5
- data/spec/dummy/private/system/event_import_files/event_imports/000/000/001/original/event_import_file_sample2.tsv +0 -3
- data/spec/dummy/solr/data/test/index/_2s.fdt +0 -0
- data/spec/dummy/solr/data/test/index/_2s.fdx +0 -0
- data/spec/dummy/solr/data/test/index/_2s.frq +0 -0
- data/spec/dummy/solr/data/test/index/_2s.nrm +0 -1
- data/spec/dummy/solr/data/test/index/_2s.prx +0 -0
- data/spec/dummy/solr/data/test/index/_2s.tis +0 -0
@@ -26,7 +26,7 @@
|
|
26
26
|
<%= link_to t('page.edit'), edit_event_category_path(event_category) -%>
|
27
27
|
<% end %>
|
28
28
|
<%- if can? :destroy, event_category -%>
|
29
|
-
<%= link_to t('page.destroy'), event_category, :confirm => t('page.are_you_sure'), :method => :delete -%>
|
29
|
+
<%= link_to t('page.destroy'), event_category, :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%>
|
30
30
|
<%- end -%>
|
31
31
|
</td>
|
32
32
|
</tr>
|
@@ -23,7 +23,7 @@
|
|
23
23
|
<td><%= localized_state(event_import_file.state) -%></td>
|
24
24
|
<td>
|
25
25
|
<%= link_to t('page.show'), event_import_file -%>
|
26
|
-
<%= link_to t('page.destroy'), event_import_file, :confirm => t('page.are_you_sure'), :method => :delete -%>
|
26
|
+
<%= link_to t('page.destroy'), event_import_file, :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%>
|
27
27
|
</td>
|
28
28
|
</tr>
|
29
29
|
<%- end -%>
|
@@ -24,7 +24,7 @@
|
|
24
24
|
<td><%= link_to event_import_result.event.display_name.localize, event_import_result.event if event_import_result.event %></td>
|
25
25
|
<td>
|
26
26
|
<%= link_to t('page.show'), event_import_result %>
|
27
|
-
<%= link_to t('page.destroy'), event_import_result, :confirm => t('page.are_you_sure'), :method => :delete %>
|
27
|
+
<%= link_to t('page.destroy'), event_import_result, :data => {:confirm => t('page.are_you_sure')}, :method => :delete %>
|
28
28
|
</td>
|
29
29
|
</tr>
|
30
30
|
<% end %>
|
@@ -56,7 +56,7 @@
|
|
56
56
|
<td>
|
57
57
|
<%- if can? :destroy, event -%>
|
58
58
|
<%= link_to image_tag('icons/page_white_edit.png', :size => '16x16', :alt => t('page.edit')), edit_event_path(event) -%>
|
59
|
-
<%= link_to image_tag('icons/delete.png', :size => '16x16', :alt => t('page.destroy')), event, :confirm => t('page.are_you_sure'), :method => :delete -%>
|
59
|
+
<%= link_to image_tag('icons/delete.png', :size => '16x16', :alt => t('page.destroy')), event, :data => {:confirm => t('page.are_you_sure')}, :method => :delete -%>
|
60
60
|
<%- end -%>
|
61
61
|
</td>
|
62
62
|
</tr>
|
@@ -14,7 +14,7 @@
|
|
14
14
|
<td><%= link_to participate.event.display_name.localize, participate.event %>
|
15
15
|
<td><%= link_to t('page.show'), participate %></td>
|
16
16
|
<td><%= link_to t('page.edit'), edit_participate_path(participate) %></td>
|
17
|
-
<td><%= link_to t('page.destroy'), participate, :confirm => t('page.are_you_sure'), :method => :delete %></td>
|
17
|
+
<td><%= link_to t('page.destroy'), participate, :data => {:confirm => t('page.are_you_sure')}, :method => :delete %></td>
|
18
18
|
</tr>
|
19
19
|
<%- end %>
|
20
20
|
</table>
|
data/config/routes.rb
CHANGED
@@ -11,4 +11,7 @@ Rails.application.routes.draw do
|
|
11
11
|
end
|
12
12
|
resources :event_import_results, :only => [:index, :show, :destroy]
|
13
13
|
resources :participates
|
14
|
+
|
15
|
+
match '/calendar(/:year(/:month))' => 'calendar#index', :as => :calendar, :constraints => {:year => /\d{4}/, :month => /\d{1,2}/}
|
16
|
+
match "/calendar/:year/:month/:day" => "calendar#show"
|
14
17
|
end
|
data/lib/enju_event/engine.rb
CHANGED
@@ -1,18 +1,11 @@
|
|
1
|
-
require "
|
2
|
-
require "cancan"
|
3
|
-
require "attribute_normalizer"
|
1
|
+
require "enju_core"
|
4
2
|
require "inherited_resources"
|
5
|
-
require "friendly_id"
|
6
|
-
require "will_paginate"
|
7
|
-
require "sunspot_rails"
|
8
3
|
require "has_scope"
|
9
4
|
require "configatron"
|
10
5
|
require "paperclip"
|
11
6
|
require "state_machine"
|
12
|
-
require "addressable/uri"
|
13
7
|
require "csv"
|
14
8
|
require "nkf"
|
15
|
-
require "acts_as_list"
|
16
9
|
|
17
10
|
module EnjuEvent
|
18
11
|
class Engine < ::Rails::Engine
|
data/lib/enju_event/version.rb
CHANGED
@@ -1,8 +1,46 @@
|
|
1
1
|
class Role < ActiveRecord::Base
|
2
|
+
include MasterModel
|
3
|
+
default_scope :order => "roles.position"
|
4
|
+
has_many :user_has_roles
|
5
|
+
has_many :users, :through => :user_has_roles
|
6
|
+
after_save :clear_all_cache
|
7
|
+
after_destroy :clear_all_cache
|
8
|
+
|
2
9
|
extend FriendlyId
|
3
10
|
friendly_id :name
|
4
11
|
|
12
|
+
def localized_name
|
13
|
+
display_name.localize
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.all_cache
|
17
|
+
if Rails.env == 'production'
|
18
|
+
Rails.cache.fetch('role_all'){Role.select(:name).all}
|
19
|
+
else
|
20
|
+
Role.select(:name)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def clear_all_cache
|
25
|
+
Rails.cache.delete('role_all')
|
26
|
+
end
|
27
|
+
|
5
28
|
def self.default_role
|
6
|
-
Role.find('Guest')
|
29
|
+
Rails.cache.fetch('default_role'){Role.find('Guest')}
|
7
30
|
end
|
8
31
|
end
|
32
|
+
|
33
|
+
# == Schema Information
|
34
|
+
#
|
35
|
+
# Table name: roles
|
36
|
+
#
|
37
|
+
# id :integer not null, primary key
|
38
|
+
# name :string(255) not null
|
39
|
+
# display_name :string(255)
|
40
|
+
# note :text
|
41
|
+
# created_at :datetime
|
42
|
+
# updated_at :datetime
|
43
|
+
# score :integer default(0), not null
|
44
|
+
# position :integer
|
45
|
+
#
|
46
|
+
|
@@ -7,25 +7,60 @@ class User < ActiveRecord::Base
|
|
7
7
|
# Setup accessible (or protected) attributes for your model
|
8
8
|
attr_accessible :email, :password, :password_confirmation, :remember_me
|
9
9
|
|
10
|
+
has_one :patron
|
10
11
|
has_one :user_has_role
|
11
12
|
has_one :role, :through => :user_has_role
|
12
13
|
belongs_to :user_group
|
13
14
|
belongs_to :required_role, :class_name => 'Role', :foreign_key => 'required_role_id'
|
14
|
-
has_many :
|
15
|
-
has_many :
|
15
|
+
has_many :checkouts, :dependent => :nullify
|
16
|
+
has_many :reserves, :dependent => :destroy
|
17
|
+
has_many :reserved_manifestations, :through => :reserves, :source => :manifestation
|
18
|
+
has_many :checkout_stat_has_users
|
19
|
+
has_many :user_checkout_stats, :through => :checkout_stat_has_users
|
20
|
+
has_many :reserve_stat_has_users
|
21
|
+
has_many :user_reserve_stats, :through => :reserve_stat_has_users
|
22
|
+
has_many :baskets, :dependent => :destroy
|
23
|
+
belongs_to :library
|
24
|
+
|
25
|
+
before_destroy :check_item_before_destroy
|
16
26
|
|
17
27
|
extend FriendlyId
|
18
28
|
friendly_id :username
|
19
29
|
|
20
|
-
def
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
30
|
+
def check_item_before_destroy
|
31
|
+
# TODO: 貸出記録を残す場合
|
32
|
+
if checkouts.size > 0
|
33
|
+
raise 'This user has items still checked out.'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def reset_checkout_icalendar_token
|
38
|
+
self.checkout_icalendar_token = Devise.friendly_token
|
39
|
+
end
|
40
|
+
|
41
|
+
def delete_checkout_icalendar_token
|
42
|
+
self.checkout_icalendar_token = nil
|
43
|
+
end
|
44
|
+
|
45
|
+
def checked_item_count
|
46
|
+
checkout_count = {}
|
47
|
+
CheckoutType.all.each do |checkout_type|
|
48
|
+
# 資料種別ごとの貸出中の冊数を計算
|
49
|
+
checkout_count[:"#{checkout_type.name}"] = self.checkouts.count_by_sql(["
|
50
|
+
SELECT count(item_id) FROM checkouts
|
51
|
+
WHERE item_id IN (
|
52
|
+
SELECT id FROM items
|
53
|
+
WHERE checkout_type_id = ?
|
54
|
+
)
|
55
|
+
AND user_id = ? AND checkin_id IS NULL", checkout_type.id, self.id]
|
56
|
+
)
|
28
57
|
end
|
58
|
+
return checkout_count
|
59
|
+
end
|
60
|
+
|
61
|
+
def reached_reservation_limit?(manifestation)
|
62
|
+
return true if self.user_group.user_group_has_checkout_types.available_for_carrier_type(manifestation.carrier_type).where(:user_group_id => self.user_group.id).collect(&:reservation_limit).max.to_i <= self.reserves.waiting.size
|
63
|
+
false
|
29
64
|
end
|
30
65
|
|
31
66
|
def has_role?(role_in_question)
|
@@ -40,4 +75,20 @@ class User < ActiveRecord::Base
|
|
40
75
|
false
|
41
76
|
end
|
42
77
|
end
|
78
|
+
|
79
|
+
if defined?(EnjuMessage)
|
80
|
+
has_many :sent_messages, :foreign_key => 'sender_id', :class_name => 'Message'
|
81
|
+
has_many :received_messages, :foreign_key => 'receiver_id', :class_name => 'Message'
|
82
|
+
|
83
|
+
def send_message(status, options = {})
|
84
|
+
MessageRequest.transaction do
|
85
|
+
request = MessageRequest.new
|
86
|
+
request.sender = User.find(1)
|
87
|
+
request.receiver = self
|
88
|
+
request.message_template = MessageTemplate.localized_template(status, self.locale)
|
89
|
+
request.save_message_body(options)
|
90
|
+
request.sm_send_message!
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
43
94
|
end
|
@@ -1,2 +1,40 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
1
2
|
class UserGroup < ActiveRecord::Base
|
3
|
+
attr_accessible :name, :display_name, :note, :valid_period_for_new_user,
|
4
|
+
:expired_at, :number_of_day_to_notify_overdue,
|
5
|
+
:number_of_day_to_notify_overdue,
|
6
|
+
:number_of_day_to_notify_due_date,
|
7
|
+
:number_of_time_to_notify_overdue
|
8
|
+
|
9
|
+
include MasterModel
|
10
|
+
default_scope :order => "user_groups.position"
|
11
|
+
has_many :users
|
12
|
+
|
13
|
+
validates_numericality_of :valid_period_for_new_user,
|
14
|
+
:greater_than_or_equal_to => 0,
|
15
|
+
:allow_blank => true
|
16
|
+
|
17
|
+
def self.per_page
|
18
|
+
10
|
19
|
+
end
|
2
20
|
end
|
21
|
+
|
22
|
+
# == Schema Information
|
23
|
+
#
|
24
|
+
# Table name: user_groups
|
25
|
+
#
|
26
|
+
# id :integer not null, primary key
|
27
|
+
# name :string(255)
|
28
|
+
# display_name :text
|
29
|
+
# note :text
|
30
|
+
# position :integer
|
31
|
+
# created_at :datetime
|
32
|
+
# updated_at :datetime
|
33
|
+
# deleted_at :datetime
|
34
|
+
# valid_period_for_new_user :integer default(0), not null
|
35
|
+
# expired_at :datetime
|
36
|
+
# number_of_day_to_notify_overdue :integer default(1), not null
|
37
|
+
# number_of_day_to_notify_due_date :integer default(7), not null
|
38
|
+
# number_of_time_to_notify_overdue :integer default(3), not null
|
39
|
+
#
|
40
|
+
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class CreatePatrons < ActiveRecord::Migration
|
2
|
-
def
|
2
|
+
def change
|
3
3
|
create_table :patrons do |t|
|
4
4
|
t.integer :user_id
|
5
5
|
t.string :last_name
|
@@ -38,11 +38,6 @@ class CreatePatrons < ActiveRecord::Migration
|
|
38
38
|
t.integer :patron_type_id, :default => 1, :null => false
|
39
39
|
t.integer :lock_version, :default => 0, :null => false
|
40
40
|
t.text :note
|
41
|
-
t.integer :creates_count, :default => 0, :null => false
|
42
|
-
t.integer :realizes_count, :default => 0, :null => false
|
43
|
-
t.integer :produces_count, :default => 0, :null => false
|
44
|
-
t.integer :owns_count, :default => 0, :null => false
|
45
|
-
#t.integer :resource_has_subjects_count, :default => 0, :null => false
|
46
41
|
t.integer :required_role_id, :default => 1, :null => false
|
47
42
|
t.integer :required_score, :default => 0, :null => false
|
48
43
|
t.string :state
|
@@ -55,8 +50,4 @@ class CreatePatrons < ActiveRecord::Migration
|
|
55
50
|
add_index :patrons, :required_role_id
|
56
51
|
add_index :patrons, :full_name
|
57
52
|
end
|
58
|
-
|
59
|
-
def self.down
|
60
|
-
drop_table :patrons
|
61
|
-
end
|
62
53
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class CreateManifestations < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :manifestations do |t|
|
4
|
+
t.text :original_title, :null => false
|
5
|
+
t.text :title_alternative
|
6
|
+
t.text :title_transcription
|
7
|
+
t.string :classification_number
|
8
|
+
t.string :manifestation_identifier
|
9
|
+
t.datetime :date_of_publication
|
10
|
+
t.datetime :copyright_date
|
11
|
+
t.timestamps
|
12
|
+
t.datetime :deleted_at
|
13
|
+
t.string :access_address
|
14
|
+
t.integer :language_id, :default => 1, :null => false
|
15
|
+
t.integer :carrier_type_id, :default => 1, :null => false
|
16
|
+
t.integer :extent_id, :default => 1, :null => false
|
17
|
+
t.integer :start_page
|
18
|
+
t.integer :end_page
|
19
|
+
t.integer :height
|
20
|
+
t.integer :width
|
21
|
+
t.integer :depth
|
22
|
+
t.string :isbn
|
23
|
+
t.string :isbn10
|
24
|
+
t.string :wrong_isbn
|
25
|
+
t.string :nbn
|
26
|
+
t.string :lccn
|
27
|
+
t.string :oclc_number
|
28
|
+
t.string :issn
|
29
|
+
t.integer :price # TODO: 通貨単位
|
30
|
+
t.text :fulltext
|
31
|
+
t.string :volume_number_list
|
32
|
+
t.string :issue_number_list
|
33
|
+
t.string :serial_number_list
|
34
|
+
t.integer :edition
|
35
|
+
t.text :note
|
36
|
+
t.boolean :repository_content, :default => false, :null => false
|
37
|
+
t.integer :lock_version, :default => 0, :null => false
|
38
|
+
t.integer :required_role_id, :default => 1, :null => false
|
39
|
+
t.string :state
|
40
|
+
t.integer :required_score, :default => 0, :null => false
|
41
|
+
t.integer :frequency_id, :default => 1, :null => false
|
42
|
+
t.boolean :subscription_master, :default => false, :null => false
|
43
|
+
end
|
44
|
+
add_index :manifestations, :carrier_type_id
|
45
|
+
add_index :manifestations, :required_role_id
|
46
|
+
add_index :manifestations, :isbn
|
47
|
+
add_index :manifestations, :nbn
|
48
|
+
add_index :manifestations, :lccn
|
49
|
+
add_index :manifestations, :oclc_number
|
50
|
+
add_index :manifestations, :issn
|
51
|
+
add_index :manifestations, :access_address
|
52
|
+
add_index :manifestations, :frequency_id
|
53
|
+
add_index :manifestations, :manifestation_identifier
|
54
|
+
add_index :manifestations, :updated_at
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class CreateItems < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :items do |t|
|
4
|
+
#t.integer :manifestation_id
|
5
|
+
t.string :call_number
|
6
|
+
t.string :item_identifier
|
7
|
+
t.integer :circulation_status_id, :default => 5, :null => false
|
8
|
+
t.integer :checkout_type_id, :default => 1, :null => false
|
9
|
+
t.timestamps
|
10
|
+
t.datetime :deleted_at
|
11
|
+
t.integer :shelf_id, :default => 1, :null => false
|
12
|
+
t.boolean :include_supplements, :default => false, :null => false
|
13
|
+
t.text :note
|
14
|
+
t.string :url
|
15
|
+
t.integer :price
|
16
|
+
t.integer :lock_version, :default => 0, :null => false
|
17
|
+
t.integer :required_role_id, :default => 1, :null => false
|
18
|
+
t.string :state
|
19
|
+
t.integer :required_score, :default => 0, :null => false
|
20
|
+
end
|
21
|
+
#add_index :items, :manifestation_id
|
22
|
+
add_index :items, :circulation_status_id
|
23
|
+
add_index :items, :checkout_type_id
|
24
|
+
add_index :items, :shelf_id
|
25
|
+
add_index :items, :item_identifier
|
26
|
+
add_index :items, :required_role_id
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateOwns < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :owns do |t|
|
4
|
+
t.references :patron, :null => false
|
5
|
+
t.references :item, :null => false
|
6
|
+
t.integer :position
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
add_index :owns, :patron_id
|
10
|
+
add_index :owns, :item_id
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateCreates < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :creates do |t|
|
4
|
+
t.references :patron, :null => false
|
5
|
+
t.references :work, :null => false
|
6
|
+
t.integer :position
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
add_index :creates, :patron_id
|
10
|
+
add_index :creates, :work_id
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateProduces < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :produces do |t|
|
4
|
+
t.references :patron, :null => false
|
5
|
+
t.references :manifestation, :null => false
|
6
|
+
t.integer :position
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
add_index :produces, :patron_id
|
10
|
+
add_index :produces, :manifestation_id
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateDonates < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :donates do |t|
|
4
|
+
t.integer :patron_id, :null => false
|
5
|
+
t.integer :item_id, :null => false
|
6
|
+
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
add_index :donates, :patron_id
|
10
|
+
add_index :donates, :item_id
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateRealizes < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :realizes do |t|
|
4
|
+
t.references :patron, :null => false
|
5
|
+
t.references :expression, :null => false
|
6
|
+
t.integer :position
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
add_index :realizes, :patron_id
|
11
|
+
add_index :realizes, :expression_id
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateExemplifies < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :exemplifies do |t|
|
4
|
+
t.integer :manifestation_id, :null => false
|
5
|
+
t.integer :item_id, :null => false
|
6
|
+
t.integer :position
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
add_index :exemplifies, :manifestation_id
|
11
|
+
add_index :exemplifies, :item_id, :unique => true
|
12
|
+
end
|
13
|
+
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class CreatePatronTypes < ActiveRecord::Migration
|
2
|
-
def
|
2
|
+
def change
|
3
3
|
create_table :patron_types do |t|
|
4
4
|
t.string :name, :null => false
|
5
5
|
t.text :display_name
|
@@ -9,8 +9,4 @@ class CreatePatronTypes < ActiveRecord::Migration
|
|
9
9
|
t.timestamps
|
10
10
|
end
|
11
11
|
end
|
12
|
-
|
13
|
-
def self.down
|
14
|
-
drop_table :patron_types
|
15
|
-
end
|
16
12
|
end
|
@@ -4,7 +4,7 @@ class CreateLanguages < ActiveRecord::Migration
|
|
4
4
|
# Note this doesn't include macrolanguages (dialects)
|
5
5
|
# Information on macrolanguages http://en.wikipedia.org/wiki/ISO_639_macrolanguage
|
6
6
|
|
7
|
-
def
|
7
|
+
def change
|
8
8
|
create_table :languages do |t|
|
9
9
|
t.string :name, :null => false
|
10
10
|
t.string :native_name
|
@@ -20,8 +20,4 @@ class CreateLanguages < ActiveRecord::Migration
|
|
20
20
|
add_index :languages, :iso_639_2
|
21
21
|
add_index :languages, :iso_639_3
|
22
22
|
end
|
23
|
-
|
24
|
-
def self.down
|
25
|
-
drop_table :languages
|
26
|
-
end
|
27
23
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreatePictureFiles < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :picture_files do |t|
|
4
|
+
t.integer :picture_attachable_id
|
5
|
+
t.string :picture_attachable_type
|
6
|
+
t.string :content_type
|
7
|
+
t.text :title
|
8
|
+
t.string :thumbnail
|
9
|
+
t.integer :position
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
add_index :picture_files, [:picture_attachable_id, :picture_attachable_type], :name => "index_picture_files_on_picture_attachable_id_and_type"
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreatePatronImportFiles < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :patron_import_files do |t|
|
4
|
+
t.integer :parent_id
|
5
|
+
t.string :content_type
|
6
|
+
t.integer :size
|
7
|
+
t.integer :user_id
|
8
|
+
t.text :note
|
9
|
+
t.datetime :imported_at
|
10
|
+
t.string :state
|
11
|
+
t.string :patron_import_file_name
|
12
|
+
t.string :patron_import_content_type
|
13
|
+
t.integer :patron_import_file_size
|
14
|
+
t.datetime :patron_import_updated_at
|
15
|
+
|
16
|
+
t.timestamps
|
17
|
+
end
|
18
|
+
add_index :patron_import_files, :parent_id
|
19
|
+
add_index :patron_import_files, :user_id
|
20
|
+
add_index :patron_import_files, :state
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreateResourceImportFiles < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :resource_import_files do |t|
|
4
|
+
t.integer :parent_id
|
5
|
+
t.string :content_type
|
6
|
+
t.integer :size
|
7
|
+
t.integer :user_id
|
8
|
+
t.text :note
|
9
|
+
t.datetime :imported_at
|
10
|
+
t.string :state
|
11
|
+
t.string :resource_import_file_name
|
12
|
+
t.string :resource_import_content_type
|
13
|
+
t.integer :resource_import_file_size
|
14
|
+
t.datetime :resource_import_updated_at
|
15
|
+
|
16
|
+
t.timestamps
|
17
|
+
end
|
18
|
+
add_index :resource_import_files, :parent_id
|
19
|
+
add_index :resource_import_files, :user_id
|
20
|
+
add_index :resource_import_files, :state
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class AddAttachmentsPictureToPictureFile < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :picture_files, :picture_file_name, :string
|
4
|
+
add_column :picture_files, :picture_content_type, :string
|
5
|
+
add_column :picture_files, :picture_file_size, :integer
|
6
|
+
add_column :picture_files, :picture_updated_at, :datetime
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.down
|
10
|
+
remove_column :picture_files, :picture_file_name
|
11
|
+
remove_column :picture_files, :picture_content_type
|
12
|
+
remove_column :picture_files, :picture_file_size
|
13
|
+
remove_column :picture_files, :picture_updated_at
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class AddAttachmentsAttachmentToManifestation < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :manifestations, :attachment_file_name, :string
|
4
|
+
add_column :manifestations, :attachment_content_type, :string
|
5
|
+
add_column :manifestations, :attachment_file_size, :integer
|
6
|
+
add_column :manifestations, :attachment_updated_at, :datetime
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.down
|
10
|
+
remove_column :manifestations, :attachment_file_name
|
11
|
+
remove_column :manifestations, :attachment_content_type
|
12
|
+
remove_column :manifestations, :attachment_file_size
|
13
|
+
remove_column :manifestations, :attachment_updated_at
|
14
|
+
end
|
15
|
+
end
|