enju_message 0.1.14.pre14 → 0.1.14.pre15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/message_requests_controller.rb +5 -5
  3. data/app/controllers/messages_controller.rb +17 -17
  4. data/app/models/message.rb +34 -24
  5. data/app/models/message_request.rb +25 -30
  6. data/app/models/message_request_state_machine.rb +12 -0
  7. data/app/models/message_request_transition.rb +20 -0
  8. data/app/models/message_state_machine.rb +24 -0
  9. data/app/models/message_template.rb +3 -3
  10. data/app/models/message_transition.rb +20 -0
  11. data/app/views/layouts/messages.html.erb +3 -3
  12. data/app/views/message_requests/edit.html.erb +1 -1
  13. data/app/views/message_requests/index.html.erb +8 -8
  14. data/app/views/message_requests/new.html.erb +2 -2
  15. data/app/views/message_requests/show.html.erb +2 -2
  16. data/app/views/message_templates/_form.html.erb +4 -4
  17. data/app/views/message_templates/edit.html.erb +1 -1
  18. data/app/views/message_templates/index.html.erb +3 -3
  19. data/app/views/message_templates/new.html.erb +1 -1
  20. data/app/views/message_templates/show.html.erb +1 -1
  21. data/app/views/messages/_form.html.erb +0 -4
  22. data/app/views/messages/edit.html.erb +5 -5
  23. data/app/views/messages/index.atom.builder +2 -2
  24. data/app/views/messages/index.html.erb +7 -7
  25. data/app/views/messages/index.rss.builder +9 -9
  26. data/app/views/messages/new.html.erb +7 -7
  27. data/app/views/messages/show.html.erb +5 -5
  28. data/app/views/notifier/message_notification.en.text.erb +1 -1
  29. data/app/views/notifier/message_notification.ja.text.erb +1 -1
  30. data/config/initializers/statesman.rb +3 -0
  31. data/db/migrate/154_create_messages.rb +0 -1
  32. data/db/migrate/20080819181903_create_message_requests.rb +0 -2
  33. data/db/migrate/20140518111006_create_message_transitions.rb +14 -0
  34. data/db/migrate/20140518135713_create_message_request_transitions.rb +14 -0
  35. data/lib/enju_message/engine.rb +1 -1
  36. data/lib/enju_message/user.rb +2 -2
  37. data/lib/enju_message/version.rb +1 -1
  38. data/lib/generators/enju_message/setup/setup_generator.rb +2 -0
  39. data/lib/generators/enju_message/setup/templates/db/fixtures/message_templates.yml +41 -20
  40. data/lib/tasks/enju_message_tasks.rake +10 -0
  41. data/lib/tasks/message_template.rb +13 -0
  42. data/spec/controllers/message_requests_controller_spec.rb +15 -15
  43. data/spec/controllers/message_templates_controller_spec.rb +21 -21
  44. data/spec/controllers/messages_controller_spec.rb +7 -13
  45. data/spec/dummy/app/mailers/notifier.rb +6 -6
  46. data/spec/dummy/db/migrate/001_create_agents.rb +0 -2
  47. data/spec/dummy/db/migrate/20140110122216_create_user_import_files.rb +18 -0
  48. data/spec/dummy/db/migrate/20140110131010_create_user_import_results.rb +11 -0
  49. data/spec/dummy/db/migrate/20140122054321_create_profiles.rb +20 -0
  50. data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +14 -0
  51. data/spec/dummy/db/migrate/20140610123439_drop_email_unique_constraint_enju_leaf_rc10.rb +11 -0
  52. data/spec/dummy/db/migrate/20140628072217_add_user_encoding_to_user_import_file.rb +5 -0
  53. data/spec/dummy/db/migrate/20140709113413_create_user_export_files.rb +11 -0
  54. data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +14 -0
  55. data/spec/dummy/db/migrate/20140720170714_add_default_library_id_to_user_import_file.rb +5 -0
  56. data/spec/dummy/db/migrate/20140720170735_add_default_user_group_id_to_user_import_file.rb +5 -0
  57. data/spec/dummy/db/migrate/20140811031145_add_expired_at_to_profile.rb +5 -0
  58. data/spec/dummy/db/schema.rb +105 -8
  59. data/spec/dummy/db/test.sqlite3 +0 -0
  60. data/spec/dummy/solr/default/data/index/_oj.fdt +0 -0
  61. data/spec/dummy/solr/default/data/index/{_n.si → _oj.si} +0 -0
  62. data/spec/dummy/solr/default/data/index/{_n_Lucene41_0.tim → _oj_Lucene41_0.tim} +0 -0
  63. data/spec/dummy/solr/default/data/index/segments.gen +0 -0
  64. data/spec/dummy/solr/default/data/index/segments_14v +0 -0
  65. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001460 +0 -0
  66. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001461 +0 -0
  67. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001462 +0 -0
  68. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001463 +0 -0
  69. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001464 +0 -0
  70. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001465 +0 -0
  71. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001466 +0 -0
  72. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001467 +0 -0
  73. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001468 +0 -0
  74. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000001469 +0 -0
  75. data/spec/factories/message.rb +2 -2
  76. data/spec/factories/profile.rb +10 -0
  77. data/spec/fixtures/agents.yml +0 -12
  78. data/spec/fixtures/message_requests.yml +0 -3
  79. data/spec/fixtures/messages.yml +0 -5
  80. data/spec/fixtures/profiles.yml +98 -0
  81. data/spec/fixtures/users.yml +3 -23
  82. data/spec/models/message_request_spec.rb +0 -2
  83. data/spec/models/message_spec.rb +2 -4
  84. data/spec/spec_helper.rb +3 -0
  85. metadata +95 -47
  86. data/spec/dummy/solr/default/data/index/_n.fdt +0 -0
  87. data/spec/dummy/solr/default/data/index/segments_15 +0 -0
  88. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000030 +0 -0
  89. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000031 +0 -0
  90. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000032 +0 -0
  91. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000033 +0 -0
  92. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000034 +0 -0
  93. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000035 +0 -0
  94. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000036 +0 -0
  95. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000037 +0 -0
  96. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000038 +0 -0
  97. data/spec/dummy/solr/default/data/tlog/tlog.0000000000000000039 +0 -0
  98. /data/spec/dummy/solr/default/data/index/{_n.fdx → _oj.fdx} +0 -0
  99. /data/spec/dummy/solr/default/data/index/{_n.fnm → _oj.fnm} +0 -0
  100. /data/spec/dummy/solr/default/data/index/{_n.nvd → _oj.nvd} +0 -0
  101. /data/spec/dummy/solr/default/data/index/{_n.nvm → _oj.nvm} +0 -0
  102. /data/spec/dummy/solr/default/data/index/{_n_Lucene41_0.doc → _oj_Lucene41_0.doc} +0 -0
  103. /data/spec/dummy/solr/default/data/index/{_n_Lucene41_0.pos → _oj_Lucene41_0.pos} +0 -0
  104. /data/spec/dummy/solr/default/data/index/{_n_Lucene41_0.tip → _oj_Lucene41_0.tip} +0 -0
