enju_inter_library_loan 0.2.0.beta.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/inter_library_loan_transition.rb +1 -1
  3. data/db/migrate/20180107164929_add_constraints_to_most_recent_for_inter_library_loan_transitions.rb +13 -0
  4. data/lib/enju_inter_library_loan/version.rb +1 -1
  5. data/spec/controllers/inter_library_loans_controller_spec.rb +20 -20
  6. data/spec/dummy/db/development.sqlite3 +0 -0
  7. data/spec/dummy/db/migrate/032_create_checkins.rb +3 -6
  8. data/spec/dummy/db/migrate/033_create_checkouts.rb +8 -13
  9. data/spec/dummy/db/migrate/035_create_reserves.rb +6 -11
  10. data/spec/dummy/db/migrate/059_create_libraries.rb +7 -9
  11. data/spec/dummy/db/migrate/069_create_shelves.rb +3 -4
  12. data/spec/dummy/db/migrate/080_create_library_groups.rb +2 -3
  13. data/spec/dummy/db/migrate/120_create_baskets.rb +2 -3
  14. data/spec/dummy/db/migrate/121_create_checked_items.rb +4 -5
  15. data/spec/dummy/db/migrate/127_create_use_restrictions.rb +1 -1
  16. data/spec/dummy/db/migrate/129_create_item_has_use_restrictions.rb +2 -4
  17. data/spec/dummy/db/migrate/132_create_circulation_statuses.rb +1 -1
  18. data/spec/dummy/db/migrate/20081006090811_create_subscriptions.rb +4 -7
  19. data/spec/dummy/db/migrate/20081006093246_create_subscribes.rb +4 -5
  20. data/spec/dummy/db/migrate/20081030023518_create_user_group_has_checkout_types.rb +8 -10
  21. data/spec/dummy/db/migrate/20081030023615_create_carrier_type_has_checkout_types.rb +3 -4
  22. data/spec/dummy/db/migrate/20081212075554_create_checkout_stat_has_manifestations.rb +4 -4
  23. data/spec/dummy/db/migrate/20081215094955_create_checkout_stat_has_users.rb +3 -5
  24. data/spec/dummy/db/migrate/20081216190517_create_reserve_stat_has_manifestations.rb +3 -3
  25. data/spec/dummy/db/migrate/20081220034117_create_reserve_stat_has_users.rb +2 -4
  26. data/spec/dummy/db/migrate/20090831220301_create_lending_policies.rb +5 -5
  27. data/spec/dummy/db/migrate/20091012101112_add_dcndl_schema.rb +2 -2
  28. data/spec/dummy/db/migrate/20111129044509_add_pickup_location_to_reserve.rb +6 -0
  29. data/spec/dummy/db/migrate/20120319173203_create_accepts.rb +3 -6
  30. data/spec/dummy/db/migrate/20120424103932_add_librarian_id_to_checked_item.rb +1 -1
  31. data/spec/dummy/db/migrate/20130416054135_add_circulation_status_id_to_item.rb +2 -2
  32. data/spec/dummy/db/migrate/20140110122216_create_user_import_files.rb +1 -1
  33. data/spec/dummy/db/migrate/20140110131010_create_user_import_results.rb +2 -2
  34. data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +1 -2
  35. data/spec/dummy/db/migrate/20140709113413_create_user_export_files.rb +1 -1
  36. data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +1 -1
  37. data/spec/dummy/db/migrate/20140720170714_add_default_library_id_to_user_import_file.rb +1 -1
  38. data/spec/dummy/db/migrate/20140720170735_add_default_user_group_id_to_user_import_file.rb +1 -1
  39. data/spec/dummy/db/migrate/20140810061942_add_user_id_to_user_checkout_stat.rb +4 -8
  40. data/spec/dummy/db/migrate/20140821151023_create_colors.rb +1 -3
  41. data/spec/dummy/db/migrate/20141014065831_add_shelf_id_to_checkout.rb +1 -2
  42. data/spec/dummy/db/migrate/20141020120523_add_library_id_to_checkout.rb +5 -0
  43. data/spec/dummy/db/migrate/20150106001709_create_demands.rb +11 -0
  44. data/spec/dummy/db/migrate/20150117111136_add_foreign_key_to_items_referencing_manifestations.rb +5 -0
  45. data/spec/dummy/db/migrate/20150924115059_create_withdraws.rb +3 -5
  46. data/spec/dummy/db/migrate/20151125004028_add_profile_id_to_agent.rb +6 -0
  47. data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +19 -6
  48. data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +15 -2
  49. data/spec/dummy/db/migrate/20160703184619_add_most_recent_to_reserve_transitions.rb +9 -0
  50. data/spec/dummy/db/migrate/20160703184650_add_most_recent_to_manifestation_checkout_stat_transitions.rb +9 -0
  51. data/spec/dummy/db/migrate/20160703184723_add_most_recent_to_manifestation_reserve_stat_transitions.rb +9 -0
  52. data/spec/dummy/db/migrate/20160703184747_add_most_recent_to_user_checkout_stat_transitions.rb +9 -0
  53. data/spec/dummy/db/migrate/20160703184805_add_most_recent_to_user_reserve_stat_transitions.rb +9 -0
  54. data/spec/dummy/db/migrate/20160703190209_add_foreign_key_on_manifestation_id_to_reserve.rb +5 -0
  55. data/spec/dummy/db/migrate/20160801080612_add_most_recent_to_import_request_transitions.rb +9 -0
  56. data/spec/dummy/db/migrate/20160801080619_add_most_recent_to_resource_import_file_transitions.rb +9 -0
  57. data/spec/dummy/db/migrate/20160801080637_add_most_recent_to_resource_export_file_transitions.rb +9 -0
  58. data/spec/dummy/db/migrate/20160801080643_add_most_recent_to_agent_import_file_transitions.rb +9 -0
  59. data/spec/dummy/db/migrate/20160811102604_add_picture_width_to_picture_file.rb +6 -0
  60. data/spec/dummy/db/migrate/20160820004638_add_attachment_attachment_to_carrier_types.rb +11 -0
  61. data/spec/dummy/db/migrate/20170305064014_add_csv_charset_conversion_to_library_group.rb +5 -0
  62. data/spec/dummy/db/migrate/20171014084528_add_header_logo_to_library_group.rb +5 -0
  63. data/spec/dummy/db/migrate/20171119051258_set_not_null_to_manifestation_id_on_items.rb +5 -0
  64. data/spec/dummy/db/migrate/20171126133835_rename_login_banner_to_old_login_banner.rb +5 -0
  65. data/spec/dummy/db/migrate/20171126135238_add_foreign_key_to_library_group_id_on_library.rb +5 -0
  66. data/spec/dummy/db/migrate/20180102162311_add_header_logo_meta_to_library_group.rb +5 -0
  67. data/spec/dummy/db/migrate/20180107161035_add_constraints_to_most_recent_for_reserve_transitions.rb +13 -0
  68. data/spec/dummy/db/migrate/20180107161311_add_constraints_to_most_recent_for_agent_import_file_transitions.rb +13 -0
  69. data/spec/dummy/db/migrate/20180107161331_add_constraints_to_most_recent_for_resource_import_file_transitions.rb +13 -0
  70. data/spec/dummy/db/migrate/20180107161347_add_constraints_to_most_recent_for_resource_export_file_transitions.rb +13 -0
  71. data/spec/dummy/db/migrate/20180107161410_add_constraints_to_most_recent_for_import_request_transitions.rb +13 -0
  72. data/spec/dummy/db/migrate/20180107161951_add_constraints_to_most_recent_for_user_checkout_stat_transitions.rb +13 -0
  73. data/spec/dummy/db/migrate/20180107162009_add_constraints_to_most_recent_for_user_reserve_stat_transitions.rb +13 -0
  74. data/spec/dummy/db/migrate/20180107162029_add_constraints_to_most_recent_for_manifestation_checkout_stat_transitions.rb +13 -0
  75. data/spec/dummy/db/migrate/20180107162048_add_constraints_to_most_recent_for_manifestation_reserve_stat_transitions.rb +13 -0
  76. data/spec/dummy/db/schema.rb +59 -8
  77. data/spec/dummy/db/test.sqlite3 +0 -0
  78. data/spec/factories/inter_library_loan.rb +3 -3
  79. data/spec/factories/item.rb +2 -2
  80. data/spec/factories/library.rb +2 -2
  81. data/spec/factories/manifestation.rb +1 -1
  82. data/spec/factories/user.rb +1 -1
  83. data/spec/fixtures/inter_library_loan_transitions.yml +8 -1
  84. data/spec/rails_helper.rb +3 -3
  85. data/spec/support/controller_macros.rb +3 -3
  86. data/spec/support/devise.rb +2 -2
  87. metadata +299 -288
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 898e7475ac7f7f654e572612a849329e6acc4a61
4
- data.tar.gz: e3143faec0387d62e08bc875bdc8daa9259c3b0b
3
+ metadata.gz: 3f7f5bd108fbe02cf3c25d1807e9dda6db9162d9
4
+ data.tar.gz: ad2f073eba58cb32f640da9201f56bc3137855f0
5
5
  SHA512:
