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,270 @@
1
+ # This migration comes from erp_tech_svcs (originally 20121126173506)
2
+ class UpgradeSecurity2 < ActiveRecord::Migration
3
+ def self.up
4
+ if table_exists?(:secured_models)
5
+ Website.all.each do |w|
6
+ old_role_iid = "website_#{w.name.underscore.gsub("'","").gsub(",","")}_access"
7
+
8
+ r = SecurityRole.find_by_internal_identifier(old_role_iid)
9
+ unless r.nil?
10
+ r.internal_identifier = w.website_role_iid
11
+ r.save
12
+ end
13
+ end
14
+ instance = ScopeType.create(:description => 'Instance', :internal_identifier => 'instance')
15
+ class_scope_type = ScopeType.create(:description => 'Class', :internal_identifier => 'class')
16
+ ScopeType.create(:description => 'Query', :internal_identifier => 'query')
17
+
18
+ execute('BEGIN TRANSACTION')
19
+ puts "populating parties_security_roles"
20
+ sql =
21
+ "INSERT INTO parties_security_roles (
22
+ party_id,
23
+ security_role_id
24
+ )
25
+ SELECT
26
+ u.party_id AS party_id,
27
+ rsm.role_id AS security_role_id
28
+ FROM secured_models sm
29
+ JOIN roles_secured_models rsm ON sm.id=rsm.secured_model_id
30
+ JOIN users u ON sm.secured_record_id=u.id
31
+ WHERE sm.secured_record_type='User'"
32
+
33
+ execute(sql)
34
+ execute('COMMIT')
35
+
36
+ execute('BEGIN TRANSACTION')
37
+ puts "populating capabilities with secure File Assets"
38
+ sql =
39
+ "INSERT INTO capabilities (
40
+ capability_type_id,
41
+ capability_resource_type,
42
+ capability_resource_id,
43
+ scope_type_id
44
+ )
45
+ SELECT
46
+ c.capability_type_id AS capability_type_id,
47
+ 'FileAsset' AS capability_resource_type,
48
+ cm.capable_model_record_id AS capability_resource_id,
49
+ #{instance.id} AS scope_type_id
50
+ FROM capable_models AS cm
51
+ JOIN capabilities_capable_models AS ccm ON ccm.capable_model_id = cm.id
52
+ JOIN capabilities AS c ON ccm.capability_id = c.id
53
+ JOIN secured_models AS sm ON sm.secured_record_id = c.id AND sm.secured_record_type = 'Capability'
54
+ JOIN roles_secured_models AS rsm ON rsm.secured_model_id = sm.id
55
+ JOIN security_roles AS r ON r.id = rsm.role_id
56
+ WHERE cm.capable_model_record_type = 'FileAsset'"
57
+
58
+ execute(sql)
59
+ execute('COMMIT')
60
+
61
+ view = CapabilityType.find_by_internal_identifier('view')
62
+
63
+ execute('BEGIN TRANSACTION')
64
+ puts "populating capabilities with secure Website Sections"
65
+ sql =
66
+ "INSERT INTO capabilities (
67
+ capability_type_id,
68
+ capability_resource_type,
69
+ capability_resource_id,
70
+ scope_type_id
71
+ )
72
+ SELECT
73
+ #{view.id} AS capability_type_id,
74
+ 'WebsiteSection' AS capability_resource_type,
75
+ ws.id AS capability_resource_id,
76
+ #{instance.id} AS scope_type_id
77
+ FROM secured_models sm
78
+ JOIN roles_secured_models rsm ON sm.id=rsm.secured_model_id
79
+ JOIN website_sections ws ON sm.secured_record_id=ws.id
80
+ WHERE sm.secured_record_type='WebsiteSection'"
81
+
82
+ execute(sql)
83
+ execute('COMMIT')
84
+
85
+ execute('BEGIN TRANSACTION')
86
+ puts "populating capabilities with secure Website Nav Items"
87
+ sql =
88
+ "INSERT INTO capabilities (
89
+ capability_type_id,
90
+ capability_resource_type,
91
+ capability_resource_id,
92
+ scope_type_id
93
+ )
94
+ SELECT
95
+ #{view.id} AS capability_type_id,
96
+ 'WebsiteNavItem' AS capability_resource_type,
97
+ ws.id AS capability_resource_id,
98
+ #{instance.id} AS scope_type_id
99
+ FROM secured_models sm
100
+ JOIN roles_secured_models rsm ON sm.id=rsm.secured_model_id
101
+ JOIN website_sections ws ON sm.secured_record_id=ws.id
102
+ WHERE sm.secured_record_type='WebsiteNavItem'"
103
+
104
+ execute(sql)
105
+ execute('COMMIT')
106
+
107
+ # delete obsolete records: Application, Widget, dupes?
108
+ Capability.where("capability_resource_type IS NULL").delete_all
109
+
110
+ admin = SecurityRole.find_by_internal_identifier('admin')
111
+ website_author = SecurityRole.find_by_internal_identifier('website_author')
112
+ layout_author = SecurityRole.find_by_internal_identifier('layout_author')
113
+ content_author = SecurityRole.find_by_internal_identifier('content_author')
114
+ designer = SecurityRole.find_by_internal_identifier('designer')
115
+ publisher = SecurityRole.find_by_internal_identifier('publisher')
116
+
117
+ # add instance capabilities to roles
118
+ instance_capabilities = Capability.where(:scope_type_id => instance.id).all
119
+ instance_capabilities.each do |c|
120
+ case c.capability_resource_type
121
+ when 'FileAsset'
122
+ admin.add_capability(c)
123
+ website_author.add_capability(c)
124
+ content_author.add_capability(c)
125
+ if c.capability_resource.file_asset_holder_type == 'Website'
126
+ website_role = c.capability_resource.file_asset_holder.role
127
+ website_role.add_capability(c)
128
+ end
129
+ when 'WebsiteSection'
130
+ admin.add_capability(c)
131
+ website_author.add_capability(c)
132
+ website_role = c.capability_resource.website.role
133
+ website_role.add_capability(c)
134
+ when 'WebsiteNavItem'
135
+ admin.add_capability(c)
136
+ website_author.add_capability(c)
137
+ website_role = c.capability_resource.website_nav.website.role
138
+ website_role.add_capability(c)
139
+ end
140
+ end
141
+
142
+ # add knitkit class capabilities to roles
143
+ admin.add_capability('create', 'WebsiteNav')
144
+ admin.add_capability('delete', 'WebsiteNav')
145
+ admin.add_capability('edit', 'WebsiteNav')
146
+
147
+ website_author.add_capability('create', 'WebsiteNav')
148
+ website_author.add_capability('delete', 'WebsiteNav')
149
+ website_author.add_capability('edit', 'WebsiteNav')
150
+
151
+ admin.add_capability('create', 'Website')
152
+ admin.add_capability('delete', 'Website')
153
+ admin.add_capability('edit', 'Website')
154
+ admin.add_capability('import', 'Website')
155
+ admin.add_capability('publish', 'Website')
156
+ admin.add_capability('activate', 'Website')
157
+
158
+ website_author.add_capability('create', 'Website')
159
+ website_author.add_capability('delete', 'Website')
160
+ website_author.add_capability('edit', 'Website')
161
+ website_author.add_capability('import', 'Website')
162
+ publisher.add_capability('publish', 'Website')
163
+ publisher.add_capability('activate', 'Website')
164
+
165
+ admin.add_capability('create', 'WebsiteHost')
166
+ admin.add_capability('delete', 'WebsiteHost')
167
+ admin.add_capability('edit', 'WebsiteHost')
168
+
169
+ website_author.add_capability('create', 'WebsiteHost')
170
+ website_author.add_capability('delete', 'WebsiteHost')
171
+ website_author.add_capability('edit', 'WebsiteHost')
172
+
173
+ admin.add_capability('create', 'WebsiteSection')
174
+ admin.add_capability('delete', 'WebsiteSection')
175
+ admin.add_capability('edit', 'WebsiteSection')
176
+ admin.add_capability('secure', 'WebsiteSection')
177
+ admin.add_capability('unsecure', 'WebsiteSection')
178
+
179
+ website_author.add_capability('create', 'WebsiteSection')
180
+ website_author.add_capability('delete', 'WebsiteSection')
181
+ website_author.add_capability('edit', 'WebsiteSection')
182
+ website_author.add_capability('secure', 'WebsiteSection')
183
+ website_author.add_capability('unsecure', 'WebsiteSection')
184
+
185
+ admin.add_capability('create', 'WebsiteSectionLayout')
186
+ admin.add_capability('edit', 'WebsiteSectionLayout')
187
+
188
+ layout_author.add_capability('create', 'WebsiteSectionLayout')
189
+ layout_author.add_capability('edit', 'WebsiteSectionLayout')
190
+
191
+ admin.add_capability('create', 'Content')
192
+ admin.add_capability('delete', 'Content')
193
+ admin.add_capability('edit', 'Content')
194
+ admin.add_capability('publish', 'Content')
195
+ admin.add_capability('revert_version', 'Content')
196
+ admin.add_capability('add_existing', 'Content')
197
+ admin.add_capability('edit_html', 'Content')
198
+ admin.add_capability('edit_excerpt', 'Content')
199
+
200
+ content_author.add_capability('create', 'Content')
201
+ content_author.add_capability('delete', 'Content')
202
+ content_author.add_capability('edit', 'Content')
203
+ content_author.add_capability('publish', 'Content')
204
+ content_author.add_capability('revert_version', 'Content')
205
+ content_author.add_capability('add_existing', 'Content')
206
+ content_author.add_capability('edit_html', 'Content')
207
+ content_author.add_capability('edit_excerpt', 'Content')
208
+
209
+ admin.add_capability('create', 'WebsiteNavItem')
210
+ admin.add_capability('delete', 'WebsiteNavItem')
211
+ admin.add_capability('edit', 'WebsiteNavItem')
212
+ admin.add_capability('secure', 'WebsiteNavItem')
213
+ admin.add_capability('unsecure', 'WebsiteNavItem')
214
+
215
+ website_author.add_capability('create', 'WebsiteNavItem')
216
+ website_author.add_capability('delete', 'WebsiteNavItem')
217
+ website_author.add_capability('edit', 'WebsiteNavItem')
218
+ website_author.add_capability('secure', 'WebsiteNavItem')
219
+ website_author.add_capability('unsecure', 'WebsiteNavItem')
220
+
221
+ admin.add_capability('view', 'Theme')
222
+ designer.add_capability('view', 'Theme')
223
+
224
+ admin.add_capability('view', 'SiteImageAsset')
225
+ website_author.add_capability('view', 'SiteImageAsset')
226
+ content_author.add_capability('view', 'SiteImageAsset')
227
+
228
+ content_author.add_capability('view', 'GlobalImageAsset')
229
+
230
+ admin.add_capability('view', 'GlobalImageAsset')
231
+ admin.add_capability('upload', 'GlobalImageAsset')
232
+ admin.add_capability('delete', 'GlobalImageAsset')
233
+
234
+ website_author.add_capability('view', 'GlobalImageAsset')
235
+ website_author.add_capability('upload', 'GlobalImageAsset')
236
+ website_author.add_capability('delete', 'GlobalImageAsset')
237
+
238
+ admin.add_capability('view', 'SiteFileAsset')
239
+ website_author.add_capability('view', 'SiteFileAsset')
240
+ content_author.add_capability('view', 'SiteFileAsset')
241
+
242
+ content_author.add_capability('view', 'GlobalFileAsset')
243
+
244
+ admin.add_capability('view', 'GlobalFileAsset')
245
+ admin.add_capability('upload', 'GlobalFileAsset')
246
+ admin.add_capability('delete', 'GlobalFileAsset')
247
+
248
+ website_author.add_capability('view', 'GlobalFileAsset')
249
+ website_author.add_capability('upload', 'GlobalFileAsset')
250
+ website_author.add_capability('delete', 'GlobalFileAsset')
251
+
252
+ admin.add_capability('drag_item', 'WebsiteTree')
253
+ website_author.add_capability('drag_item', 'WebsiteTree')
254
+
255
+ # update capability descriptions
256
+ Capability.all.each do |c|
257
+ c.update_description
258
+ end
259
+
260
+ drop_table :capable_models
261
+ drop_table :capabilities_capable_models
262
+ drop_table :secured_models
263
+ drop_table :roles_secured_models
264
+ remove_column :capabilities, :resource
265
+ end
266
+ end
267
+
268
+ def self.down
269
+ end
270
+ end
@@ -0,0 +1,666 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20121213233559) do
15
+
16
+ create_table "attribute_types", :force => true do |t|
17
+ t.string "internal_identifier"
18
+ t.string "description"
19
+ t.string "data_type"
20
+ t.datetime "created_at", :null => false
21
+ t.datetime "updated_at", :null => false
22
+ end
23
+
24
+ add_index "attribute_types", ["internal_identifier"], :name => ":attribute_types_iid_idx"
25
+
26
+ create_table "attribute_values", :force => true do |t|
27
+ t.integer "attributed_record_id"
28
+ t.string "attributed_record_type"
29
+ t.integer "attribute_type_id"
30
+ t.string "value"
31
+ t.datetime "created_at", :null => false
32
+ t.datetime "updated_at", :null => false
33
+ end
34
+
35
+ add_index "attribute_values", ["attribute_type_id"], :name => "attribute_values_attributed_type_idx"
36
+ add_index "attribute_values", ["attributed_record_id", "attributed_record_type"], :name => "attribute_values_attributed_record_idx"
37
+ add_index "attribute_values", ["value"], :name => "attribute_values_value_idx"
38
+
39
+ create_table "audit_log_item_types", :force => true do |t|
40
+ t.string "internal_identifier"
41
+ t.string "external_identifier"
42
+ t.string "external_id_source"
43
+ t.string "description"
44
+ t.string "comments"
45
+ t.integer "parent_id"
46
+ t.integer "lft"
47
+ t.integer "rgt"
48
+ t.datetime "created_at", :null => false
49
+ t.datetime "updated_at", :null => false
50
+ end
51
+
52
+ create_table "audit_log_items", :force => true do |t|
53
+ t.integer "audit_log_id"
54
+ t.integer "audit_log_item_type_id"
55
+ t.string "audit_log_item_value"
56
+ t.string "description"
57
+ t.datetime "created_at", :null => false
58
+ t.datetime "updated_at", :null => false
59
+ end
60
+
61
+ create_table "audit_log_types", :force => true do |t|
62
+ t.string "description"
63
+ t.string "error_code"
64
+ t.string "comments"
65
+ t.string "internal_identifier"
66
+ t.string "external_identifier"
67
+ t.string "external_id_source"
68
+ t.integer "parent_id"
69
+ t.integer "lft"
70
+ t.integer "rgt"
71
+ t.datetime "created_at", :null => false
72
+ t.datetime "updated_at", :null => false
73
+ end
74
+
75
+ create_table "audit_logs", :force => true do |t|
76
+ t.string "application"
77
+ t.string "description"
78
+ t.integer "party_id"
79
+ t.text "additional_info"
80
+ t.integer "audit_log_type_id"
81
+ t.integer "event_record_id"
82
+ t.string "event_record_type"
83
+ t.datetime "created_at", :null => false
84
+ t.datetime "updated_at", :null => false
85
+ end
86
+
87
+ add_index "audit_logs", ["event_record_id", "event_record_type"], :name => "event_record_index"
88
+ add_index "audit_logs", ["party_id"], :name => "index_audit_logs_on_party_id"
89
+
90
+ create_table "capabilities", :force => true do |t|
91
+ t.string "resource"
92
+ t.integer "capability_type_id"
93
+ t.datetime "created_at", :null => false
94
+ t.datetime "updated_at", :null => false
95
+ end
96
+
97
+ add_index "capabilities", ["capability_type_id"], :name => "index_capabilities_on_capability_type_id"
98
+
99
+ create_table "capabilities_capable_models", :id => false, :force => true do |t|
100
+ t.integer "capable_model_id"
101
+ t.integer "capability_id"
102
+ end
103
+
104
+ add_index "capabilities_capable_models", ["capability_id"], :name => "index_capabilities_capable_models_on_capability_id"
105
+ add_index "capabilities_capable_models", ["capable_model_id"], :name => "index_capabilities_capable_models_on_capable_model_id"
106
+
107
+ create_table "capability_types", :force => true do |t|
108
+ t.string "internal_identifier"
109
+ t.string "description"
110
+ t.datetime "created_at", :null => false
111
+ t.datetime "updated_at", :null => false
112
+ end
113
+
114
+ create_table "capable_models", :force => true do |t|
115
+ t.integer "capable_model_record_id"
116
+ t.string "capable_model_record_type"
117
+ t.datetime "created_at", :null => false
118
+ t.datetime "updated_at", :null => false
119
+ end
120
+
121
+ add_index "capable_models", ["capable_model_record_id", "capable_model_record_type"], :name => "capable_model_record_idx"
122
+
123
+ create_table "categories", :force => true do |t|
124
+ t.string "description"
125
+ t.string "external_identifier"
126
+ t.datetime "from_date"
127
+ t.datetime "to_date"
128
+ t.string "internal_identifier"
129
+ t.integer "category_record_id"
130
+ t.string "category_record_type"
131
+ t.integer "parent_id"
132
+ t.integer "lft"
133
+ t.integer "rgt"
134
+ t.datetime "created_at", :null => false
135
+ t.datetime "updated_at", :null => false
136
+ end
137
+
138
+ add_index "categories", ["category_record_id", "category_record_type"], :name => "category_polymorphic"
139
+
140
+ create_table "category_classifications", :force => true do |t|
141
+ t.integer "category_id"
142
+ t.string "classification_type"
143
+ t.integer "classification_id"
144
+ t.datetime "from_date"
145
+ t.datetime "to_date"
146
+ t.datetime "created_at", :null => false
147
+ t.datetime "updated_at", :null => false
148
+ end
149
+
150
+ add_index "category_classifications", ["classification_id", "classification_type"], :name => "classification_polymorphic"
151
+
152
+ create_table "comm_evt_purpose_types", :force => true do |t|
153
+ t.integer "parent_id"
154
+ t.integer "lft"
155
+ t.integer "rgt"
156
+ t.string "description"
157
+ t.string "comments"
158
+ t.string "internal_identifier"
159
+ t.string "external_identifier"
160
+ t.string "external_id_source"
161
+ t.datetime "created_at", :null => false
162
+ t.datetime "updated_at", :null => false
163
+ end
164
+
165
+ add_index "comm_evt_purpose_types", ["parent_id"], :name => "index_comm_evt_purpose_types_on_parent_id"
166
+
167
+ create_table "comm_evt_purposes", :id => false, :force => true do |t|
168
+ t.integer "communication_event_id"
169
+ t.integer "comm_evt_purpose_type_id"
170
+ end
171
+
172
+ add_index "comm_evt_purposes", ["comm_evt_purpose_type_id"], :name => "index_comm_evt_purposes_on_comm_evt_purpose_type_id"
173
+ add_index "comm_evt_purposes", ["communication_event_id"], :name => "index_comm_evt_purposes_on_communication_event_id"
174
+
175
+ create_table "comm_evt_statuses", :force => true do |t|
176
+ t.integer "parent_id"
177
+ t.integer "lft"
178
+ t.integer "rgt"
179
+ t.string "description"
180
+ t.string "comments"
181
+ t.string "internal_identifier"
182
+ t.string "external_identifier"
183
+ t.string "external_id_source"
184
+ t.datetime "created_at", :null => false
185
+ t.datetime "updated_at", :null => false
186
+ end
187
+
188
+ add_index "comm_evt_statuses", ["parent_id"], :name => "index_comm_evt_statuses_on_parent_id"
189
+
190
+ create_table "communication_events", :force => true do |t|
191
+ t.integer "from_contact_mechanism_id"
192
+ t.string "from_contact_mechanism_type"
193
+ t.integer "to_contact_mechanism_id"
194
+ t.string "to_contact_mechanism_type"
195
+ t.integer "role_type_id_from"
196
+ t.integer "role_type_id_to"
197
+ t.integer "party_id_from"
198
+ t.integer "party_id_to"
199
+ t.string "short_description"
200
+ t.integer "status_type_id"
201
+ t.integer "case_id"
202
+ t.datetime "date_time_started"
203
+ t.datetime "date_time_ended"
204
+ t.string "notes"
205
+ t.string "external_identifier"
206
+ t.string "external_id_source"
207
+ t.datetime "created_at", :null => false
208
+ t.datetime "updated_at", :null => false
209
+ end
210
+
211
+ add_index "communication_events", ["case_id"], :name => "index_communication_events_on_case_id"
212
+ add_index "communication_events", ["from_contact_mechanism_id", "from_contact_mechanism_type"], :name => "from_contact_mech_idx"
213
+ add_index "communication_events", ["party_id_from"], :name => "index_communication_events_on_party_id_from"
214
+ add_index "communication_events", ["party_id_to"], :name => "index_communication_events_on_party_id_to"
215
+ add_index "communication_events", ["role_type_id_from"], :name => "index_communication_events_on_role_type_id_from"
216
+ add_index "communication_events", ["role_type_id_to"], :name => "index_communication_events_on_role_type_id_to"
217
+ add_index "communication_events", ["status_type_id"], :name => "index_communication_events_on_status_type_id"
218
+ add_index "communication_events", ["to_contact_mechanism_id", "to_contact_mechanism_type"], :name => "to_contact_mech_idx"
219
+
220
+ create_table "compass_ae_instances", :force => true do |t|
221
+ t.decimal "version", :precision => 3, :scale => 8
222
+ t.datetime "created_at", :null => false
223
+ t.datetime "updated_at", :null => false
224
+ end
225
+
226
+ create_table "contact_purposes", :force => true do |t|
227
+ t.integer "parent_id"
228
+ t.integer "lft"
229
+ t.integer "rgt"
230
+ t.string "description"
231
+ t.string "comments"
232
+ t.string "internal_identifier"
233
+ t.string "external_identifier"
234
+ t.string "external_id_source"
235
+ t.datetime "created_at", :null => false
236
+ t.datetime "updated_at", :null => false
237
+ end
238
+
239
+ add_index "contact_purposes", ["parent_id"], :name => "index_contact_purposes_on_parent_id"
240
+
241
+ create_table "contact_purposes_contacts", :id => false, :force => true do |t|
242
+ t.integer "contact_id"
243
+ t.integer "contact_purpose_id"
244
+ end
245
+
246
+ add_index "contact_purposes_contacts", ["contact_id", "contact_purpose_id"], :name => "contact_purposes_contacts_index"
247
+
248
+ create_table "contact_types", :force => true do |t|
249
+ t.integer "parent_id"
250
+ t.integer "lft"
251
+ t.integer "rgt"
252
+ t.string "description"
253
+ t.string "comments"
254
+ t.string "internal_identifier"
255
+ t.string "external_identifier"
256
+ t.string "external_id_source"
257
+ t.datetime "created_at", :null => false
258
+ t.datetime "updated_at", :null => false
259
+ end
260
+
261
+ add_index "contact_types", ["parent_id"], :name => "index_contact_types_on_parent_id"
262
+
263
+ create_table "contacts", :force => true do |t|
264
+ t.integer "party_id"
265
+ t.integer "contact_mechanism_id"
266
+ t.string "contact_mechanism_type"
267
+ t.string "external_identifier"
268
+ t.string "external_id_source"
269
+ t.datetime "created_at", :null => false
270
+ t.datetime "updated_at", :null => false
271
+ end
272
+
273
+ add_index "contacts", ["contact_mechanism_id", "contact_mechanism_type"], :name => "besi_2"
274
+ add_index "contacts", ["party_id"], :name => "index_contacts_on_party_id"
275
+
276
+ create_table "currencies", :force => true do |t|
277
+ t.string "name"
278
+ t.string "definition"
279
+ t.string "internal_identifier"
280
+ t.string "numeric_code"
281
+ t.string "major_unit_symbol"
282
+ t.string "minor_unit_symbol"
283
+ t.string "ratio_of_minor_unit_to_major_unit"
284
+ t.string "postfix_label"
285
+ t.datetime "introduction_date"
286
+ t.datetime "expiration_date"
287
+ t.datetime "created_at", :null => false
288
+ t.datetime "updated_at", :null => false
289
+ end
290
+
291
+ add_index "currencies", ["internal_identifier"], :name => "index_currencies_on_internal_identifier"
292
+
293
+ create_table "delayed_jobs", :force => true do |t|
294
+ t.integer "priority", :default => 0
295
+ t.integer "attempts", :default => 0
296
+ t.text "handler"
297
+ t.text "last_error"
298
+ t.datetime "run_at"
299
+ t.datetime "locked_at"
300
+ t.datetime "failed_at"
301
+ t.string "locked_by"
302
+ t.string "queue"
303
+ t.datetime "created_at", :null => false
304
+ t.datetime "updated_at", :null => false
305
+ end
306
+
307
+ add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
308
+
309
+ create_table "descriptive_assets", :force => true do |t|
310
+ t.integer "view_type_id"
311
+ t.string "internal_identifier"
312
+ t.text "description"
313
+ t.string "external_identifier"
314
+ t.string "external_id_source"
315
+ t.integer "described_record_id"
316
+ t.string "described_record_type"
317
+ t.datetime "created_at", :null => false
318
+ t.datetime "updated_at", :null => false
319
+ end
320
+
321
+ add_index "descriptive_assets", ["described_record_id", "described_record_type"], :name => "described_record_idx"
322
+ add_index "descriptive_assets", ["view_type_id"], :name => "index_descriptive_assets_on_view_type_id"
323
+
324
+ create_table "email_addresses", :force => true do |t|
325
+ t.string "email_address"
326
+ t.string "description"
327
+ t.datetime "created_at", :null => false
328
+ t.datetime "updated_at", :null => false
329
+ end
330
+
331
+ create_table "file_assets", :force => true do |t|
332
+ t.integer "file_asset_holder_id"
333
+ t.string "file_asset_holder_type"
334
+ t.string "type"
335
+ t.string "name"
336
+ t.string "directory"
337
+ t.string "data_file_name"
338
+ t.string "data_content_type"
339
+ t.integer "data_file_size"
340
+ t.datetime "data_updated_at"
341
+ t.string "width"
342
+ t.string "height"
343
+ t.datetime "created_at", :null => false
344
+ t.datetime "updated_at", :null => false
345
+ end
346
+
347
+ add_index "file_assets", ["directory"], :name => "index_file_assets_on_directory"
348
+ add_index "file_assets", ["file_asset_holder_id", "file_asset_holder_type"], :name => "file_asset_holder_idx"
349
+ add_index "file_assets", ["name"], :name => "index_file_assets_on_name"
350
+ add_index "file_assets", ["type"], :name => "index_file_assets_on_type"
351
+
352
+ create_table "geo_countries", :force => true do |t|
353
+ t.string "name"
354
+ t.string "iso_code_2"
355
+ t.string "iso_code_3"
356
+ t.boolean "display", :default => true
357
+ t.integer "external_id"
358
+ t.datetime "created_at"
359
+ end
360
+
361
+ add_index "geo_countries", ["iso_code_2"], :name => "index_geo_countries_on_iso_code_2"
362
+ add_index "geo_countries", ["name"], :name => "index_geo_countries_on_name"
363
+
364
+ create_table "geo_zones", :force => true do |t|
365
+ t.integer "geo_country_id"
366
+ t.string "zone_code", :default => "2"
367
+ t.string "zone_name"
368
+ t.datetime "created_at"
369
+ end
370
+
371
+ add_index "geo_zones", ["geo_country_id"], :name => "index_geo_zones_on_geo_country_id"
372
+ add_index "geo_zones", ["zone_code"], :name => "index_geo_zones_on_zone_code"
373
+ add_index "geo_zones", ["zone_name"], :name => "index_geo_zones_on_zone_name"
374
+
375
+ create_table "individuals", :force => true do |t|
376
+ t.integer "party_id"
377
+ t.string "current_last_name"
378
+ t.string "current_first_name"
379
+ t.string "current_middle_name"
380
+ t.string "current_personal_title"
381
+ t.string "current_suffix"
382
+ t.string "current_nickname"
383
+ t.string "gender", :limit => 1
384
+ t.date "birth_date"
385
+ t.decimal "height", :precision => 5, :scale => 2
386
+ t.integer "weight"
387
+ t.string "mothers_maiden_name"
388
+ t.string "marital_status", :limit => 1
389
+ t.string "social_security_number"
390
+ t.integer "current_passport_number"
391
+ t.date "current_passport_expire_date"
392
+ t.integer "total_years_work_experience"
393
+ t.string "comments"
394
+ t.string "encrypted_ssn"
395
+ t.string "temp_ssn"
396
+ t.string "salt"
397
+ t.string "ssn_last_four"
398
+ t.datetime "created_at", :null => false
399
+ t.datetime "updated_at", :null => false
400
+ end
401
+
402
+ add_index "individuals", ["party_id"], :name => "index_individuals_on_party_id"
403
+
404
+ create_table "money", :force => true do |t|
405
+ t.string "description"
406
+ t.decimal "amount", :precision => 8, :scale => 2
407
+ t.integer "currency_id"
408
+ t.datetime "created_at", :null => false
409
+ t.datetime "updated_at", :null => false
410
+ end
411
+
412
+ add_index "money", ["currency_id"], :name => "index_money_on_currency_id"
413
+
414
+ create_table "note_types", :force => true do |t|
415
+ t.integer "parent_id"
416
+ t.integer "lft"
417
+ t.integer "rgt"
418
+ t.string "description"
419
+ t.string "internal_identifier"
420
+ t.string "external_identifier"
421
+ t.integer "note_type_record_id"
422
+ t.string "note_type_record_type"
423
+ t.datetime "created_at", :null => false
424
+ t.datetime "updated_at", :null => false
425
+ end
426
+
427
+ add_index "note_types", ["note_type_record_id", "note_type_record_type"], :name => "note_type_record_idx"
428
+
429
+ create_table "notes", :force => true do |t|
430
+ t.integer "created_by_id"
431
+ t.text "content"
432
+ t.integer "noted_record_id"
433
+ t.string "noted_record_type"
434
+ t.integer "note_type_id"
435
+ t.datetime "created_at", :null => false
436
+ t.datetime "updated_at", :null => false
437
+ end
438
+
439
+ add_index "notes", ["created_by_id"], :name => "index_notes_on_created_by_id"
440
+ add_index "notes", ["note_type_id"], :name => "index_notes_on_note_type_id"
441
+ add_index "notes", ["noted_record_id", "noted_record_type"], :name => "index_notes_on_noted_record_id_and_noted_record_type"
442
+
443
+ create_table "organizations", :force => true do |t|
444
+ t.string "description"
445
+ t.string "tax_id_number"
446
+ t.datetime "created_at", :null => false
447
+ t.datetime "updated_at", :null => false
448
+ end
449
+
450
+ create_table "parties", :force => true do |t|
451
+ t.string "description"
452
+ t.integer "business_party_id"
453
+ t.string "business_party_type"
454
+ t.integer "list_view_image_id"
455
+ t.string "enterprise_identifier"
456
+ t.datetime "created_at", :null => false
457
+ t.datetime "updated_at", :null => false
458
+ end
459
+
460
+ add_index "parties", ["business_party_id", "business_party_type"], :name => "besi_1"
461
+
462
+ create_table "party_relationships", :force => true do |t|
463
+ t.string "description"
464
+ t.integer "party_id_from"
465
+ t.integer "party_id_to"
466
+ t.integer "role_type_id_from"
467
+ t.integer "role_type_id_to"
468
+ t.integer "status_type_id"
469
+ t.integer "priority_type_id"
470
+ t.integer "relationship_type_id"
471
+ t.date "from_date"
472
+ t.date "thru_date"
473
+ t.string "external_identifier"
474
+ t.string "external_id_source"
475
+ t.datetime "created_at", :null => false
476
+ t.datetime "updated_at", :null => false
477
+ end
478
+
479
+ add_index "party_relationships", ["priority_type_id"], :name => "index_party_relationships_on_priority_type_id"
480
+ add_index "party_relationships", ["relationship_type_id"], :name => "index_party_relationships_on_relationship_type_id"
481
+ add_index "party_relationships", ["status_type_id"], :name => "index_party_relationships_on_status_type_id"
482
+
483
+ create_table "party_roles", :force => true do |t|
484
+ t.string "type"
485
+ t.integer "party_id"
486
+ t.integer "role_type_id"
487
+ t.datetime "created_at", :null => false
488
+ t.datetime "updated_at", :null => false
489
+ end
490
+
491
+ add_index "party_roles", ["party_id"], :name => "index_party_roles_on_party_id"
492
+ add_index "party_roles", ["role_type_id"], :name => "index_party_roles_on_role_type_id"
493
+
494
+ create_table "party_search_facts", :force => true do |t|
495
+ t.integer "party_id"
496
+ t.string "eid"
497
+ t.string "type"
498
+ t.text "roles"
499
+ t.string "party_description"
500
+ t.string "party_business_party_type"
501
+ t.string "user_login"
502
+ t.string "individual_current_last_name"
503
+ t.string "individual_current_first_name"
504
+ t.string "individual_current_middle_name"
505
+ t.string "individual_birth_date"
506
+ t.string "individual_ssn"
507
+ t.string "party_phone_number"
508
+ t.string "party_email_address"
509
+ t.string "party_address_1"
510
+ t.string "party_address_2"
511
+ t.string "party_primary_address_city"
512
+ t.string "party_primary_address_state"
513
+ t.string "party_primary_address_zip"
514
+ t.string "party_primary_address_country"
515
+ t.boolean "user_enabled"
516
+ t.string "user_type"
517
+ t.boolean "reindex"
518
+ t.datetime "created_at", :null => false
519
+ t.datetime "updated_at", :null => false
520
+ end
521
+
522
+ create_table "phone_numbers", :force => true do |t|
523
+ t.string "phone_number"
524
+ t.string "description"
525
+ t.datetime "created_at", :null => false
526
+ t.datetime "updated_at", :null => false
527
+ end
528
+
529
+ create_table "postal_addresses", :force => true do |t|
530
+ t.string "address_line_1"
531
+ t.string "address_line_2"
532
+ t.string "city"
533
+ t.string "state"
534
+ t.string "zip"
535
+ t.string "country"
536
+ t.string "description"
537
+ t.integer "geo_country_id"
538
+ t.integer "geo_zone_id"
539
+ t.datetime "created_at", :null => false
540
+ t.datetime "updated_at", :null => false
541
+ end
542
+
543
+ add_index "postal_addresses", ["geo_country_id"], :name => "index_postal_addresses_on_geo_country_id"
544
+ add_index "postal_addresses", ["geo_zone_id"], :name => "index_postal_addresses_on_geo_zone_id"
545
+
546
+ create_table "relationship_types", :force => true do |t|
547
+ t.integer "parent_id"
548
+ t.integer "lft"
549
+ t.integer "rgt"
550
+ t.integer "valid_from_role_type_id"
551
+ t.integer "valid_to_role_type_id"
552
+ t.string "name"
553
+ t.string "description"
554
+ t.string "internal_identifier"
555
+ t.string "external_identifier"
556
+ t.string "external_id_source"
557
+ t.datetime "created_at", :null => false
558
+ t.datetime "updated_at", :null => false
559
+ end
560
+
561
+ add_index "relationship_types", ["valid_from_role_type_id"], :name => "index_relationship_types_on_valid_from_role_type_id"
562
+ add_index "relationship_types", ["valid_to_role_type_id"], :name => "index_relationship_types_on_valid_to_role_type_id"
563
+
564
+ create_table "role_types", :force => true do |t|
565
+ t.integer "parent_id"
566
+ t.integer "lft"
567
+ t.integer "rgt"
568
+ t.string "description"
569
+ t.string "comments"
570
+ t.string "internal_identifier"
571
+ t.string "external_identifier"
572
+ t.string "external_id_source"
573
+ t.datetime "created_at", :null => false
574
+ t.datetime "updated_at", :null => false
575
+ end
576
+
577
+ create_table "roles", :force => true do |t|
578
+ t.string "description"
579
+ t.string "internal_identifier"
580
+ t.string "external_identifier"
581
+ t.string "external_id_source"
582
+ t.datetime "created_at", :null => false
583
+ t.datetime "updated_at", :null => false
584
+ end
585
+
586
+ create_table "roles_secured_models", :id => false, :force => true do |t|
587
+ t.integer "secured_model_id"
588
+ t.integer "role_id"
589
+ end
590
+
591
+ add_index "roles_secured_models", ["role_id"], :name => "index_roles_secured_models_on_role_id"
592
+ add_index "roles_secured_models", ["secured_model_id"], :name => "index_roles_secured_models_on_secured_model_id"
593
+
594
+ create_table "secured_models", :force => true do |t|
595
+ t.integer "secured_record_id"
596
+ t.string "secured_record_type"
597
+ t.datetime "created_at", :null => false
598
+ t.datetime "updated_at", :null => false
599
+ end
600
+
601
+ add_index "secured_models", ["secured_record_id", "secured_record_type"], :name => "secured_record_idx"
602
+
603
+ create_table "sessions", :force => true do |t|
604
+ t.string "session_id", :null => false
605
+ t.text "data"
606
+ t.datetime "created_at", :null => false
607
+ t.datetime "updated_at", :null => false
608
+ end
609
+
610
+ add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
611
+ add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
612
+
613
+ create_table "users", :force => true do |t|
614
+ t.string "username"
615
+ t.string "email"
616
+ t.integer "party_id"
617
+ t.string "type"
618
+ t.string "salt"
619
+ t.string "crypted_password"
620
+ t.datetime "last_login_at"
621
+ t.datetime "last_logout_at"
622
+ t.datetime "last_activity_at"
623
+ t.integer "failed_logins_count", :default => 0
624
+ t.datetime "lock_expires_at"
625
+ t.string "remember_me_token"
626
+ t.datetime "remember_me_token_expires_at"
627
+ t.string "reset_password_token"
628
+ t.datetime "reset_password_token_expires_at"
629
+ t.datetime "reset_password_email_sent_at"
630
+ t.string "activation_state"
631
+ t.string "activation_token"
632
+ t.datetime "activation_token_expires_at"
633
+ t.string "security_question_1"
634
+ t.string "security_answer_1"
635
+ t.string "security_question_2"
636
+ t.string "security_answer_2"
637
+ t.datetime "created_at", :null => false
638
+ t.datetime "updated_at", :null => false
639
+ end
640
+
641
+ add_index "users", ["activation_token"], :name => "index_users_on_activation_token"
642
+ add_index "users", ["email"], :name => "index_users_on_email", :unique => true
643
+ add_index "users", ["last_logout_at", "last_activity_at"], :name => "activity_idx"
644
+ add_index "users", ["remember_me_token"], :name => "index_users_on_remember_me_token"
645
+ add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token"
646
+ add_index "users", ["username"], :name => "index_users_on_username", :unique => true
647
+
648
+ create_table "valid_note_types", :force => true do |t|
649
+ t.integer "valid_note_type_record_id"
650
+ t.string "valid_note_type_record_type"
651
+ t.integer "note_type_id"
652
+ t.datetime "created_at", :null => false
653
+ t.datetime "updated_at", :null => false
654
+ end
655
+
656
+ add_index "valid_note_types", ["note_type_id"], :name => "index_valid_note_types_on_note_type_id"
657
+ add_index "valid_note_types", ["valid_note_type_record_id", "valid_note_type_record_type"], :name => "valid_note_type_record_idx"
658
+
659
+ create_table "view_types", :force => true do |t|
660
+ t.string "internal_identifier"
661
+ t.string "description"
662
+ t.datetime "created_at", :null => false
663
+ t.datetime "updated_at", :null => false
664
+ end
665
+
666
+ end