@@ -7,7 +7,7 @@ describe MessageTemplatesController do
7
7
 
8
8
  describe "GET index" do
9
9
  describe "When logged in as Administrator" do
10
- login_admin
10
+ login_fixture_admin
11
11
 
12
12
  it "assigns all message_templates as @message_templates" do
13
13
  get :index
@@ -16,7 +16,7 @@ describe MessageTemplatesController do
16
16
  end
17
17
 
18
18
  describe "When logged in as Librarian" do
19
- login_librarian
19
+ login_fixture_librarian
20
20
 
21
21
  it "assigns all message_templates as @message_templates" do
22
22
  get :index
@@ -25,7 +25,7 @@ describe MessageTemplatesController do
25
25
  end
26
26
 
27
27
  describe "When logged in as User" do
28
- login_user
28
+ login_fixture_user
29
29
 
30
30
  it "assigns empty as @message_templates" do
31
31
  get :index
@@ -45,7 +45,7 @@ describe MessageTemplatesController do
45
45
 
46
46
  describe "GET show" do
47
47
  describe "When logged in as Administrator" do
48
- login_admin
48
+ login_fixture_admin
49
49
 
50
50
  it "assigns the requested message_template as @message_template" do
51
51
  message_template = FactoryGirl.create(:message_template)