6
- metadata.gz: 4287306f7f701305a6d95bf5553dff358156ee2c9eeba20da315fde38c0bd061a99da73778485d4a8536556a490fc0ddee0bd32a12e8511add1b8d2d2738a7a8
7
- data.tar.gz: c53a4a69eb02d18ae1f9a1ac5fcc4b362f0378887b776c3788bc2aede93840ad55eef74901b91f308c36454d19b6e025780f061ee2cee3be38c83dbe1cbb546d
6
+ metadata.gz: 89974ba6a5ab1a10509e320c8e0f5b810349bbcfb4619b0bf9f6063b812f75b4626021640d6471d79809aead37477d6fa1db3b241e8170ca52544abf50eb9f1e
7
+ data.tar.gz: a13e01dfcff626094b16faac72243e6b0a40d02fc23da661f4cdce7ba84f9b3463dcaf3fa2c956afddd8422e356d6ab60815cec18093f14acd2e267b596ce05c
@@ -17,5 +17,5 @@ end
17
17
  # inter_library_loan_id :integer
18
18
  # created_at :datetime
19
19
  # updated_at :datetime
20
- # most_recent :boolean
20
+ # most_recent :boolean not null
21
21
  #
@@ -0,0 +1,13 @@
1
+ class AddConstraintsToMostRecentForInterLibraryLoanTransitions < ActiveRecord::Migration
2
+ disable_ddl_transaction!
3
+
4
+ def up
5
+ add_index :inter_library_loan_transitions, [:inter_library_loan_id, :most_recent], unique: true, where: "most_recent", name: "index_inter_library_loan_transitions_parent_most_recent" #, algorithm: :concurrently
6
+ change_column_null :inter_library_loan_transitions, :most_recent, false
7
+ end
8
+
9
+ def down
10
+ remove_index :inter_library_loan_transitions, name: "index_inter_library_loan_transitions_parent_most_recent"
11
+ change_column_null :inter_library_loan_transitions, :most_recent, true
12
+ end
13
+ end
@@ -1,3 +1,3 @@
1
1
  module EnjuInterLibraryLoan
