enju_circulation 0.1.0.pre29 → 0.1.0.pre30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/checked_item.rb +32 -19
- data/app/models/reserve.rb +8 -8
- data/app/views/checked_items/_list.html.erb +4 -2
- data/app/views/reserves/_title.html.erb +3 -3
- data/lib/enju_circulation/version.rb +1 -1
- data/spec/controllers/checked_items_controller_spec.rb +15 -1
- data/spec/dummy/app/models/local_agent.rb +1 -1
- data/spec/dummy/app/models/user.rb +1 -1
- data/spec/dummy/db/migrate/001_create_agents.rb +8 -8
- data/spec/dummy/db/migrate/012_create_owns.rb +2 -2
- data/spec/dummy/db/migrate/015_create_creates.rb +2 -2
- data/spec/dummy/db/migrate/047_create_produces.rb +2 -2
- data/spec/dummy/db/migrate/059_create_libraries.rb +2 -2
- data/spec/dummy/db/migrate/125_create_donates.rb +2 -2
- data/spec/dummy/db/migrate/20080830154109_create_realizes.rb +2 -2
- data/spec/dummy/db/migrate/20080905191442_create_agent_types.rb +2 -2
- data/spec/dummy/db/migrate/20090812151902_create_agent_relationship_types.rb +2 -2
- data/spec/dummy/db/migrate/20091012101112_add_dcndl_schema.rb +2 -2
- data/spec/dummy/db/migrate/20100606073747_create_agent_relationships.rb +5 -5
- data/spec/dummy/db/migrate/20100814091104_add_position_to_agent_relationship.rb +3 -3
- data/spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_agent.rb +5 -5
- data/spec/dummy/db/schema.rb +102 -102
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/solr/data/test/index/{_2fp.fdt → _2hv.fdt} +0 -0
- data/spec/dummy/solr/data/test/index/{_2fp.fdx → _2hv.fdx} +0 -0
- data/spec/dummy/solr/data/test/index/{_2fp.fnm → _2hv.fnm} +0 -0
- data/spec/dummy/solr/data/test/index/{_2fp.frq → _2hv.frq} +0 -0
- data/spec/dummy/solr/data/test/index/{_2fp.nrm → _2hv.nrm} +0 -0
- data/spec/dummy/solr/data/test/index/{_2fp.prx → _2hv.prx} +0 -0
- data/spec/dummy/solr/data/test/index/{_2fp.tii → _2hv.tii} +0 -0
- data/spec/dummy/solr/data/test/index/{_2fp.tis → _2hv.tis} +0 -0
- data/spec/dummy/solr/data/test/index/segments.gen +0 -0
- data/spec/dummy/solr/data/test/index/segments_4zj +0 -0
- data/spec/fixtures/agent_types.yml +4 -4
- data/spec/fixtures/agents.yml +46 -46
- data/spec/fixtures/libraries.yml +6 -6
- data/spec/fixtures/reserves.yml +1 -1
- metadata +30 -48
- data/spec/dummy/app/models/local_patron.rb +0 -13
- data/spec/dummy/db/migrate/001_create_patrons.rb +0 -58
- data/spec/dummy/db/migrate/20080905191442_create_patron_types.rb +0 -12
- data/spec/dummy/db/migrate/20090812151902_create_patron_relationship_types.rb +0 -12
- data/spec/dummy/db/migrate/20100606073747_create_patron_relationships.rb +0 -13
- data/spec/dummy/db/migrate/20100814091104_add_position_to_patron_relationship.rb +0 -11
- data/spec/dummy/db/migrate/20110301121550_add_birth_date_and_death_date_to_patron.rb +0 -11
- data/spec/dummy/solr/data/test/index/segments_4v7 +0 -0
- data/spec/fixtures/patron_types.yml +0 -35
- data/spec/fixtures/patrons.yml +0 -338
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8dbf3fb60c92de38186b82e95b2ea02ff3a112d1
|
4
|
+
data.tar.gz: 31b6b46ac20f36492f6bdb762d8eadb86e3e63ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf67fb8f4655461cdd989df7fd2c59c786ea40f7a27d3afcdf53f15b8adaa76ad7801dcdf29a05a5dddd861a9349a7a89fac3c427538bebb39ba9c1b64728ae3
|
7
|
+
data.tar.gz: 1e183fb62ca465171cc45208e82b1d0e37681af276cb37dc42e066db054f4707aae494287234433262b239090be017fe232e0b0099a0bfffec7122780690c4cf
|
data/app/models/checked_item.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
class CheckedItem < ActiveRecord::Base
|
2
|
-
attr_accessible :item_identifier, :ignore_restriction
|
2
|
+
attr_accessible :item_identifier, :ignore_restriction, :due_date_string
|
3
3
|
belongs_to :item #, :validate => true
|
4
4
|
belongs_to :basket #, :validate => true
|
5
5
|
belongs_to :librarian, :class_name => 'User' #, :validate => true
|
@@ -8,13 +8,15 @@ class CheckedItem < ActiveRecord::Base
|
|
8
8
|
validates_presence_of :item, :basket, :due_date, :on => :update
|
9
9
|
validates_uniqueness_of :item_id, :scope => :basket_id
|
10
10
|
validate :available_for_checkout?, :on => :create
|
11
|
+
validates :due_date_string, :format => {:with => /\A\[{0,1}\d+([\/-]\d{0,2}){0,2}\]{0,1}\z/}, :allow_blank => true
|
12
|
+
validate :check_due_date
|
11
13
|
|
12
14
|
before_validation :set_item
|
13
15
|
before_validation :set_due_date, :on => :create
|
14
16
|
normalize_attributes :item_identifier
|
15
17
|
|
16
18
|
attr_protected :user_id
|
17
|
-
attr_accessor :item_identifier, :ignore_restriction
|
19
|
+
attr_accessor :item_identifier, :ignore_restriction, :due_date_string
|
18
20
|
|
19
21
|
def available_for_checkout?
|
20
22
|
if self.item.blank?
|
@@ -80,27 +82,30 @@ class CheckedItem < ActiveRecord::Base
|
|
80
82
|
end
|
81
83
|
|
82
84
|
def set_due_date
|
83
|
-
return nil unless
|
84
|
-
|
85
|
-
|
86
|
-
return nil if lending_rule.nil?
|
87
|
-
|
88
|
-
if lending_rule.fixed_due_date.blank?
|
89
|
-
#self.due_date = item_checkout_type.checkout_period.days.since Time.zone.today
|
90
|
-
self.due_date = lending_rule.loan_period.days.since(Time.zone.now).end_of_day
|
85
|
+
return nil unless item_checkout_type
|
86
|
+
if due_date_string.present?
|
87
|
+
self.due_date = Time.zone.parse(due_date_string).try(:end_of_day)
|
91
88
|
else
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
self.due_date = due_date.yesterday.end_of_day
|
89
|
+
lending_rule = item.lending_rule(basket.user)
|
90
|
+
return nil if lending_rule.nil?
|
91
|
+
|
92
|
+
if lending_rule.fixed_due_date.blank?
|
93
|
+
#self.due_date = item_checkout_type.checkout_period.days.since Time.zone.today
|
94
|
+
self.due_date = lending_rule.loan_period.days.since(Time.zone.now).end_of_day
|
99
95
|
else
|
100
|
-
self.due_date =
|
96
|
+
#self.due_date = item_checkout_type.fixed_due_date
|
97
|
+
self.due_date = lending_rule.fixed_due_date.tomorrow.end_of_day
|
98
|
+
end
|
99
|
+
# 返却期限日が閉館日の場合
|
100
|
+
while item.shelf.library.closed?(due_date)
|
101
|
+
if item_checkout_type.set_due_date_before_closing_day
|
102
|
+
self.due_date = due_date.yesterday.end_of_day
|
103
|
+
else
|
104
|
+
self.due_date = due_date.tomorrow.end_of_day
|
105
|
+
end
|
101
106
|
end
|
102
107
|
end
|
103
|
-
return
|
108
|
+
return due_date
|
104
109
|
end
|
105
110
|
|
106
111
|
def set_item
|
@@ -110,6 +115,14 @@ class CheckedItem < ActiveRecord::Base
|
|
110
115
|
self.item = item
|
111
116
|
end
|
112
117
|
end
|
118
|
+
|
119
|
+
private
|
120
|
+
def check_due_date
|
121
|
+
return nil unless due_date
|
122
|
+
if due_date <= Time.zone.now
|
123
|
+
errors.add(:due_date)
|
124
|
+
end
|
125
|
+
end
|
113
126
|
end
|
114
127
|
|
115
128
|
# == Schema Information
|
data/app/models/reserve.rb
CHANGED
@@ -21,7 +21,7 @@ class Reserve < ActiveRecord::Base
|
|
21
21
|
scope :not_sent_expiration_notice_to_library, where(:state => 'expired', :expiration_notice_to_library => false)
|
22
22
|
scope :sent_expiration_notice_to_patron, where(:state => 'expired', :expiration_notice_to_patron => true)
|
23
23
|
scope :sent_expiration_notice_to_library, where(:state => 'expired', :expiration_notice_to_library => true)
|
24
|
-
scope :
|
24
|
+
scope :not_sent_cancel_notice_to_agent, where(:state => 'canceled', :expiration_notice_to_patron => false)
|
25
25
|
scope :not_sent_cancel_notice_to_library, where(:state => 'canceled', :expiration_notice_to_library => false)
|
26
26
|
|
27
27
|
belongs_to :user #, :validate => true
|
@@ -209,9 +209,9 @@ class Reserve < ActiveRecord::Base
|
|
209
209
|
Reserve.transaction do
|
210
210
|
case state
|
211
211
|
when 'requested'
|
212
|
-
|
212
|
+
message_template_to_agent = MessageTemplate.localized_template('reservation_accepted_for_patron', user.locale)
|
213
213
|
request = MessageRequest.new
|
214
|
-
request.assign_attributes({:sender => sender, :receiver => user, :message_template =>
|
214
|
+
request.assign_attributes({:sender => sender, :receiver => user, :message_template => message_template_to_agent}, :as => :admin)
|
215
215
|
request.save_message_body(:manifestations => Array[manifestation], :user => user)
|
216
216
|
request.sm_send_message! # 受付時は即時送信
|
217
217
|
message_template_to_library = MessageTemplate.localized_template('reservation_accepted_for_library', user.locale)
|
@@ -220,9 +220,9 @@ class Reserve < ActiveRecord::Base
|
|
220
220
|
request.save_message_body(:manifestations => Array[manifestation], :user => user)
|
221
221
|
request.sm_send_message! # 受付時は即時送信
|
222
222
|
when 'canceled'
|
223
|
-
|
223
|
+
message_template_to_agent = MessageTemplate.localized_template('reservation_canceled_for_patron', user.locale)
|
224
224
|
request = MessageRequest.new
|
225
|
-
request.assign_attributes({:sender => sender, :receiver => user, :message_template =>
|
225
|
+
request.assign_attributes({:sender => sender, :receiver => user, :message_template => message_template_to_agent}, :as => :admin)
|
226
226
|
request.save_message_body(:manifestations => Array[manifestation], :user => user)
|
227
227
|
request.sm_send_message! # キャンセル時は即時送信
|
228
228
|
message_template_to_library = MessageTemplate.localized_template('reservation_canceled_for_library', user.locale)
|
@@ -231,9 +231,9 @@ class Reserve < ActiveRecord::Base
|
|
231
231
|
request.save_message_body(:manifestations => Array[manifestation], :user => user)
|
232
232
|
request.sm_send_message! # キャンセル時は即時送信
|
233
233
|
when 'expired'
|
234
|
-
|
234
|
+
message_template_to_agent = MessageTemplate.localized_template('reservation_expired_for_patron', user.locale)
|
235
235
|
request = MessageRequest.new
|
236
|
-
request.assign_attributes({:sender => sender, :receiver => user, :message_template =>
|
236
|
+
request.assign_attributes({:sender => sender, :receiver => user, :message_template => message_template_to_agent}, :as => :admin)
|
237
237
|
request.save_message_body(:manifestations => Array[manifestation], :user => user)
|
238
238
|
request.sm_send_message!
|
239
239
|
self.update_attribute(:expiration_notice_to_patron, true)
|
@@ -337,7 +337,7 @@ class Reserve < ActiveRecord::Base
|
|
337
337
|
|
338
338
|
expired_period = manifestation.try(:reservation_expired_period, user)
|
339
339
|
if expired_period.nil?
|
340
|
-
errors[:base] << I18n.t('reserve.
|
340
|
+
errors[:base] << I18n.t('reserve.this_agent_cannot_reserve')
|
341
341
|
end
|
342
342
|
end
|
343
343
|
end
|
@@ -4,9 +4,11 @@
|
|
4
4
|
<%= form_for :checked_item, :html => {:method => :post}, :url => basket_checked_items_path(@basket), :remote => true do |f| -%>
|
5
5
|
<%= f.error_messages -%>
|
6
6
|
<p>
|
7
|
-
<%=
|
7
|
+
<%= f.label :item_identifier, t('activerecord.attributes.item.item_identifier') -%>: <%= f.search_field :item_identifier -%>
|
8
|
+
<%= f.submit t('page.read'), 'data-disable-with' => t('page.saving') -%><br />
|
9
|
+
<%= f.label :due_date %>
|
10
|
+
<%= f.text_field :due_date_string, :class => 'date_text_field', :placeholder => "#{t('page.example')}: #{1.month.from_now.strftime('%Y-%m-%d')}" %>
|
8
11
|
<%= t('checked_item.ignore_restriction') -%>: <%= f.check_box :ignore_restriction -%>
|
9
|
-
<%= f.submit t('page.read'), 'data-disable-with' => t('page.saving') -%>
|
10
12
|
</p>
|
11
13
|
<%- end -%>
|
12
14
|
|
@@ -3,13 +3,13 @@
|
|
3
3
|
(<%= link_to t('reserve.bibliographic_detail'), reserve.manifestation %>)
|
4
4
|
<br />
|
5
5
|
<%- if reserve.manifestation.creators.readable_by(current_user).exists? -%>
|
6
|
-
<%= t('
|
6
|
+
<%= t('agent.creator') -%>: <%= agents_list(reserve.manifestation.creators.readable_by(current_user)) -%>
|
7
7
|
<%- end -%>
|
8
8
|
<%- if reserve.manifestation.contributors.readable_by(current_user).exists? -%>
|
9
|
-
<%= t('
|
9
|
+
<%= t('agent.contributor') -%>: <%= agents_list(reserve.manifestation.contributors.readable_by(current_user)) -%>
|
10
10
|
<%- end -%>
|
11
11
|
<%- if reserve.manifestation.publishers.readable_by(current_user).exists? -%>
|
12
|
-
<%= t('
|
12
|
+
<%= t('agent.publisher') -%>: <%= agents_list(reserve.manifestation.publishers.readable_by(current_user)) -%>
|
13
13
|
<%- if reserve.manifestation.pub_date.present? -%>
|
14
14
|
(<%= reserve.manifestation.pub_date -%>)
|
15
15
|
<%- end -%>
|
@@ -258,13 +258,27 @@ describe CheckedItemsController do
|
|
258
258
|
response.should redirect_to basket_checked_items_url(assigns(:checked_item).basket)
|
259
259
|
end
|
260
260
|
|
261
|
-
it "should create checked_item" do
|
261
|
+
it "should create checked_item with item_identifier" do
|
262
262
|
post :create, :checked_item => {:item_identifier => '00011'}, :basket_id => 3
|
263
263
|
assigns(:checked_item).should be_true
|
264
264
|
assigns(:checked_item).due_date.should_not be_nil
|
265
265
|
response.should redirect_to basket_checked_items_url(assigns(:checked_item).basket)
|
266
266
|
end
|
267
267
|
|
268
|
+
it "should override due_date" do
|
269
|
+
post :create, :checked_item => {:item_identifier => '00011', :due_date_string => 1.year.from_now.strftime('%Y-%m-%d')}, :basket_id => 3
|
270
|
+
assigns(:checked_item).should be_true
|
271
|
+
assigns(:checked_item).due_date.should eq 1.year.from_now.end_of_day
|
272
|
+
response.should redirect_to basket_checked_items_url(assigns(:checked_item).basket)
|
273
|
+
end
|
274
|
+
|
275
|
+
it "should not create checked_item with an invalid due_date" do
|
276
|
+
post :create, :checked_item => {:item_identifier => '00011', :due_date_string => "invalid"}, :basket_id => 3
|
277
|
+
assigns(:checked_item).should_not be_valid
|
278
|
+
assigns(:checked_item).due_date.should be_nil
|
279
|
+
response.should be_success
|
280
|
+
end
|
281
|
+
|
268
282
|
it "should not create checked_item if excessed checkout_limit" do
|
269
283
|
post :create, :checked_item => {:item_identifier => '00011'}, :basket_id => 1
|
270
284
|
response.should be_success
|
@@ -1,6 +1,6 @@
|
|
1
|
-
class
|
1
|
+
class CreateAgents < ActiveRecord::Migration
|
2
2
|
def change
|
3
|
-
create_table :
|
3
|
+
create_table :agents do |t|
|
4
4
|
t.integer :user_id
|
5
5
|
t.string :last_name
|
6
6
|
t.string :middle_name
|
@@ -35,7 +35,7 @@ class CreatePatrons < ActiveRecord::Migration
|
|
35
35
|
t.datetime :date_of_death
|
36
36
|
t.integer :language_id, :default => 1, :null => false
|
37
37
|
t.integer :country_id, :default => 1, :null => false
|
38
|
-
t.integer :
|
38
|
+
t.integer :agent_type_id, :default => 1, :null => false
|
39
39
|
t.integer :lock_version, :default => 0, :null => false
|
40
40
|
t.text :note
|
41
41
|
t.integer :creates_count, :default => 0, :null => false
|
@@ -49,10 +49,10 @@ class CreatePatrons < ActiveRecord::Migration
|
|
49
49
|
t.text :email
|
50
50
|
t.text :url
|
51
51
|
end
|
52
|
-
add_index :
|
53
|
-
add_index :
|
54
|
-
add_index :
|
55
|
-
add_index :
|
56
|
-
add_index :
|
52
|
+
add_index :agents, :user_id, :unique => true
|
53
|
+
add_index :agents, :language_id
|
54
|
+
add_index :agents, :country_id
|
55
|
+
add_index :agents, :required_role_id
|
56
|
+
add_index :agents, :full_name
|
57
57
|
end
|
58
58
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class CreateOwns < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :owns do |t|
|
4
|
-
t.references :
|
4
|
+
t.references :agent, :null => false
|
5
5
|
t.references :item, :null => false
|
6
6
|
t.integer :position
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
|
-
add_index :owns, :
|
9
|
+
add_index :owns, :agent_id
|
10
10
|
add_index :owns, :item_id
|
11
11
|
end
|
12
12
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class CreateCreates < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :creates do |t|
|
4
|
-
t.references :
|
4
|
+
t.references :agent, :null => false
|
5
5
|
t.references :work, :null => false
|
6
6
|
t.integer :position
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
|
-
add_index :creates, :
|
9
|
+
add_index :creates, :agent_id
|
10
10
|
add_index :creates, :work_id
|
11
11
|
end
|
12
12
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class CreateProduces < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :produces do |t|
|
4
|
-
t.references :
|
4
|
+
t.references :agent, :null => false
|
5
5
|
t.references :manifestation, :null => false
|
6
6
|
t.integer :position
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
|
-
add_index :produces, :
|
9
|
+
add_index :produces, :agent_id
|
10
10
|
add_index :produces, :manifestation_id
|
11
11
|
end
|
12
12
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class CreateLibraries < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
3
|
create_table :libraries do |t|
|
4
|
-
t.references :
|
4
|
+
t.references :agent, :polymorphic => true
|
5
5
|
t.string :name, :null => false
|
6
6
|
t.text :display_name
|
7
7
|
t.string :short_display_name, :null => false
|
@@ -23,7 +23,7 @@ class CreateLibraries < ActiveRecord::Migration
|
|
23
23
|
t.timestamps
|
24
24
|
t.datetime :deleted_at
|
25
25
|
end
|
26
|
-
add_index :libraries, :
|
26
|
+
add_index :libraries, :agent_id, :unique => true
|
27
27
|
add_index :libraries, :library_group_id
|
28
28
|
add_index :libraries, :name, :unique => true
|
29
29
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class CreateDonates < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :donates do |t|
|
4
|
-
t.integer :
|
4
|
+
t.integer :agent_id, :null => false
|
5
5
|
t.integer :item_id, :null => false
|
6
6
|
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
|
-
add_index :donates, :
|
9
|
+
add_index :donates, :agent_id
|
10
10
|
add_index :donates, :item_id
|
11
11
|
end
|
12
12
|
end
|
@@ -1,13 +1,13 @@
|
|
1
1
|
class CreateRealizes < ActiveRecord::Migration
|
2
2
|
def change
|
3
3
|
create_table :realizes do |t|
|
4
|
-
t.references :
|
4
|
+
t.references :agent, :null => false
|
5
5
|
t.references :expression, :null => false
|
6
6
|
t.integer :position
|
7
7
|
|
8
8
|
t.timestamps
|
9
9
|
end
|
10
|
-
add_index :realizes, :
|
10
|
+
add_index :realizes, :agent_id
|
11
11
|
add_index :realizes, :expression_id
|
12
12
|
end
|
13
13
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
class
|
1
|
+
class CreateAgentRelationshipTypes < ActiveRecord::Migration
|
2
2
|
def change
|
3
|
-
create_table :
|
3
|
+
create_table :agent_relationship_types do |t|
|
4
4
|
t.string :name, :null => false
|
5
5
|
t.text :display_name
|
6
6
|
t.text :note
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class AddDcndlSchema < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
3
|
add_column :manifestations, :title_alternative_transcription, :text
|
4
|
-
add_column :
|
4
|
+
add_column :agents, :full_name_alternative_transcription, :text
|
5
5
|
add_column :manifestations, :description, :text
|
6
6
|
add_column :manifestations, :abstract, :text
|
7
7
|
add_column :manifestations, :available_at, :timestamp
|
@@ -14,7 +14,7 @@ class AddDcndlSchema < ActiveRecord::Migration
|
|
14
14
|
|
15
15
|
def self.down
|
16
16
|
remove_column :manifestations, :title_alternative_transcription
|
17
|
-
remove_column :
|
17
|
+
remove_column :agents, :full_name_alternative_transcription
|
18
18
|
remove_column :manifestations, :description
|
19
19
|
remove_column :manifestations, :abstract
|
20
20
|
remove_column :manifestations, :available_at
|
@@ -1,13 +1,13 @@
|
|
1
|
-
class
|
1
|
+
class CreateAgentRelationships < ActiveRecord::Migration
|
2
2
|
def change
|
3
|
-
create_table :
|
3
|
+
create_table :agent_relationships do |t|
|
4
4
|
t.integer :parent_id
|
5
5
|
t.integer :child_id
|
6
|
-
t.integer :
|
6
|
+
t.integer :agent_relationship_type_id
|
7
7
|
|
8
8
|
t.timestamps
|
9
9
|
end
|
10
|
-
add_index :
|
11
|
-
add_index :
|
10
|
+
add_index :agent_relationships, :parent_id
|
11
|
+
add_index :agent_relationships, :child_id
|
12
12
|
end
|
13
13
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
class
|
1
|
+
class AddPositionToAgentRelationship < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
3
|
add_column :manifestation_relationships, :position, :integer
|
4
|
-
add_column :
|
4
|
+
add_column :agent_relationships, :position, :integer
|
5
5
|
end
|
6
6
|
|
7
7
|
def self.down
|
8
|
-
remove_column :
|
8
|
+
remove_column :agent_relationships, :position
|
9
9
|
remove_column :manifestation_relationships, :position
|
10
10
|
end
|
11
11
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
class
|
1
|
+
class AddBirthDateAndDeathDateToAgent < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
-
add_column :
|
4
|
-
add_column :
|
3
|
+
add_column :agents, :birth_date, :string
|
4
|
+
add_column :agents, :death_date, :string
|
5
5
|
end
|
6
6
|
|
7
7
|
def self.down
|
8
|
-
remove_column :
|
9
|
-
remove_column :
|
8
|
+
remove_column :agents, :death_date
|
9
|
+
remove_column :agents, :birth_date
|
10
10
|
end
|
11
11
|
end
|