@@ -55,7 +55,7 @@ describe MessageTemplatesController do
55
55
  end
56
56
 
57
57
  describe "When logged in as Librarian" do
58
- login_librarian
58
+ login_fixture_librarian
59
59
 
60
60
  it "assigns the requested message_template as @message_template" do
61
61
  message_template = FactoryGirl.create(:message_template)
@@ -65,7 +65,7 @@ describe MessageTemplatesController do
65
65
  end
66
66
 
67
67
  describe "When logged in as User" do
68
- login_user
68
+ login_fixture_user
69
69
 
70
70
  it "assigns the requested message_template as @message_template" do
71
71
  message_template = FactoryGirl.create(:message_template)
@@ -85,7 +85,7 @@ describe MessageTemplatesController do
85
85
 
86
86
  describe "GET new" do
87
87
  describe "When logged in as Administrator" do
88
- login_admin
88
+ login_fixture_admin
89
89
 
90
90
  it "assigns the requested message_template as @message_template" do
91
91
  get :new
@@ -95,7 +95,7 @@ describe MessageTemplatesController do
95
95
  end
96
96
 
97
97
  describe "When logged in as Librarian" do
98
- login_librarian
98
+ login_fixture_librarian
99
99
 
100
100
  it "should not assign the requested message_template as @message_template" do
101
101
  get :new
@@ -105,7 +105,7 @@ describe MessageTemplatesController do
105
105
  end
106
106
 
107
107
  describe "When logged in as User" do
108
- login_user
108
+ login_fixture_user
109
109
 
110
110
  it "should not assign the requested message_template as @message_template" do
111
111
  get :new
@@ -125,7 +125,7 @@ describe MessageTemplatesController do
125
125
 
126
126
  describe "GET edit" do
127
127
  describe "When logged in as Administrator" do
128
- login_admin
128
+ login_fixture_admin
129
129
 
130
130
  it "assigns the requested message_template as @message_template" do
131
131
  message_template = FactoryGirl.create(:message_template)
@@ -135,7 +135,7 @@ describe MessageTemplatesController do
135
135
  end
136
136
 
137
137
  describe "When logged in as Librarian" do
138
- login_librarian
138
+ login_fixture_librarian
139
139
 
140
140
  it "assigns the requested message_template as @message_template" do
141
141
  message_template = FactoryGirl.create(:message_template)
@@ -145,7 +145,7 @@ describe MessageTemplatesController do
145
145
  end
146
146
 
147
147
  describe "When logged in as User" do
148
- login_user
148
+ login_fixture_user
149
149
 
150
150
  it "assigns the requested message_template as @message_template" do
151
151
  message_template = FactoryGirl.create(:message_template)
@@ -170,7 +170,7 @@ describe MessageTemplatesController do
170
170
  end
171
171
 
172
172
  describe "When logged in as Administrator" do
173
- login_admin
173
+ login_fixture_admin
174
174
 
175
175
  describe "with valid params" do
176
176
  it "assigns a newly created message_template as @message_template" do
@@ -198,7 +198,7 @@ describe MessageTemplatesController do
198
198
  end
199
199
 
200
200
  describe "When logged in as Librarian" do
201
- login_librarian
201
+ login_fixture_librarian
202
202
 
203
203
  describe "with valid params" do
204
204
  it "assigns a newly created message_template as @message_template" do
@@ -226,7 +226,7 @@ describe MessageTemplatesController do
226
226
  end
227
227
 
228
228
  describe "When logged in as User" do
229
- login_user
229
+ login_fixture_user
230
230
 