2
- VERSION = "0.2.0.beta.2"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -8,7 +8,7 @@ describe InterLibraryLoansController do
8
8
  describe "GET index" do
9
9
  describe "When logged in as Administrator" do
10
10
  before(:each) do
11
- sign_in FactoryGirl.create(:admin)
11
+ sign_in FactoryBot.create(:admin)
12
12
  end
13
13
 
14
14
  it "assigns all inter_library_loans as @inter_library_loans" do
@@ -19,7 +19,7 @@ describe InterLibraryLoansController do
19
19
 
20
20
  describe "When logged in as Librarian" do
21
21
  before(:each) do
22
- sign_in FactoryGirl.create(:librarian)
22
+ sign_in FactoryBot.create(:librarian)
23
23
  end
24
24
 
25
25
  it "assigns all inter_library_loans as @inter_library_loans" do
@@ -30,7 +30,7 @@ describe InterLibraryLoansController do
30
30
 
31
31
  describe "When logged in as User" do
32
32
  before(:each) do
33
- sign_in FactoryGirl.create(:user)
33
+ sign_in FactoryBot.create(:user)
34
34
  end
35
35
 
36
36
  it "assigns empty as @inter_library_loans" do
@@ -50,11 +50,11 @@ describe InterLibraryLoansController do
50
50
  describe "GET show" do
