erp_communication_events 3.0.4 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. data/app/models/comm_evt_purpose.rb +1 -1
  2. data/app/models/comm_evt_purpose_type.rb +1 -0
  3. data/app/models/comm_evt_status.rb +1 -1
  4. data/app/models/communication_event.rb +1 -0
  5. data/db/migrate/20080805000080_communication_events_services.rb +0 -2
  6. data/lib/erp_communication_events.rb +2 -0
  7. data/lib/erp_communication_events/version.rb +2 -2
  8. data/spec/dummy/config/application.rb +2 -0
  9. data/spec/dummy/config/environments/spec.rb +3 -0
  10. data/spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb +15 -0
  11. data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +12 -0
  12. data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +19 -0
  13. data/spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +16 -0
  14. data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +12 -0
  15. data/spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb +22 -0
  16. data/spec/dummy/db/data_migrations/20120109173616_create_download_capability_type.erp_tech_svcs.rb +14 -0
  17. data/spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb +20 -0
  18. data/spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb +24 -0
  19. data/spec/dummy/db/migrate/20121213233556_base_erp_services.erp_base_erp_svcs.rb +461 -0
  20. data/spec/dummy/db/migrate/20121213233557_communication_events_services.erp_communication_events.rb +108 -0
  21. data/spec/dummy/db/migrate/20121213233558_base_tech_services.erp_tech_svcs.rb +255 -0
  22. data/spec/dummy/db/migrate/20121213233559_create_has_attribute_tables.erp_tech_svcs.rb +39 -0
  23. data/spec/dummy/db/migrate/20130107180829_create_groups.erp_tech_svcs.rb +19 -0
  24. data/spec/dummy/db/migrate/20130107180830_upgrade_security.erp_tech_svcs.rb +54 -0
  25. data/spec/dummy/db/migrate/20130107180831_upgrade_security2.erp_tech_svcs.rb +270 -0
  26. data/spec/dummy/db/schema.rb +666 -0
  27. data/spec/dummy/db/spec.sqlite3 +0 -0
  28. data/spec/dummy/log/spec.log +5407 -0
  29. data/spec/spec_helper.rb +11 -3
  30. metadata +63 -13
  31. data/db/migrate/upgrade/20120203142414_add_external_id_to_comm_events.rb +0 -13
  32. data/db/migrate/upgrade/20120203203450_add_from_to_mechanism_to_cmm_evt.rb +0 -33
  33. data/spec/models/comm_evt_status_type_spec.rb +0 -13