231
231
  describe "with valid params" do
232
232
  it "assigns a newly created message_template as @message_template" do
@@ -288,7 +288,7 @@ describe MessageTemplatesController do
288
288
  end
289
289
 
290
290
  describe "When logged in as Administrator" do
291
- login_admin
291
+ login_fixture_admin
292
292
 
293
293
  describe "with valid params" do
294
294
  it "updates the requested message_template" do
@@ -315,7 +315,7 @@ describe MessageTemplatesController do
315
315
  end
316
316
 
317
317
  describe "When logged in as Librarian" do
318
- login_librarian
318
+ login_fixture_librarian
319
319
 
320
320
  describe "with valid params" do
321
321
  it "updates the requested message_template" do
@@ -338,7 +338,7 @@ describe MessageTemplatesController do
338
338
  end
339
339
 
340
340
  describe "When logged in as User" do
341
- login_user
341
+ login_fixture_user
342
342
 
343
343
  describe "with valid params" do
344
344
  it "updates the requested message_template" do
@@ -387,7 +387,7 @@ describe MessageTemplatesController do
387
387
  end
388
388
 
389
389
  describe "When logged in as Administrator" do
390
- login_admin
390
+ login_fixture_admin
391
391
 
392
392
  it "destroys the requested message_template" do
393
393
  delete :destroy, :id => @message_template.id
@@ -400,7 +400,7 @@ describe MessageTemplatesController do
400
400
  end
401
401
 
402
402
  describe "When logged in as Librarian" do
403
- login_librarian
403
+ login_fixture_librarian
404
404
 
405
405
  it "destroys the requested message_template" do
406
406
  delete :destroy, :id => @message_template.id
@@ -413,7 +413,7 @@ describe MessageTemplatesController do
413
413
  end
414
414
 
415
415
  describe "When logged in as User" do
416
- login_user
416
+ login_fixture_user
417
417
 
418
418
  it "destroys the requested message_template" do
419
419
  delete :destroy, :id => @message_template.id
@@ -9,10 +9,7 @@ describe MessagesController do
9
9
  end
10
10
 
11
11
  describe "When logged in as Administrator" do
12
- before(:each) do
13
- @user = FactoryGirl.create(:admin)
14
- sign_in @user
15
- end
12
+ login_fixture_admin
16
13
 
17
14
  it "should get its own messages" do
18
15
  get :index
@@ -29,10 +26,7 @@ describe MessagesController do
29
26
  end
30
27
 
31
28
  describe "When logged in as Librarian" do
32
- before(:each) do
33
- @user = FactoryGirl.create(:librarian)
34
- sign_in @user
35
- end
29
+ login_fixture_librarian
36
30
 
37
31
  it "should get its own messages" do
38
32
  get :index
@@ -133,7 +127,7 @@ describe MessagesController do
133
127
 
134
128
  describe "GET new" do
135
129
  describe "When logged in as Administrator" do
136
- login_admin
130
+ login_fixture_admin
137
131
 
138
132
  it "assigns the requested message as @message" do
139
133
  get :new
@@ -142,7 +136,7 @@ describe MessagesController do
142
136
  end
143
137
 
144
138
  describe "When logged in as Librarian" do
145
- login_librarian
139
+ login_fixture_librarian
146
140
 
147
141
  it "should not assign the requested message as @message" do
148
142
  get :new
@@ -187,7 +181,7 @@ describe MessagesController do
187
181
 
188
182
  describe "GET edit" do
189
183
  describe "When logged in as Administrator" do
190
- login_admin
184
+ login_fixture_admin
191
185
 
192
186
  it "assigns the requested message as @message" do
193
187
  message = messages(:user1_to_user2_1)
@@ -200,7 +194,7 @@ describe MessagesController do
200
194
  end
201
195
 
202
196
  describe "When logged in as Librarian" do
203
- login_librarian
197
+ login_fixture_librarian
204
198
 
205
199
  it "assigns the requested message as @message" do
206
200
  message = messages(:user1_to_user2_1)