51
51
  describe "When logged in as Administrator" do
52
52
  before(:each) do
53
- sign_in FactoryGirl.create(:admin)
53
+ sign_in FactoryBot.create(:admin)
54
54
  end
55
55
 
56
56
  it "assigns the requested inter_library_loan as @inter_library_loan" do
57
- inter_library_loan = FactoryGirl.create(:inter_library_loan)
57
+ inter_library_loan = FactoryBot.create(:inter_library_loan)
58
58
  get :show, :id => inter_library_loan.id
59
59
  assigns(:inter_library_loan).should eq(inter_library_loan)
60
60
  end
@@ -62,11 +62,11 @@ describe InterLibraryLoansController do
62
62
 
63
63
  describe "When logged in as Librarian" do
64
64
  before(:each) do
65
- sign_in FactoryGirl.create(:librarian)
65
+ sign_in FactoryBot.create(:librarian)
66
66
  end
67
67
 
68
68
  it "assigns the requested inter_library_loan as @inter_library_loan" do
69
- inter_library_loan = FactoryGirl.create(:inter_library_loan)
69
+ inter_library_loan = FactoryBot.create(:inter_library_loan)
70
70
  get :show, :id => inter_library_loan.id
71
71
  assigns(:inter_library_loan).should eq(inter_library_loan)
72
72
  end
@@ -74,11 +74,11 @@ describe InterLibraryLoansController do
74
74
 
75
75
  describe "When logged in as User" do
76
76
  before(:each) do
77
- sign_in FactoryGirl.create(:user)
77
+ sign_in FactoryBot.create(:user)
78
78
  end
79
79
 
80
80
  it "assigns the requested inter_library_loan as @inter_library_loan" do
81
- inter_library_loan = FactoryGirl.create(:inter_library_loan)
81
+ inter_library_loan = FactoryBot.create(:inter_library_loan)
82
82
  get :show, :id => inter_library_loan.id
83
83
  assigns(:inter_library_loan).should eq(inter_library_loan)
84
84
  end
@@ -86,7 +86,7 @@ describe InterLibraryLoansController do
86
86
 
87
87
  describe "When not logged in" do
88
88
  it "assigns the requested inter_library_loan as @inter_library_loan" do
89
- inter_library_loan = FactoryGirl.create(:inter_library_loan)
89
+ inter_library_loan = FactoryBot.create(:inter_library_loan)
90
90
  get :show, :id => inter_library_loan.id
91
91
  assigns(:inter_library_loan).should eq(inter_library_loan)
92
92
  end
@@ -96,7 +96,7 @@ describe InterLibraryLoansController do
96
96
  describe "GET new" do
97
97
  describe "When logged in as Administrator" do
98
98
  before(:each) do
99
- sign_in FactoryGirl.create(:admin)
99
+ sign_in FactoryBot.create(:admin)
100
100
  end
101
101
 
102
102
  it "assigns the requested inter_library_loan as @inter_library_loan" do
@@ -107,7 +107,7 @@ describe InterLibraryLoansController do
107
107
 
108
108
  describe "When logged in as Librarian" do
109
109
  before(:each) do
110
- sign_in FactoryGirl.create(:librarian)
110
+ sign_in FactoryBot.create(:librarian)
111
111
  end
112
112
 
113
113
  it "assigns the requested inter_library_loan as @inter_library_loan" do
@@ -118,7 +118,7 @@ describe InterLibraryLoansController do
118
118
 
119
119
  describe "When logged in as User" do
120
120
  before(:each) do
121
- sign_in FactoryGirl.create(:user)
121
+ sign_in FactoryBot.create(:user)
122
122
  end