@@ -0,0 +1,108 @@
1
+ # This migration comes from erp_communication_events (originally 20080805000080)
2
+ class CommunicationEventsServices < ActiveRecord::Migration
3
+ def self.up
4
+
5
+ # Create communications_events
6
+ unless table_exists?(:communication_events)
7
+ create_table :communication_events do |t|
8
+ t.integer :from_contact_mechanism_id
9
+ t.string :from_contact_mechanism_type
10
+
11
+ t.integer :to_contact_mechanism_id
12
+ t.string :to_contact_mechanism_type
13
+
14
+ t.integer :role_type_id_from
15
+ t.integer :role_type_id_to
16
+
17
+ t.integer :party_id_from
18
+ t.integer :party_id_to
19
+
20
+ t.string :short_description
21
+ t.integer :status_type_id
22
+ t.integer :case_id
23
+ t.datetime :date_time_started
24
+ t.datetime :date_time_ended
25
+ t.string :notes
26
+ t.string :external_identifier
27
+ t.string :external_id_source
28
+
29
+ t.timestamps
30
+ end
31
+
32
+ add_index :communication_events, :status_type_id
33
+ add_index :communication_events, :case_id
34
+ add_index :communication_events, :role_type_id_from
35
+ add_index :communication_events, :role_type_id_to
36
+ add_index :communication_events, :party_id_from
37
+ add_index :communication_events, :party_id_to
38
+ add_index :communication_events, [:to_contact_mechanism_id, :to_contact_mechanism_type], :name => 'to_contact_mech_idx'
39
+ add_index :communication_events, [:from_contact_mechanism_id, :from_contact_mechanism_type], :name => 'from_contact_mech_idx'
40
+ end
41
+
42
+ # Create comm_evt_purpose_types
43
+ unless table_exists?(:comm_evt_purpose_types)
44
+ create_table :comm_evt_purpose_types do |t|
45
+ #awesome nested set columns
46
+ t.integer :parent_id
47
+ t.integer :lft
48
+ t.integer :rgt
49
+
50
+ #custom columns go here
51
+ t.string :description
52
+ t.string :comments
53
+ t.string :internal_identifier
54
+ t.string :external_identifier
55
+ t.string :external_id_source
56
+
57
+ t.timestamps
58
+ end
59
+
60
+ add_index :comm_evt_purpose_types, :parent_id
61
+ end
62
+
63
+ # Create comm_evt_purposes
64
+ unless table_exists?(:comm_evt_purposes)
65
+ create_table :comm_evt_purposes, :id => false do |t|
66
+ t.integer :communication_event_id
67
+ t.integer :comm_evt_purpose_type_id
68
+ end
69
+
70
+ add_index :comm_evt_purposes, :communication_event_id
71
+ add_index :comm_evt_purposes, :comm_evt_purpose_type_id
72
+ end
73
+
74
+ # Create comm_evt_statuses
75
+ unless table_exists?(:comm_evt_statuses)
76
+ create_table :comm_evt_statuses do |t|
77
+ #awesome nested set columns
78
+ t.integer :parent_id
79
+ t.integer :lft
80
+ t.integer :rgt
81
+
82
+ #custom columns go here
83
+ t.string :description
84
+ t.string :comments
85
+ t.string :internal_identifier
86
+ t.string :external_identifier
87
+ t.string :external_id_source
88
+
89
+ t.timestamps
90
+ end
91
+
92
+ add_index :comm_evt_statuses, :parent_id
93
+ end
94
+
95
+ end
96
+
97
+ def self.down
98
+ [
99
+ :comm_evt_statuses, :comm_evt_purposes,
100
+ :comm_evt_purpose_types, :communication_events
101
+ ].each do |tbl|
102
+ if table_exists?(tbl)
103
+ drop_table tbl
104
+ end
105
+ end
106
+ end
107
+
108
+ end
@@ -0,0 +1,255 @@
1
+ # This migration comes from erp_tech_svcs (originally 20080805000010)
2
+ class BaseTechServices < ActiveRecord::Migration
3
+ def self.up
4
+ unless table_exists?(:users)
5
+ # Create the users table
6
+ create_table :users do |t|
7
+ t.string :username
8
+ t.string :email
9
+ t.references :party
10
+ t.string :type
11
+ t.string :salt, :default => nil
12
+ t.string :crypted_password, :default => nil
13
+
14
+ #activity logging
15
+ t.datetime :last_login_at, :default => nil
16
+ t.datetime :last_logout_at, :default => nil
17
+ t.datetime :last_activity_at, :default => nil
18
+
19
+ #brute force protection
20
+ t.integer :failed_logins_count, :default => 0
21
+ t.datetime :lock_expires_at, :default => nil
22
+
23
+ #remember me
24
+ t.string :remember_me_token, :default => nil
25
+ t.datetime :remember_me_token_expires_at, :default => nil
26
+
27
+ #reset password
28
+ t.string :reset_password_token, :default => nil
29
+ t.datetime :reset_password_token_expires_at, :default => nil
30
+ t.datetime :reset_password_email_sent_at, :default => nil
31
+
32
+ #user activation
33
+ t.string :activation_state, :default => nil
34
+ t.string :activation_token, :default => nil
35
+ t.datetime :activation_token_expires_at, :default => nil
36
+
37
+ t.string :security_question_1
38
+ t.string :security_answer_1
39
+ t.string :security_question_2
40
+ t.string :security_answer_2
41
+
42
+ t.timestamps
43
+ end
44
+ add_index :users, :email, :unique => true
45
+ add_index :users, :username, :unique => true
46
+ add_index :users, [:last_logout_at, :last_activity_at], :name => 'activity_idx'
47
+ add_index :users, :remember_me_token
48
+ add_index :users, :reset_password_token
49
+ add_index :users, :activation_token
50
+
51
+ end
52
+
53
+ unless table_exists?(:roles)
54
+ # create the roles table
55
+ create_table :roles do |t|
56
+ t.column :description, :string
57
+ t.column :internal_identifier, :string
58
+ t.column :external_identifier, :string
59
+ t.column :external_id_source, :string
60
+
61
+ t.timestamps
62
+ end
63
+ end
64
+
65
+ unless table_exists?(:sessions)
66
+ # Create sessions table
67
+ create_table :sessions do |t|
68
+ t.string :session_id, :null => false
69
+ t.text :data
70
+ t.timestamps
71
+ end
72
+ add_index :sessions, :session_id
73
+ add_index :sessions, :updated_at
74
+ end
75
+
76
+ unless table_exists?(:audit_logs)
77
+ # Create audit_logs
78
+ create_table :audit_logs do |t|
79
+ t.string :application
80
+ t.string :description
81
+ t.integer :party_id
82
+ t.text :additional_info
83
+ t.references :audit_log_type
84
+
85
+ #polymorphic columns
86
+ t.references :event_record, :polymorphic => true
87
+
88
+ t.timestamps
89
+ end
90
+ add_index :audit_logs, :party_id
91
+ add_index :audit_logs, [:event_record_id, :event_record_type], :name => 'event_record_index'
92
+ end
93
+
94
+ unless table_exists?(:audit_log_types)
95
+ # Create audit_logs
96
+ create_table :audit_log_types do |t|
97
+ t.string :description
98
+ t.string :error_code
99
+ t.string :comments
100
+ t.string :internal_identifier
101
+ t.string :external_identifier
102
+ t.string :external_id_source
103
+
104
+ #better nested set columns
105
+ t.integer :parent_id
106
+ t.integer :lft
107
+ t.integer :rgt
108
+
109
+ t.timestamps
110
+ end
111
+ end
112
+
113
+ unless table_exists?(:audit_log_items)
114
+ # Create audit_log_items
115
+ create_table :audit_log_items do |t|
116
+ t.references :audit_log
117
+ t.references :audit_log_item_type
118
+ t.string :audit_log_item_value
119
+ t.string :description
120
+
121
+ t.timestamps
122
+ end
123
+ end
124
+
125
+ unless table_exists?(:audit_log_item_types)
126
+ # Create audit_log_item_types
127
+ create_table :audit_log_item_types do |t|
128
+ t.string :internal_identifier
129
+ t.string :external_identifier
130
+ t.string :external_id_source
131
+ t.string :description
132
+ t.string :comments
133
+
134
+ #better nested set columns
135
+ t.integer :parent_id
136
+ t.integer :lft
137
+ t.integer :rgt
138
+
139
+ t.timestamps
140
+ end
141
+ end
142
+
143
+ unless table_exists?(:secured_models)
144
+ create_table :secured_models do |t|
145
+ t.references :secured_record, :polymorphic => true
146
+
147
+ t.timestamps
148
+ end
149
+ add_index :secured_models, [:secured_record_id, :secured_record_type], :name => 'secured_record_idx'
150
+ end
151
+
152
+ unless table_exists?(:roles_secured_models)
153
+ create_table :roles_secured_models, :id => false do |t|
154
+ t.references :secured_model
155
+ t.references :role
156
+ end
157
+ add_index :roles_secured_models, :secured_model_id
158
+ add_index :roles_secured_models, :role_id
159
+ end
160
+
161
+ unless table_exists?(:file_assets)
162
+ create_table :file_assets do |t|
163
+ t.references :file_asset_holder, :polymorphic => true
164
+ t.string :type
165
+ t.string :name
166
+ t.string :directory
167
+ t.string :data_file_name
168
+ t.string :data_content_type
169
+ t.integer :data_file_size
170
+ t.datetime :data_updated_at
171
+ t.string :width
172
+ t.string :height
173
+
174
+ t.timestamps
175
+ end
176
+ add_index :file_assets, :type
177
+ add_index :file_assets, [:file_asset_holder_id, :file_asset_holder_type], :name => 'file_asset_holder_idx'
178
+ add_index :file_assets, :name
179
+ add_index :file_assets, :directory
180
+ end
181
+
182
+ unless table_exists?(:delayed_jobs)
183
+ create_table :delayed_jobs, :force => true do |table|
184
+ table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue
185
+ table.integer :attempts, :default => 0 # Provides for retries, but still fail eventually.
186
+ table.text :handler # YAML-encoded string of the object that will do work
187
+ table.text :last_error # reason for last failure (See Note below)
188
+ table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
189
+ table.datetime :locked_at # Set when a client is working on this object
190
+ table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
191
+ table.string :locked_by # Who is working on this object (if locked)
192
+ table.string :queue
193
+ table.timestamps
194
+ end
195
+ add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'
196
+ end
197
+
198
+ unless table_exists?(:capable_models)
199
+ # create the roles table
200
+ create_table :capable_models do |t|
201
+ t.references :capable_model_record, :polymorphic => true
202
+
203
+ t.timestamps
204
+ end
205
+
206
+ add_index :capable_models, [:capable_model_record_id, :capable_model_record_type], :name => 'capable_model_record_idx'
207
+ end
208
+
209
+ unless table_exists?(:capability_types)
210
+ # create the roles table
211
+ create_table :capability_types do |t|
212
+ t.string :internal_identifier
213
+ t.string :description
214
+ t.timestamps
215
+ end
216
+ end
217
+
218
+ unless table_exists?(:capabilities)
219
+ # create the roles table
220
+ create_table :capabilities do |t|
221
+ t.string :resource
222
+ t.references :capability_type
223
+ t.timestamps
224
+ end
225
+
226
+ add_index :capabilities, :capability_type_id
227
+ end
228
+
229
+ unless table_exists?(:capabilities_capable_models)
230
+ # create the roles table
231
+ create_table :capabilities_capable_models, :id => false do |t|
232
+ t.references :capable_model
233
+ t.references :capability
234
+ end
235
+
236
+ add_index :capabilities_capable_models, :capable_model_id
237
+ add_index :capabilities_capable_models, :capability_id
238
+ end
239
+
240
+ end
241
+
242
+ def self.down
243
+ # check that each table exists before trying to delete it.
244
+ [
245
+ :audit_logs, :sessions, :simple_captcha_data,
246
+ :capable_models, :capability_types, :capabilities,:capabilities_capable_models,
247
+ :roles_users, :roles, :audit_log_items, :audit_log_item_types,
248
+ :users, :secured_models, :roles_secured_models, :file_assets, :delayed_jobs
249
+ ].each do |tbl|
250
+ if table_exists?(tbl)
251
+ drop_table tbl
252
+ end
253
+ end
254
+ end
255
+ end
@@ -0,0 +1,39 @@
1
+ # This migration comes from erp_tech_svcs (originally 20111117183144)
2
+ class CreateHasAttributeTables < ActiveRecord::Migration
3
+ def up
4
+ unless table_exists?(:attribute_types)
5
+ create_table :attribute_types do |t|
6
+ t.string :internal_identifier
7
+ t.string :description
8
+ t.string :data_type
9
+
10
+ t.timestamps
11
+ end
12
+
13
+ add_index :attribute_types, :internal_identifier, :name => ':attribute_types_iid_idx'
14
+ end
15
+ unless table_exists?(:attribute_values)
16
+ create_table :attribute_values do |t|
17
+ t.integer :attributed_record_id
18
+ t.string :attributed_record_type
19
+ t.references :attribute_type
20
+ t.string :value
21
+
22
+ t.timestamps
23
+ end
24
+
25
+ add_index :attribute_values, [:attributed_record_id, :attributed_record_type], :name => 'attribute_values_attributed_record_idx'
26
+ add_index :attribute_values, :attribute_type_id, :name => 'attribute_values_attributed_type_idx'
27
+ add_index :attribute_values, :value, :name => 'attribute_values_value_idx'
28
+ end
29
+ end
30
+
31
+ def down
32
+ if table_exists?(:attribute_types)
33
+ drop_table :attribute_types
34
+ end
35
+ if table_exists?(:attribute_values)
36
+ drop_table :attribute_values
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,19 @@
1
+ # This migration comes from erp_tech_svcs (originally 20121116151510)
2
+ class CreateGroups < ActiveRecord::Migration
3
+ def self.up
4
+ unless table_exists?(:groups)
5
+ create_table :groups do |t|
6
+ t.column :description, :string
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
11
+
12
+ def self.down
13
+ [ :groups ].each do |tbl|
14
+ if table_exists?(tbl)
15
+ drop_table tbl
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,54 @@
1
+ # This migration comes from erp_tech_svcs (originally 20121126171612)
2
+ class UpgradeSecurity < ActiveRecord::Migration
3
+
4
+ def self.up
5
+ unless table_exists?(:capability_accessors)
6
+ create_table :capability_accessors do |t|
7
+ t.string :capability_accessor_record_type
8
+ t.integer :capability_accessor_record_id
9
+ t.integer :capability_id
10
+ t.timestamps
11
+ end
12
+
13
+ add_index :capability_accessors, :capability_id
14
+ add_index :capability_accessors, [:capability_accessor_record_id, :capability_accessor_record_type], :name => 'capability_accessor_record_index'
15
+ end
16
+
17
+ unless columns(:capabilities).collect {|c| c.name}.include?('scope_query')
18
+ add_column :capabilities, :description, :string
19
+ add_column :capabilities, :capability_resource_type, :string
20
+ add_column :capabilities, :capability_resource_id, :integer
21
+ add_column :capabilities, :scope_type_id, :integer
22
+ add_column :capabilities, :scope_query, :text
23
+
24
+ add_index :capabilities, :scope_type_id
25
+ add_index :capabilities, [:capability_resource_id, :capability_resource_type], :name => 'capability_resource_index'
26
+ end
27
+
28
+ unless table_exists?(:scope_types)
29
+ create_table :scope_types do |t|
30
+ t.string :description
31
+ t.string :internal_identifier
32
+ t.timestamps
33
+ end
34
+
35
+ add_index :scope_types, :internal_identifier
36
+ end
37
+
38
+ unless table_exists?(:parties_security_roles)
39
+ create_table :parties_security_roles, :id => false do |t|
40
+ t.integer :party_id
41
+ t.integer :security_role_id
42
+ end
43
+
44
+ add_index :parties_security_roles, :party_id
45
+ add_index :parties_security_roles, :security_role_id
46
+ end
47
+
48
+ rename_table :roles, :security_roles unless table_exists?(:security_roles)
49
+
50
+ end
51
+
52
+ def self.down
53
+ end
54
+ end