@@ -238,7 +232,7 @@ describe MessagesController do
238
232
  end
239
233
 
240
234
  describe "When logged in as Administrator" do
241
- login_admin
235
+ login_fixture_admin
242
236
 
243
237
  describe "with valid params" do
244
238
  it "assigns a newly created message as @message" do
@@ -11,20 +11,20 @@ class Notifier < ActionMailer::Base
11
11
 
12
12
  def message_notification(message_id)
13
13
  message = Message.find(message_id)
14
- I18n.locale = message.receiver.locale.try(:to_sym) || I18n.default_locale
15
- from = "#{LibraryGroup.system_name(message.receiver.locale)} <#{LibraryGroup.site_config.email}>"
14
+ I18n.locale = message.receiver.profile.locale.try(:to_sym) || I18n.default_locale
15
+ from = "#{LibraryGroup.system_name(message.receiver.profile.locale)} <#{LibraryGroup.site_config.email}>"
16
16
  if message.subject
17
17
  subject = message.subject
18
18
  else
19
- subject = I18n.t('message.new_message_from_library', :library => LibraryGroup.system_name(message.receiver.user.locale))
19
+ subject = I18n.t('message.new_message_from_library', :library => LibraryGroup.system_name(message.receiver.user.profile.locale))
20
20
  end
21
21
  if message.sender
22
- @sender_name = message.sender.full_name
22
+ @sender_name = message.sender.username
23
23
  else
24
- @sender_name = LibraryGroup.system_name(message.receiver.locale)
24
+ @sender_name = LibraryGroup.system_name(message.receiver.profile.locale)
25
25
  end
26
26
  @message = message
27
- @locale = message.receiver.locale
27
+ @locale = message.receiver.profile.locale
28
28
  mail(:from => from, :to => message.receiver.email, :subject => subject)
29
29
  end
30
30
  end
@@ -1,7 +1,6 @@
1
1
  class CreateAgents < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :agents do |t|
4
- t.integer :user_id
5
4
  t.string :last_name
6
5
  t.string :middle_name
7
6
  t.string :first_name
@@ -44,7 +43,6 @@ class CreateAgents < ActiveRecord::Migration
44
43
  t.text :email
45
44
  t.text :url
46
45
  end
47
- add_index :agents, :user_id, :unique => true
48
46
  add_index :agents, :language_id
49
47
  add_index :agents, :country_id
50
48
  add_index :agents, :required_role_id