123
123
 
124
124
  it "should not assign the requested inter_library_loan as @inter_library_loan" do
@@ -140,11 +140,11 @@ describe InterLibraryLoansController do
140
140
  describe "GET edit" do
141
141
  describe "When logged in as Administrator" do
142
142
  before(:each) do
143
- sign_in FactoryGirl.create(:admin)
143
+ sign_in FactoryBot.create(:admin)
144
144
  end
145
145
 
146
146
  it "assigns the requested inter_library_loan as @inter_library_loan" do
147
- inter_library_loan = FactoryGirl.create(:inter_library_loan)
147
+ inter_library_loan = FactoryBot.create(:inter_library_loan)
148
148
  get :edit, :id => inter_library_loan.id
149
149
  assigns(:inter_library_loan).should eq(inter_library_loan)
150
150
  end
@@ -152,11 +152,11 @@ describe InterLibraryLoansController do
152
152
 
153
153
  describe "When logged in as Librarian" do
154
154
  before(:each) do
155
- sign_in FactoryGirl.create(:librarian)
155
+ sign_in FactoryBot.create(:librarian)
156
156
  end
157
157
 
158
158
  it "assigns the requested inter_library_loan as @inter_library_loan" do
159
- inter_library_loan = FactoryGirl.create(:inter_library_loan)
159
+ inter_library_loan = FactoryBot.create(:inter_library_loan)
160
160
  get :edit, :id => inter_library_loan.id
161
161
  assigns(:inter_library_loan).should eq(inter_library_loan)
162
162
  end
@@ -164,11 +164,11 @@ describe InterLibraryLoansController do
164
164
 
165
165
  describe "When logged in as User" do
166
166
  before(:each) do
167
- sign_in FactoryGirl.create(:user)
167
+ sign_in FactoryBot.create(:user)
168
168
  end
169
169
 
170
170
  it "assigns the requested inter_library_loan as @inter_library_loan" do
171
- inter_library_loan = FactoryGirl.create(:inter_library_loan)
171
+ inter_library_loan = FactoryBot.create(:inter_library_loan)
172
172
  get :edit, :id => inter_library_loan.id
173
173
  response.should be_forbidden
174
174
  end
@@ -176,7 +176,7 @@ describe InterLibraryLoansController do
176
176
 
177
177
  describe "When not logged in" do
178
178
  it "should not assign the requested inter_library_loan as @inter_library_loan" do
179
- inter_library_loan = FactoryGirl.create(:inter_library_loan)
179
+ inter_library_loan = FactoryBot.create(:inter_library_loan)
180
180
  get :edit, :id => inter_library_loan.id
181
181
  response.should redirect_to(new_user_session_url)
182
182
  end
File without changes
@@ -1,14 +1,11 @@
1
1
  class CreateCheckins < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :checkins do |t|
4
- t.integer :item_id, :null => false
5
- t.integer :librarian_id
6
- t.integer :basket_id
4
+ t.references :item, index: true, foreign_key: true, null: false
5
+ t.references :librarian, index: true
6
+ t.references :basket, index: true
7
7
  t.timestamps
8
8
  end
9
- add_index :checkins, :item_id
10
- add_index :checkins, :librarian_id
11
- add_index :checkins, :basket_id
12
9
  end
13
10
 
14
11
  def self.down
@@ -1,22 +1,17 @@
1
1
  class CreateCheckouts < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :checkouts do |t|
4
- t.integer :user_id
5
- t.integer :item_id, :null => false
6
- t.integer :checkin_id
7
- t.integer :librarian_id
8
- t.integer :basket_id
4
+ t.references :user, index: true, foreign_key: true
5
+ t.references :item, index: true, foreign_key: true, null: false
6
+ t.references :checkin, index: true, foreign_key: true
7
+ t.references :librarian, index: true
8
+ t.references :basket, index: true
9
9
  t.datetime :due_date
10
- t.integer :checkout_renewal_count, :default => 0, :null => false
11
- t.integer :lock_version, :default => 0, :null => false
10
+ t.integer :checkout_renewal_count, default: 0, null: false
11
+ t.integer :lock_version, default: 0, null: false
12
12
  t.timestamps