@@ -0,0 +1,18 @@
1
+ class CreateUserImportFiles < ActiveRecord::Migration
2
+ def change
3
+ create_table :user_import_files do |t|
4
+ t.integer :user_id
5
+ t.text :note
6
+ t.datetime :executed_at
7
+ t.string :user_import_file_name
8
+ t.string :user_import_content_type
9
+ t.string :user_import_file_size
10
+ t.datetime :user_import_updated_at
11
+ t.string :user_import_fingerprint
12
+ t.string :edit_mode
13
+ t.text :error_message
14
+
15
+ t.timestamps
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,11 @@
1
+ class CreateUserImportResults < ActiveRecord::Migration
2
+ def change
3
+ create_table :user_import_results do |t|
4
+ t.integer :user_import_file_id
5
+ t.integer :user_id
6
+ t.text :body
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,20 @@
1
+ class CreateProfiles < ActiveRecord::Migration
2
+ def change
3
+ create_table :profiles do |t|
4
+ t.integer :user_id
5
+ t.integer :user_group_id
6
+ t.integer :library_id
7
+ t.string :locale
8
+ t.string :user_number
9
+ t.text :full_name
10
+ t.text :note
11
+ t.text :keyword_list
12
+ t.integer :required_role_id
13
+
14
+ t.timestamps
15
+ end
16
+
17
+ add_index :profiles, :user_id
18
+ add_index :profiles, :user_number, :unique => true
19
+ end
20
+ end
@@ -0,0 +1,14 @@
1
+ class CreateUserImportFileTransitions < ActiveRecord::Migration
2
+ def change
3
+ create_table :user_import_file_transitions do |t|
4
+ t.string :to_state
5
+ t.text :metadata, default: "{}"
6
+ t.integer :sort_key
7
+ t.integer :user_import_file_id
8
+ t.timestamps
9
+ end
10
+
11
+ add_index :user_import_file_transitions, :user_import_file_id
12
+ add_index :user_import_file_transitions, [:sort_key, :user_import_file_id], unique: true, name: "index_user_import_file_transitions_on_sort_key_and_file_id"
13
+ end
14
+ end
@@ -0,0 +1,11 @@
1
+ class DropEmailUniqueConstraintEnjuLeafRc10 < ActiveRecord::Migration
2
+ def up
3
+ remove_index :users, :email
4
+ add_index :users, :email
5
+ end
6
+
7
+ def down
8
+ remove_index :users, :email
9
+ add_index :users, :email, unique: true
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ class AddUserEncodingToUserImportFile < ActiveRecord::Migration
2
+ def change
3
+ add_column :user_import_files, :user_encoding, :string
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ class CreateUserExportFiles < ActiveRecord::Migration
2
+ def change
3
+ create_table :user_export_files do |t|
4
+ t.integer :user_id
5
+ t.attachment :user_export
6
+ t.datetime :executed_at
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ class CreateUserExportFileTransitions < ActiveRecord::Migration
2
+ def change
3
+ create_table :user_export_file_transitions do |t|
4
+ t.string :to_state
5
+ t.text :metadata, default: "{}"
6
+ t.integer :sort_key
7
+ t.integer :user_export_file_id
8
+ t.timestamps
9
+ end
10
+
11
+ add_index :user_export_file_transitions, :user_export_file_id, name: "index_user_export_file_transitions_on_file_id"
12
+ add_index :user_export_file_transitions, [:sort_key, :user_export_file_id], unique: true, name: "index_user_export_file_transitions_on_sort_key_and_file_id"
13
+ end
14
+ end
@@ -0,0 +1,5 @@
1
+ class AddDefaultLibraryIdToUserImportFile < ActiveRecord::Migration
2
+ def change
3
+ add_column :user_import_files, :default_library_id, :integer
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddDefaultUserGroupIdToUserImportFile < ActiveRecord::Migration
2
+ def change
3
+ add_column :user_import_files, :default_user_group_id, :integer
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ class AddExpiredAtToProfile < ActiveRecord::Migration
2
+ def change
3
+ add_column :profiles, :expired_at, :datetime
4
+ end
5
+ end
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended to check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20130412083556) do
14
+ ActiveRecord::Schema.define(:version => 20140811031145) do
15
15
 
16
16
  create_table "accepts", :force => true do |t|
17
17
  t.integer "basket_id"
@@ -34,7 +34,6 @@ ActiveRecord::Schema.define(:version => 20130412083556) do
34
34
  end
35
35
 
36
36
  create_table "agents", :force => true do |t|
37
- t.integer "user_id"
38
37
  t.string "last_name"
39
38
  t.string "middle_name"
40
39
  t.string "first_name"
@@ -85,7 +84,6 @@ ActiveRecord::Schema.define(:version => 20130412083556) do
85
84
  add_index "agents", ["full_name"], :name => "index_agents_on_full_name"
86
85
  add_index "agents", ["language_id"], :name => "index_agents_on_language_id"
87
86
  add_index "agents", ["required_role_id"], :name => "index_agents_on_required_role_id"
88
- add_index "agents", ["user_id"], :name => "index_agents_on_user_id", :unique => true
89
87
 
90
88
  create_table "baskets", :force => true do |t|
91
89
  t.integer "user_id"
@@ -212,6 +210,18 @@ ActiveRecord::Schema.define(:version => 20130412083556) do
212
210
 
213
211
  add_index "library_groups", ["short_name"], :name => "index_library_groups_on_short_name"
214
212
 
213
+ create_table "message_request_transitions", :force => true do |t|
214
+ t.string "to_state"
215
+ t.text "metadata", :default => "{}"
216
+ t.integer "sort_key"
217
+ t.integer "message_request_id"
218
+ t.datetime "created_at", :null => false
219
+ t.datetime "updated_at", :null => false
220
+ end
221
+
222
+ add_index "message_request_transitions", ["message_request_id"], :name => "index_message_request_transitions_on_message_request_id"
223
+ add_index "message_request_transitions", ["sort_key", "message_request_id"], :name => "index_message_request_transitions_on_sort_key_and_request_id", :unique => true
224
+
215
225
  create_table "message_requests", :force => true do |t|
216
226
  t.integer "sender_id"
217
227
  t.integer "receiver_id"
@@ -219,13 +229,10 @@ ActiveRecord::Schema.define(:version => 20130412083556) do
219
229
  t.datetime "sent_at"
220
230
  t.datetime "deleted_at"
221
231
  t.text "body"
222
- t.string "state"
223
232
  t.datetime "created_at", :null => false
224
233
  t.datetime "updated_at", :null => false
225
234
  end
226
235
 
227
- add_index "message_requests", ["state"], :name => "index_message_requests_on_state"
228
-
229
236
  create_table "message_templates", :force => true do |t|
230
237
  t.string "status", :null => false
231
238
  t.text "title", :null => false
@@ -238,6 +245,18 @@ ActiveRecord::Schema.define(:version => 20130412083556) do
238
245
 
239
246
  add_index "message_templates", ["status"], :name => "index_message_templates_on_status", :unique => true
240
247
 
248
+ create_table "message_transitions", :force => true do |t|
249
+ t.string "to_state"
250
+ t.text "metadata", :default => "{}"
251
+ t.integer "sort_key"
252
+ t.integer "message_id"
253
+ t.datetime "created_at", :null => false
254
+ t.datetime "updated_at", :null => false
255
+ end
256
+
257
+ add_index "message_transitions", ["message_id"], :name => "index_message_transitions_on_message_id"
258
+ add_index "message_transitions", ["sort_key", "message_id"], :name => "index_message_transitions_on_sort_key_and_message_id", :unique => true
259
+
241
260
  create_table "messages", :force => true do |t|
242
261
  t.datetime "read_at"
243
262
  t.integer "receiver_id"
@@ -245,7 +264,6 @@ ActiveRecord::Schema.define(:version => 20130412083556) do
245
264
  t.string "subject", :null => false
246
265
  t.text "body"
247
266
  t.integer "message_request_id"
248
- t.string "state"
249
267
  t.integer "parent_id"
250
268
  t.datetime "created_at", :null => false
251
269
  t.datetime "updated_at", :null => false
@@ -259,6 +277,24 @@ ActiveRecord::Schema.define(:version => 20130412083556) do
259
277
  add_index "messages", ["receiver_id"], :name => "index_messages_on_receiver_id"
260
278
  add_index "messages", ["sender_id"], :name => "index_messages_on_sender_id"
261
279
 
280
+ create_table "profiles", :force => true do |t|
281
+ t.integer "user_id"
282
+ t.integer "user_group_id"
283
+ t.integer "library_id"
284
+ t.string "locale"
285
+ t.string "user_number"
286
+ t.text "full_name"
287
+ t.text "note"
288
+ t.text "keyword_list"
289
+ t.integer "required_role_id"
290
+ t.datetime "created_at", :null => false
291
+ t.datetime "updated_at", :null => false
292
+ t.datetime "expired_at"
293
+ end
294
+
295
+ add_index "profiles", ["user_id"], :name => "index_profiles_on_user_id"
296
+ add_index "profiles", ["user_number"], :name => "index_profiles_on_user_number", :unique => true
297
+
262
298
  create_table "request_status_types", :force => true do |t|
263
299
  t.string "name", :null => false
264
300
  t.text "display_name"
@@ -341,6 +377,29 @@ ActiveRecord::Schema.define(:version => 20130412083556) do
341
377
  add_index "subscriptions", ["order_list_id"], :name => "index_subscriptions_on_order_list_id"