13
13
  end
14
- add_index :checkouts, :user_id
15
- add_index :checkouts, :item_id
16
- add_index :checkouts, :basket_id
17
- add_index :checkouts, [:item_id, :basket_id], :unique => true
18
- add_index :checkouts, :librarian_id
19
- add_index :checkouts, :checkin_id
14
+ add_index :checkouts, [:item_id, :basket_id], unique: true
20
15
  end
21
16
 
22
17
  def self.down
@@ -1,23 +1,18 @@
1
1
  class CreateReserves < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :reserves do |t|
4
- t.integer :user_id, :null => false
5
- t.integer :manifestation_id, :null => false
6
- t.integer :item_id
7
- t.integer :request_status_type_id, :null => false
4
+ t.references :user, index: true, foreign_key: true, null: false
5
+ t.references :manifestation, index: true, null: false
6
+ t.references :item, index: true
7
+ t.references :request_status_type, null: false
8
8
  t.datetime :checked_out_at
9
9
  t.timestamps
10
10
  t.datetime :canceled_at
11
11
  t.datetime :expired_at
12
12
  t.datetime :deleted_at
13
- t.boolean :expiration_notice_to_patron, :default => false
14
- t.boolean :expiration_notice_to_library, :default => false
13
+ t.boolean :expiration_notice_to_patron, default: false
14
+ t.boolean :expiration_notice_to_library, default: false
15
15
  end
16
-
17
- add_index :reserves, :user_id
18
- add_index :reserves, :manifestation_id
19
- add_index :reserves, :item_id
20
- add_index :reserves, :request_status_type_id
21
16
  end
22
17
 
23
18
  def self.down
@@ -1,9 +1,9 @@
1
1
  class CreateLibraries < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :libraries do |t|
4
- t.string :name, :null => false
4
+ t.string :name, index: true, null: false
5
5
  t.text :display_name
6
- t.string :short_display_name, :null => false
6
+ t.string :short_display_name, null: false
7
7
  t.string :zip_code
8
8
  t.text :street
9
9
  t.text :locality
@@ -12,17 +12,15 @@ class CreateLibraries < ActiveRecord::Migration
12
12
  t.string :telephone_number_2
13
13
  t.string :fax_number
14
14
  t.text :note
15
- t.integer :call_number_rows, :default => 1, :null => false
16
- t.string :call_number_delimiter, :default => "|", :null => false
17
- t.integer :library_group_id, :default => 1, :null => false
18
- t.integer :users_count, :default => 0, :null => false
15
+ t.integer :call_number_rows, default: 1, null: false
16
+ t.string :call_number_delimiter, default: "|", null: false
17
+ t.references :library_group, index: true, null: false
18
+ t.integer :users_count, default: 0, null: false
19
19
  t.integer :position
20
- t.integer :country_id
20
+ t.references :country
21
21
 
22
22
  t.timestamps
23
23
  t.datetime :deleted_at
24
24
  end
25
- add_index :libraries, :library_group_id
26
- add_index :libraries, :name, :unique => true
27
25
  end
28
26
  end
@@ -1,15 +1,14 @@
1
1
  class CreateShelves < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :shelves do |t|
4
- t.string :name, :null => false
4
+ t.string :name, null: false
5
5
  t.text :display_name
6
6
  t.text :note
7
- t.integer :library_id, :default => 1, :null => false
8
- t.integer :items_count, :default => 0, :null => false
7
+ t.references :library, index: true, null: false
8
+ t.integer :items_count, default: 0, null: false
9
9
  t.integer :position
10
10
  t.timestamps
11
11
  t.datetime :deleted_at
12
12
  end
13
- add_index :shelves, :library_id
14
13
  end
15
14
  end
@@ -1,9 +1,9 @@
1
1
  class CreateLibraryGroups < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :library_groups do |t|
4
- t.string :name, :null => false
4
+ t.string :name, null: false
5
5
  t.text :display_name
6
- t.string :short_name, :null => false
6
+ t.string :short_name, index: true, null: false
7
7
  t.text :my_networks
8
8
  t.text :login_banner
9
9
  t.text :note
@@ -12,6 +12,5 @@ class CreateLibraryGroups < ActiveRecord::Migration
12
12
 
13
13
  t.timestamps
14
14
  end
15
- add_index :library_groups, :short_name
16
15
  end
17
16
  end
@@ -1,12 +1,11 @@
1
1
  class CreateBaskets < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :baskets do |t|
4
- t.integer :user_id
4
+ t.references :user, index: true
5
5
  t.text :note
6
- t.integer :lock_version, :default => 0, :null => false
6
+ t.integer :lock_version, default: 0, null: false
7
7
 
8
8
  t.timestamps
9
9
  end
10
- add_index :baskets, :user_id
11
10
  end
12
11
  end
@@ -1,14 +1,13 @@
1
1
  class CreateCheckedItems < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :checked_items do |t|
4
- t.integer :item_id, :null => false
5
- t.integer :basket_id, :null => false
6
- t.datetime :due_date, :null => false
4
+ t.references :item, index: true, foreign_key: true, null: false
5
+ t.references :basket, index: true, foreign_key: true, null: false
6
+ t.references :librarian, index: true
7
+ t.datetime :due_date, null: false
7
8
 
8
9
  t.timestamps
9
10
  end
10
- add_index :checked_items, :item_id
11
- add_index :checked_items, :basket_id
12
11
  end
13
12
 
14
13
  def self.down
@@ -1,7 +1,7 @@
1
1
  class CreateUseRestrictions < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :use_restrictions do |t|
4
- t.string :name, :null => false
4
+ t.string :name, null: false
5
5
  t.text :display_name
6
6
  t.text :note
7
7
  t.integer :position
@@ -1,13 +1,11 @@
1
1
  class CreateItemHasUseRestrictions < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :item_has_use_restrictions do |t|
4
- t.integer :item_id, :null => false
5
- t.integer :use_restriction_id, :null => false
4
+ t.references :item, index: true, foreign_key: true, null: false
5
+ t.references :use_restriction, index: true, foreign_key: true, null: false
6
6
 
7
7
  t.timestamps
8
8
  end
9
- add_index :item_has_use_restrictions, :item_id
10
- add_index :item_has_use_restrictions, :use_restriction_id
11
9
  end
12
10
 
13
11
  def self.down
@@ -1,7 +1,7 @@
1
1
  class CreateCirculationStatuses < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :circulation_statuses do |t|
4
- t.string :name, :null => false
4
+ t.string :name, null: false
5
5
  t.text :display_name
6
6
  t.text :note
7
7
  t.integer :position
@@ -1,17 +1,14 @@
1
1
  class CreateSubscriptions < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :subscriptions do |t|
4
- t.text :title, :null => false
4
+ t.text :title, null: false
5
5
  t.text :note
6
- #t.integer :subscription_list_id, :integer
7
- t.integer :user_id
8
- t.integer :order_list_id
6
+ t.references :user, index: true
7
+ t.references :order_list, index: true
9
8
  t.datetime :deleted_at
10
- t.integer :subscribes_count, :default => 0, :null => false
9
+ t.integer :subscribes_count, default: 0, null: false
11
10
 
12
11
  t.timestamps
13
12
  end
14
- add_index :subscriptions, :user_id
15
- add_index :subscriptions, :order_list_id
16
13
  end
17
14
  end
@@ -1,14 +1,13 @@
1
1
  class CreateSubscribes < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :subscribes do |t|
4
- t.integer :subscription_id, :null => false
5
- t.integer :work_id, :null => false
6
- t.datetime :start_at, :null => false
7
- t.datetime :end_at, :null => false
4
+ t.references :subscription, index: true, null: false
5
+ t.integer :work_id, null: false
6
+ t.datetime :start_at, null: false
7
+ t.datetime :end_at, null: false
8
8
 
9
9
  t.timestamps
10
10
  end
11
- add_index :subscribes, :subscription_id
12
11
  add_index :subscribes, :work_id
13
12
  end
14
13
  end