342
378
  add_index "subscriptions", ["user_id"], :name => "index_subscriptions_on_user_id"
343
379
 
380
+ create_table "user_export_file_transitions", :force => true do |t|
381
+ t.string "to_state"
382
+ t.text "metadata", :default => "{}"
383
+ t.integer "sort_key"
384
+ t.integer "user_export_file_id"
385
+ t.datetime "created_at", :null => false
386
+ t.datetime "updated_at", :null => false
387
+ end
388
+
389
+ add_index "user_export_file_transitions", ["sort_key", "user_export_file_id"], :name => "index_user_export_file_transitions_on_sort_key_and_file_id", :unique => true
390
+ add_index "user_export_file_transitions", ["user_export_file_id"], :name => "index_user_export_file_transitions_on_file_id"
391
+
392
+ create_table "user_export_files", :force => true do |t|
393
+ t.integer "user_id"
394
+ t.string "user_export_file_name"
395
+ t.string "user_export_content_type"
396
+ t.integer "user_export_file_size"
397
+ t.datetime "user_export_updated_at"
398
+ t.datetime "executed_at"
399
+ t.datetime "created_at", :null => false
400
+ t.datetime "updated_at", :null => false
401
+ end
402
+
344
403
  create_table "user_groups", :force => true do |t|
345
404
  t.string "name"
346
405
  t.text "display_name"
@@ -360,6 +419,44 @@ ActiveRecord::Schema.define(:version => 20130412083556) do
360
419
  t.datetime "updated_at", :null => false
361
420
  end
362
421
 
422
+ create_table "user_import_file_transitions", :force => true do |t|
423
+ t.string "to_state"
424
+ t.text "metadata", :default => "{}"
425
+ t.integer "sort_key"
426
+ t.integer "user_import_file_id"
427
+ t.datetime "created_at", :null => false
428
+ t.datetime "updated_at", :null => false
429
+ end
430
+
431
+ add_index "user_import_file_transitions", ["sort_key", "user_import_file_id"], :name => "index_user_import_file_transitions_on_sort_key_and_file_id", :unique => true
432
+ add_index "user_import_file_transitions", ["user_import_file_id"], :name => "index_user_import_file_transitions_on_user_import_file_id"
433
+
434
+ create_table "user_import_files", :force => true do |t|
435
+ t.integer "user_id"
436
+ t.text "note"
437
+ t.datetime "executed_at"
438
+ t.string "user_import_file_name"
439
+ t.string "user_import_content_type"
440
+ t.string "user_import_file_size"
441
+ t.datetime "user_import_updated_at"
442
+ t.string "user_import_fingerprint"
443
+ t.string "edit_mode"
444
+ t.text "error_message"
445
+ t.datetime "created_at", :null => false
446
+ t.datetime "updated_at", :null => false
447
+ t.string "user_encoding"
448
+ t.integer "default_library_id"
449
+ t.integer "default_user_group_id"
450
+ end
451
+
452
+ create_table "user_import_results", :force => true do |t|
453
+ t.integer "user_import_file_id"
454
+ t.integer "user_id"
455
+ t.text "body"
456
+ t.datetime "created_at", :null => false
457
+ t.datetime "updated_at", :null => false
458
+ end
459
+
363
460
  create_table "users", :force => true do |t|
364
461
  t.string "email", :default => "", :null => false
365
462
  t.string "encrypted_password", :default => "", :null => false
@@ -390,7 +487,7 @@ ActiveRecord::Schema.define(:version => 20130412083556) do
390
487
  t.datetime "confirmed_at"
391
488
  end
392
489
 
393
- add_index "users", ["email"], :name => "index_users_on_email", :unique => true
490
+ add_index "users", ["email"], :name => "index_users_on_email"
394
491
  add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
395
492
  add_index "users", ["unlock_token"], :name => "index_users_on_unlock_token", :unique => true
396
493
  add_index "users", ["user_group_id"], :name => "index_users_on_user_group_id"
Binary file