erp_tech_svcs 3.1.7 → 3.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +15 -0
  2. data/lib/erp_tech_svcs/extensions/active_record/has_security_roles.rb +1 -5
  3. data/lib/erp_tech_svcs/version.rb +1 -1
  4. data/spec/dummy/db/data_migrations/20130220143304_add_usd_currency.erp_base_erp_svcs.rb +12 -0
  5. data/spec/dummy/db/data_migrations/20130220143305_add_iso_codes.erp_base_erp_svcs.rb +19 -0
  6. data/spec/dummy/db/data_migrations/20130220143306_setup_compass_ae_instance.erp_base_erp_svcs.rb +21 -0
  7. data/spec/dummy/db/data_migrations/20130220143307_upgrade_compass_ae_instances_data.erp_base_erp_svcs.rb +19 -0
  8. data/spec/dummy/db/data_migrations/20130220143308_create_capability_scope_types.erp_tech_svcs.rb +15 -0
  9. data/spec/dummy/db/data_migrations/20130220143309_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +16 -0
  10. data/spec/dummy/db/data_migrations/20130220143310_setup_audit_log_types.erp_tech_svcs.rb +22 -0
  11. data/spec/dummy/db/data_migrations/20130220143311_create_group_relationship_and_role_types.erp_tech_svcs.rb +20 -0
  12. data/spec/dummy/db/data_migrations/20130220143312_note_capabilities.erp_tech_svcs.rb +24 -0
  13. data/spec/dummy/db/data_migrations/20130422151256_add_guid_to_instances.erp_base_erp_svcs.rb +10 -0
  14. data/spec/dummy/db/migrate/20130220143259_base_erp_services.erp_base_erp_svcs.rb +486 -0
  15. data/spec/dummy/db/migrate/20130220143260_add_txn_status.erp_base_erp_svcs.rb +37 -0
  16. data/spec/dummy/db/migrate/20130220143261_upgrade_compass_ae_instances.erp_base_erp_svcs.rb +34 -0
  17. data/spec/dummy/db/migrate/20130220143262_base_tech_services.erp_tech_svcs.rb +271 -0
  18. data/spec/dummy/db/migrate/20130220143263_create_has_attribute_tables.erp_tech_svcs.rb +39 -0
  19. data/spec/dummy/db/migrate/20130220143264_create_groups.erp_tech_svcs.rb +19 -0
  20. data/spec/dummy/db/migrate/20130220143265_upgrade_security.erp_tech_svcs.rb +54 -0
  21. data/spec/dummy/db/migrate/20130220143266_upgrade_security2.erp_tech_svcs.rb +275 -0
  22. data/spec/dummy/db/migrate/20130422151250_add_uuid_compass_ae_instance.erp_base_erp_svcs.rb +17 -0
  23. data/spec/dummy/db/migrate/20130422151251_add_long_lat_to_address.erp_base_erp_svcs.rb +16 -0
  24. data/spec/dummy/db/migrate/20130422151252_add_queue_to_delayed_jobs.erp_tech_svcs.rb +14 -0
  25. data/spec/dummy/db/schema.rb +665 -0
  26. data/spec/dummy/db/spec.sqlite3 +0 -0
  27. metadata +51 -23
@@ -0,0 +1,275 @@
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
+ # adding user mgmt capabilities to admin role
143
+ admin.add_capability('create', 'User')
144
+ admin.add_capability('delete', 'User')
145
+ admin.add_capability('edit', 'User')
146
+
147
+ # add knitkit class capabilities to roles
148
+ admin.add_capability('create', 'WebsiteNav')
149
+ admin.add_capability('delete', 'WebsiteNav')
150
+ admin.add_capability('edit', 'WebsiteNav')
151
+
152
+ website_author.add_capability('create', 'WebsiteNav')
153
+ website_author.add_capability('delete', 'WebsiteNav')
154
+ website_author.add_capability('edit', 'WebsiteNav')
155
+
156
+ admin.add_capability('create', 'Website')
157
+ admin.add_capability('delete', 'Website')
158
+ admin.add_capability('edit', 'Website')
159
+ admin.add_capability('import', 'Website')
160
+ admin.add_capability('publish', 'Website')
161
+ admin.add_capability('activate', 'Website')
162
+
163
+ website_author.add_capability('create', 'Website')
164
+ website_author.add_capability('delete', 'Website')
165
+ website_author.add_capability('edit', 'Website')
166
+ website_author.add_capability('import', 'Website')
167
+ publisher.add_capability('publish', 'Website')
168
+ publisher.add_capability('activate', 'Website')
169
+
170
+ admin.add_capability('create', 'WebsiteHost')
171
+ admin.add_capability('delete', 'WebsiteHost')
172
+ admin.add_capability('edit', 'WebsiteHost')
173
+
174
+ website_author.add_capability('create', 'WebsiteHost')
175
+ website_author.add_capability('delete', 'WebsiteHost')
176
+ website_author.add_capability('edit', 'WebsiteHost')
177
+
178
+ admin.add_capability('create', 'WebsiteSection')
179
+ admin.add_capability('delete', 'WebsiteSection')
180
+ admin.add_capability('edit', 'WebsiteSection')
181
+ admin.add_capability('secure', 'WebsiteSection')
182
+ admin.add_capability('unsecure', 'WebsiteSection')
183
+
184
+ website_author.add_capability('create', 'WebsiteSection')
185
+ website_author.add_capability('delete', 'WebsiteSection')
186
+ website_author.add_capability('edit', 'WebsiteSection')
187
+ website_author.add_capability('secure', 'WebsiteSection')
188
+ website_author.add_capability('unsecure', 'WebsiteSection')
189
+
190
+ admin.add_capability('create', 'WebsiteSectionLayout')
191
+ admin.add_capability('edit', 'WebsiteSectionLayout')
192
+
193
+ layout_author.add_capability('create', 'WebsiteSectionLayout')
194
+ layout_author.add_capability('edit', 'WebsiteSectionLayout')
195
+
196
+ admin.add_capability('create', 'Content')
197
+ admin.add_capability('delete', 'Content')
198
+ admin.add_capability('edit', 'Content')
199
+ admin.add_capability('publish', 'Content')
200
+ admin.add_capability('revert_version', 'Content')
201
+ admin.add_capability('add_existing', 'Content')
202
+ admin.add_capability('edit_html', 'Content')
203
+ admin.add_capability('edit_excerpt', 'Content')
204
+
205
+ content_author.add_capability('create', 'Content')
206
+ content_author.add_capability('delete', 'Content')
207
+ content_author.add_capability('edit', 'Content')
208
+ content_author.add_capability('publish', 'Content')
209
+ content_author.add_capability('revert_version', 'Content')
210
+ content_author.add_capability('add_existing', 'Content')
211
+ content_author.add_capability('edit_html', 'Content')
212
+ content_author.add_capability('edit_excerpt', 'Content')
213
+
214
+ admin.add_capability('create', 'WebsiteNavItem')
215
+ admin.add_capability('delete', 'WebsiteNavItem')
216
+ admin.add_capability('edit', 'WebsiteNavItem')
217
+ admin.add_capability('secure', 'WebsiteNavItem')
218
+ admin.add_capability('unsecure', 'WebsiteNavItem')
219
+
220
+ website_author.add_capability('create', 'WebsiteNavItem')
221
+ website_author.add_capability('delete', 'WebsiteNavItem')
222
+ website_author.add_capability('edit', 'WebsiteNavItem')
223
+ website_author.add_capability('secure', 'WebsiteNavItem')
224
+ website_author.add_capability('unsecure', 'WebsiteNavItem')
225
+
226
+ admin.add_capability('view', 'Theme')
227
+ designer.add_capability('view', 'Theme')
228
+
229
+ admin.add_capability('view', 'SiteImageAsset')
230
+ website_author.add_capability('view', 'SiteImageAsset')
231
+ content_author.add_capability('view', 'SiteImageAsset')
232
+
233
+ content_author.add_capability('view', 'GlobalImageAsset')
234
+
235
+ admin.add_capability('view', 'GlobalImageAsset')
236
+ admin.add_capability('upload', 'GlobalImageAsset')
237
+ admin.add_capability('delete', 'GlobalImageAsset')
238
+
239
+ website_author.add_capability('view', 'GlobalImageAsset')
240
+ website_author.add_capability('upload', 'GlobalImageAsset')
241
+ website_author.add_capability('delete', 'GlobalImageAsset')
242
+
243
+ admin.add_capability('view', 'SiteFileAsset')
244
+ website_author.add_capability('view', 'SiteFileAsset')
245
+ content_author.add_capability('view', 'SiteFileAsset')
246
+
247
+ content_author.add_capability('view', 'GlobalFileAsset')
248
+
249
+ admin.add_capability('view', 'GlobalFileAsset')
250
+ admin.add_capability('upload', 'GlobalFileAsset')
251
+ admin.add_capability('delete', 'GlobalFileAsset')
252
+
253
+ website_author.add_capability('view', 'GlobalFileAsset')
254
+ website_author.add_capability('upload', 'GlobalFileAsset')
255
+ website_author.add_capability('delete', 'GlobalFileAsset')
256
+
257
+ admin.add_capability('drag_item', 'WebsiteTree')
258
+ website_author.add_capability('drag_item', 'WebsiteTree')
259
+
260
+ # update capability descriptions
261
+ Capability.all.each do |c|
262
+ c.update_description
263
+ end
264
+
265
+ drop_table :capable_models
266
+ drop_table :capabilities_capable_models
267
+ drop_table :secured_models
268
+ drop_table :roles_secured_models
269
+ remove_column :capabilities, :resource
270
+ end
271
+ end
272
+
273
+ def self.down
274
+ end
275
+ end
@@ -0,0 +1,17 @@
1
+ # This migration comes from erp_base_erp_svcs (originally 20130404171435)
2
+ require 'uuid'
3
+
4
+ class AddUuidCompassAeInstance < ActiveRecord::Migration
5
+ def self.up
6
+ unless columns(:compass_ae_instances).collect {|c| c.name}.include?('guid')
7
+ add_column :compass_ae_instances, :guid, :string
8
+ add_index :compass_ae_instances, :guid, :name => "guid_idx"
9
+ end
10
+ end
11
+
12
+ def self.down
13
+ if columns(:compass_ae_instances).collect {|c| c.name}.include?('guid')
14
+ remove_column :compass_ae_instances, :guid
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,16 @@
1
+ # This migration comes from erp_base_erp_svcs (originally 20130411125210)
2
+ class AddLongLatToAddress < ActiveRecord::Migration
3
+ def up
4
+ unless columns(:postal_addresses).collect {|c| c.name}.include?('latitude')
5
+ add_column :postal_addresses, :latitude, :decimal, :precision => 12, :scale => 8
6
+ add_column :postal_addresses, :longitude, :decimal, :precision => 12, :scale => 8
7
+ end
8
+ end
9
+
10
+ def down
11
+ if columns(:postal_addresses).collect {|c| c.name}.include?('latitude')
12
+ remove_column :postal_addresses, :latitude
13
+ remove_column :postal_addresses, :longitude
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,14 @@
1
+ # This migration comes from erp_tech_svcs (originally 20130410135419)
2
+ class AddQueueToDelayedJobs < ActiveRecord::Migration
3
+ def up
4
+ unless columns(:delayed_jobs).collect {|c| c.name}.include?('queue')
5
+ add_column :delayed_jobs, :queue, :string
6
+ end
7
+ end
8
+
9
+ def down
10
+ if columns(:delayed_jobs).collect {|c| c.name}.include?('queue')
11
+ remove_column :delayed_jobs, :queue, :string
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,665 @@
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 => 20130422151252) 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 "description"
92
+ t.integer "capability_type_id"
93
+ t.string "capability_resource_type"
94
+ t.integer "capability_resource_id"
95
+ t.integer "scope_type_id"
96
+ t.text "scope_query"
97
+ t.datetime "created_at", :null => false
98
+ t.datetime "updated_at", :null => false
99
+ end
100
+
101
+ add_index "capabilities", ["capability_resource_id", "capability_resource_type"], :name => "capability_resource_index"
102
+ add_index "capabilities", ["capability_type_id"], :name => "index_capabilities_on_capability_type_id"
103
+ add_index "capabilities", ["scope_type_id"], :name => "index_capabilities_on_scope_type_id"
104
+
105
+ create_table "capability_accessors", :force => true do |t|
106
+ t.string "capability_accessor_record_type"
107
+ t.integer "capability_accessor_record_id"
108
+ t.integer "capability_id"
109
+ t.datetime "created_at", :null => false
110
+ t.datetime "updated_at", :null => false
111
+ end
112
+
113
+ add_index "capability_accessors", ["capability_accessor_record_id", "capability_accessor_record_type"], :name => "capability_accessor_record_index"
114
+ add_index "capability_accessors", ["capability_id"], :name => "index_capability_accessors_on_capability_id"
115
+
116
+ create_table "capability_types", :force => true do |t|
117
+ t.string "internal_identifier"
118
+ t.string "description"
119
+ t.datetime "created_at", :null => false
120
+ t.datetime "updated_at", :null => false
121
+ end
122
+
123
+ create_table "capable_models", :force => true do |t|
124
+ t.integer "capable_model_record_id"
125
+ t.string "capable_model_record_type"
126
+ t.datetime "created_at", :null => false
127
+ t.datetime "updated_at", :null => false
128
+ end
129
+
130
+ add_index "capable_models", ["capable_model_record_id", "capable_model_record_type"], :name => "capable_model_record_idx"
131
+
132
+ create_table "categories", :force => true do |t|
133
+ t.string "description"
134
+ t.string "external_identifier"
135
+ t.datetime "from_date"
136
+ t.datetime "to_date"
137
+ t.string "internal_identifier"
138
+ t.integer "category_record_id"
139
+ t.string "category_record_type"
140
+ t.integer "parent_id"
141
+ t.integer "lft"
142
+ t.integer "rgt"
143
+ t.datetime "created_at", :null => false
144
+ t.datetime "updated_at", :null => false
145
+ end
146
+
147
+ add_index "categories", ["category_record_id", "category_record_type"], :name => "category_polymorphic"
148
+
149
+ create_table "category_classifications", :force => true do |t|
150
+ t.integer "category_id"
151
+ t.string "classification_type"
152
+ t.integer "classification_id"
153
+ t.datetime "from_date"
154
+ t.datetime "to_date"
155
+ t.datetime "created_at", :null => false
156
+ t.datetime "updated_at", :null => false
157
+ end
158
+
159
+ add_index "category_classifications", ["classification_id", "classification_type"], :name => "classification_polymorphic"
160
+
161
+ create_table "compass_ae_instance_party_roles", :force => true do |t|
162
+ t.string "description"
163
+ t.integer "compass_ae_instance_id"
164
+ t.integer "party_id"
165
+ t.integer "role_type_id"
166
+ t.datetime "created_at", :null => false
167
+ t.datetime "updated_at", :null => false
168
+ end
169
+
170
+ add_index "compass_ae_instance_party_roles", ["compass_ae_instance_id"], :name => "compass_ae_instance_id_idx"
171
+ add_index "compass_ae_instance_party_roles", ["party_id"], :name => "party_id_idx"
172
+ add_index "compass_ae_instance_party_roles", ["role_type_id"], :name => "role_type_id_idx"
173
+
174
+ create_table "compass_ae_instances", :force => true do |t|
175
+ t.string "description"
176
+ t.string "internal_identifier"
177
+ t.decimal "version", :precision => 8, :scale => 3
178
+ t.string "type"
179
+ t.string "schema", :default => "public"
180
+ t.integer "parent_id"
181
+ t.datetime "created_at", :null => false
182
+ t.datetime "updated_at", :null => false
183
+ t.string "guid"
184
+ end
185
+
186
+ add_index "compass_ae_instances", ["guid"], :name => "guid_idx"
187
+ add_index "compass_ae_instances", ["internal_identifier"], :name => "iid_idx"
188
+ add_index "compass_ae_instances", ["parent_id"], :name => "parent_id_idx"
189
+ add_index "compass_ae_instances", ["schema"], :name => "schema_idx"
190
+ add_index "compass_ae_instances", ["type"], :name => "type_idx"
191
+
192
+ create_table "contact_purposes", :force => true do |t|
193
+ t.integer "parent_id"
194
+ t.integer "lft"
195
+ t.integer "rgt"
196
+ t.string "description"
197
+ t.string "comments"
198
+ t.string "internal_identifier"
199
+ t.string "external_identifier"
200
+ t.string "external_id_source"
201
+ t.datetime "created_at", :null => false
202
+ t.datetime "updated_at", :null => false
203
+ end
204
+
205
+ add_index "contact_purposes", ["parent_id"], :name => "index_contact_purposes_on_parent_id"
206
+
207
+ create_table "contact_purposes_contacts", :id => false, :force => true do |t|
208
+ t.integer "contact_id"
209
+ t.integer "contact_purpose_id"
210
+ end
211
+
212
+ add_index "contact_purposes_contacts", ["contact_id", "contact_purpose_id"], :name => "contact_purposes_contacts_index"
213
+
214
+ create_table "contact_types", :force => true do |t|
215
+ t.integer "parent_id"
216
+ t.integer "lft"
217
+ t.integer "rgt"
218
+ t.string "description"
219
+ t.string "comments"
220
+ t.string "internal_identifier"
221
+ t.string "external_identifier"
222
+ t.string "external_id_source"
223
+ t.datetime "created_at", :null => false
224
+ t.datetime "updated_at", :null => false
225
+ end
226
+
227
+ add_index "contact_types", ["parent_id"], :name => "index_contact_types_on_parent_id"
228
+
229
+ create_table "contacts", :force => true do |t|
230
+ t.integer "party_id"
231
+ t.integer "contact_mechanism_id"
232
+ t.string "contact_mechanism_type"
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 "contacts", ["contact_mechanism_id", "contact_mechanism_type"], :name => "besi_2"
240
+ add_index "contacts", ["party_id"], :name => "index_contacts_on_party_id"
241
+
242
+ create_table "currencies", :force => true do |t|
243
+ t.string "name"
244
+ t.string "definition"
245
+ t.string "internal_identifier"
246
+ t.string "numeric_code"
247
+ t.string "major_unit_symbol"
248
+ t.string "minor_unit_symbol"
249
+ t.string "ratio_of_minor_unit_to_major_unit"
250
+ t.string "postfix_label"
251
+ t.datetime "introduction_date"
252
+ t.datetime "expiration_date"
253
+ t.datetime "created_at", :null => false
254
+ t.datetime "updated_at", :null => false
255
+ end
256
+
257
+ add_index "currencies", ["internal_identifier"], :name => "index_currencies_on_internal_identifier"
258
+
259
+ create_table "delayed_jobs", :force => true do |t|
260
+ t.integer "priority", :default => 0
261
+ t.integer "attempts", :default => 0
262
+ t.text "handler"
263
+ t.text "last_error"
264
+ t.datetime "run_at"
265
+ t.datetime "locked_at"
266
+ t.datetime "failed_at"
267
+ t.string "locked_by"
268
+ t.string "queue"
269
+ t.datetime "created_at", :null => false
270
+ t.datetime "updated_at", :null => false
271
+ end
272
+
273
+ add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
274
+
275
+ create_table "descriptive_assets", :force => true do |t|
276
+ t.integer "view_type_id"
277
+ t.string "internal_identifier"
278
+ t.text "description"
279
+ t.string "external_identifier"
280
+ t.string "external_id_source"
281
+ t.integer "described_record_id"
282
+ t.string "described_record_type"
283
+ t.datetime "created_at", :null => false
284
+ t.datetime "updated_at", :null => false
285
+ end
286
+
287
+ add_index "descriptive_assets", ["described_record_id", "described_record_type"], :name => "described_record_idx"
288
+ add_index "descriptive_assets", ["view_type_id"], :name => "index_descriptive_assets_on_view_type_id"
289
+
290
+ create_table "email_addresses", :force => true do |t|
291
+ t.string "email_address"
292
+ t.string "description"
293
+ t.datetime "created_at", :null => false
294
+ t.datetime "updated_at", :null => false
295
+ end
296
+
297
+ create_table "file_assets", :force => true do |t|
298
+ t.integer "file_asset_holder_id"
299
+ t.string "file_asset_holder_type"
300
+ t.string "type"
301
+ t.string "name"
302
+ t.string "directory"
303
+ t.string "data_file_name"
304
+ t.string "data_content_type"
305
+ t.integer "data_file_size"
306
+ t.datetime "data_updated_at"
307
+ t.string "width"
308
+ t.string "height"
309
+ t.datetime "created_at", :null => false
310
+ t.datetime "updated_at", :null => false
311
+ end
312
+
313
+ add_index "file_assets", ["directory"], :name => "index_file_assets_on_directory"
314
+ add_index "file_assets", ["file_asset_holder_id", "file_asset_holder_type"], :name => "file_asset_holder_idx"
315
+ add_index "file_assets", ["name"], :name => "index_file_assets_on_name"
316
+ add_index "file_assets", ["type"], :name => "index_file_assets_on_type"
317
+
318
+ create_table "geo_countries", :force => true do |t|
319
+ t.string "name"
320
+ t.string "iso_code_2"
321
+ t.string "iso_code_3"
322
+ t.boolean "display", :default => true
323
+ t.integer "external_id"
324
+ t.datetime "created_at"
325
+ end
326
+
327
+ add_index "geo_countries", ["iso_code_2"], :name => "index_geo_countries_on_iso_code_2"
328
+ add_index "geo_countries", ["name"], :name => "index_geo_countries_on_name"
329
+
330
+ create_table "geo_zones", :force => true do |t|
331
+ t.integer "geo_country_id"
332
+ t.string "zone_code", :default => "2"
333
+ t.string "zone_name"
334
+ t.datetime "created_at"
335
+ end
336
+
337
+ add_index "geo_zones", ["geo_country_id"], :name => "index_geo_zones_on_geo_country_id"
338
+ add_index "geo_zones", ["zone_code"], :name => "index_geo_zones_on_zone_code"
339
+ add_index "geo_zones", ["zone_name"], :name => "index_geo_zones_on_zone_name"
340
+
341
+ create_table "groups", :force => true do |t|
342
+ t.string "description"
343
+ t.datetime "created_at", :null => false
344
+ t.datetime "updated_at", :null => false
345
+ end
346
+
347
+ create_table "individuals", :force => true do |t|
348
+ t.integer "party_id"
349
+ t.string "current_last_name"
350
+ t.string "current_first_name"
351
+ t.string "current_middle_name"
352
+ t.string "current_personal_title"
353
+ t.string "current_suffix"
354
+ t.string "current_nickname"
355
+ t.string "gender", :limit => 1
356
+ t.date "birth_date"
357
+ t.decimal "height", :precision => 5, :scale => 2
358
+ t.integer "weight"
359
+ t.string "mothers_maiden_name"
360
+ t.string "marital_status", :limit => 1
361
+ t.string "social_security_number"
362
+ t.integer "current_passport_number"
363
+ t.date "current_passport_expire_date"
364
+ t.integer "total_years_work_experience"
365
+ t.string "comments"
366
+ t.string "encrypted_ssn"
367
+ t.string "temp_ssn"
368
+ t.string "salt"
369
+ t.string "ssn_last_four"
370
+ t.datetime "created_at", :null => false
371
+ t.datetime "updated_at", :null => false
372
+ end
373
+
374
+ add_index "individuals", ["party_id"], :name => "index_individuals_on_party_id"
375
+
376
+ create_table "money", :force => true do |t|
377
+ t.string "description"
378
+ t.decimal "amount", :precision => 8, :scale => 2
379
+ t.integer "currency_id"
380
+ t.datetime "created_at", :null => false
381
+ t.datetime "updated_at", :null => false
382
+ end
383
+
384
+ add_index "money", ["currency_id"], :name => "index_money_on_currency_id"
385
+
386
+ create_table "note_types", :force => true do |t|
387
+ t.integer "parent_id"
388
+ t.integer "lft"
389
+ t.integer "rgt"
390
+ t.string "description"
391
+ t.string "internal_identifier"
392
+ t.string "external_identifier"
393
+ t.integer "note_type_record_id"
394
+ t.string "note_type_record_type"
395
+ t.datetime "created_at", :null => false
396
+ t.datetime "updated_at", :null => false
397
+ end
398
+
399
+ add_index "note_types", ["note_type_record_id", "note_type_record_type"], :name => "note_type_record_idx"
400
+
401
+ create_table "notes", :force => true do |t|
402
+ t.integer "created_by_id"
403
+ t.text "content"
404
+ t.integer "noted_record_id"
405
+ t.string "noted_record_type"
406
+ t.integer "note_type_id"
407
+ t.datetime "created_at", :null => false
408
+ t.datetime "updated_at", :null => false
409
+ end
410
+
411
+ add_index "notes", ["created_by_id"], :name => "index_notes_on_created_by_id"
412
+ add_index "notes", ["note_type_id"], :name => "index_notes_on_note_type_id"
413
+ add_index "notes", ["noted_record_id", "noted_record_type"], :name => "index_notes_on_noted_record_id_and_noted_record_type"
414
+
415
+ create_table "organizations", :force => true do |t|
416
+ t.string "description"
417
+ t.string "tax_id_number"
418
+ t.datetime "created_at", :null => false
419
+ t.datetime "updated_at", :null => false
420
+ end
421
+
422
+ create_table "parties", :force => true do |t|
423
+ t.string "description"
424
+ t.integer "business_party_id"
425
+ t.string "business_party_type"
426
+ t.integer "list_view_image_id"
427
+ t.string "enterprise_identifier"
428
+ t.datetime "created_at", :null => false
429
+ t.datetime "updated_at", :null => false
430
+ end
431
+
432
+ add_index "parties", ["business_party_id", "business_party_type"], :name => "besi_1"
433
+
434
+ create_table "parties_security_roles", :id => false, :force => true do |t|
435
+ t.integer "party_id"
436
+ t.integer "security_role_id"
437
+ end
438
+
439
+ add_index "parties_security_roles", ["party_id"], :name => "index_parties_security_roles_on_party_id"
440
+ add_index "parties_security_roles", ["security_role_id"], :name => "index_parties_security_roles_on_security_role_id"
441
+
442
+ create_table "party_relationships", :force => true do |t|
443
+ t.string "description"
444
+ t.integer "party_id_from"
445
+ t.integer "party_id_to"
446
+ t.integer "role_type_id_from"
447
+ t.integer "role_type_id_to"
448
+ t.integer "status_type_id"
449
+ t.integer "priority_type_id"
450
+ t.integer "relationship_type_id"
451
+ t.date "from_date"
452
+ t.date "thru_date"
453
+ t.string "external_identifier"
454
+ t.string "external_id_source"
455
+ t.datetime "created_at", :null => false
456
+ t.datetime "updated_at", :null => false
457
+ end
458
+
459
+ add_index "party_relationships", ["priority_type_id"], :name => "index_party_relationships_on_priority_type_id"
460
+ add_index "party_relationships", ["relationship_type_id"], :name => "index_party_relationships_on_relationship_type_id"
461
+ add_index "party_relationships", ["status_type_id"], :name => "index_party_relationships_on_status_type_id"
462
+
463
+ create_table "party_roles", :force => true do |t|
464
+ t.string "type"
465
+ t.integer "party_id"
466
+ t.integer "role_type_id"
467
+ t.datetime "created_at", :null => false
468
+ t.datetime "updated_at", :null => false
469
+ end
470
+
471
+ add_index "party_roles", ["party_id"], :name => "index_party_roles_on_party_id"
472
+ add_index "party_roles", ["role_type_id"], :name => "index_party_roles_on_role_type_id"
473
+
474
+ create_table "party_search_facts", :force => true do |t|
475
+ t.integer "party_id"
476
+ t.string "eid"
477
+ t.string "type"
478
+ t.text "roles"
479
+ t.string "party_description"
480
+ t.string "party_business_party_type"
481
+ t.string "user_login"
482
+ t.string "individual_current_last_name"
483
+ t.string "individual_current_first_name"
484
+ t.string "individual_current_middle_name"
485
+ t.string "individual_birth_date"
486
+ t.string "individual_ssn"
487
+ t.string "party_phone_number"
488
+ t.string "party_email_address"
489
+ t.string "party_address_1"
490
+ t.string "party_address_2"
491
+ t.string "party_primary_address_city"
492
+ t.string "party_primary_address_state"
493
+ t.string "party_primary_address_zip"
494
+ t.string "party_primary_address_country"
495
+ t.boolean "user_enabled"
496
+ t.string "user_type"
497
+ t.boolean "reindex"
498
+ t.datetime "created_at", :null => false
499
+ t.datetime "updated_at", :null => false
500
+ end
501
+
502
+ create_table "phone_numbers", :force => true do |t|
503
+ t.string "phone_number"
504
+ t.string "description"
505
+ t.datetime "created_at", :null => false
506
+ t.datetime "updated_at", :null => false
507
+ end
508
+
509
+ create_table "postal_addresses", :force => true do |t|
510
+ t.string "address_line_1"
511
+ t.string "address_line_2"
512
+ t.string "city"
513
+ t.string "state"
514
+ t.string "zip"
515
+ t.string "country"
516
+ t.string "description"
517
+ t.integer "geo_country_id"
518
+ t.integer "geo_zone_id"
519
+ t.datetime "created_at", :null => false
520
+ t.datetime "updated_at", :null => false
521
+ t.decimal "latitude", :precision => 12, :scale => 8
522
+ t.decimal "longitude", :precision => 12, :scale => 8
523
+ end
524
+
525
+ add_index "postal_addresses", ["geo_country_id"], :name => "index_postal_addresses_on_geo_country_id"
526
+ add_index "postal_addresses", ["geo_zone_id"], :name => "index_postal_addresses_on_geo_zone_id"
527
+
528
+ create_table "relationship_types", :force => true do |t|
529
+ t.integer "parent_id"
530
+ t.integer "lft"
531
+ t.integer "rgt"
532
+ t.integer "valid_from_role_type_id"
533
+ t.integer "valid_to_role_type_id"
534
+ t.string "name"
535
+ t.string "description"
536
+ t.string "internal_identifier"
537
+ t.string "external_identifier"
538
+ t.string "external_id_source"
539
+ t.datetime "created_at", :null => false
540
+ t.datetime "updated_at", :null => false
541
+ end
542
+
543
+ add_index "relationship_types", ["valid_from_role_type_id"], :name => "index_relationship_types_on_valid_from_role_type_id"
544
+ add_index "relationship_types", ["valid_to_role_type_id"], :name => "index_relationship_types_on_valid_to_role_type_id"
545
+
546
+ create_table "role_types", :force => true do |t|
547
+ t.integer "parent_id"
548
+ t.integer "lft"
549
+ t.integer "rgt"
550
+ t.string "description"
551
+ t.string "comments"
552
+ t.string "internal_identifier"
553
+ t.string "external_identifier"
554
+ t.string "external_id_source"
555
+ t.datetime "created_at", :null => false
556
+ t.datetime "updated_at", :null => false
557
+ end
558
+
559
+ create_table "scope_types", :force => true do |t|
560
+ t.string "description"
561
+ t.string "internal_identifier"
562
+ t.datetime "created_at", :null => false
563
+ t.datetime "updated_at", :null => false
564
+ end
565
+
566
+ add_index "scope_types", ["internal_identifier"], :name => "index_scope_types_on_internal_identifier"
567
+
568
+ create_table "security_roles", :force => true do |t|
569
+ t.string "description"
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 "sessions", :force => true do |t|
578
+ t.string "session_id", :null => false
579
+ t.text "data"
580
+ t.datetime "created_at", :null => false
581
+ t.datetime "updated_at", :null => false
582
+ end
583
+
584
+ add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
585
+ add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
586
+
587
+ create_table "status_applications", :force => true do |t|
588
+ t.integer "tracked_status_type_id"
589
+ t.integer "status_application_record_id"
590
+ t.string "status_application_record_type"
591
+ t.datetime "from_date"
592
+ t.datetime "thru_date"
593
+ t.datetime "created_at", :null => false
594
+ t.datetime "updated_at", :null => false
595
+ end
596
+
597
+ add_index "status_applications", ["from_date"], :name => "from_date_idx"
598
+ add_index "status_applications", ["status_application_record_id", "status_application_record_type"], :name => "status_applications_record_idx"
599
+ add_index "status_applications", ["thru_date"], :name => "thru_date_idx"
600
+ add_index "status_applications", ["tracked_status_type_id"], :name => "tracked_status_type_id_idx"
601
+
602
+ create_table "tracked_status_types", :force => true do |t|
603
+ t.string "description"
604
+ t.string "internal_identifier"
605
+ t.string "external_identifier"
606
+ t.datetime "created_at", :null => false
607
+ t.datetime "updated_at", :null => false
608
+ end
609
+
610
+ add_index "tracked_status_types", ["internal_identifier"], :name => "tracked_status_types_iid_idx"
611
+
612
+ create_table "users", :force => true do |t|
613
+ t.string "username"
614
+ t.string "email"
615
+ t.integer "party_id"
616
+ t.string "type"
617
+ t.string "salt"
618
+ t.string "crypted_password"
619
+ t.datetime "last_login_at"
620
+ t.datetime "last_logout_at"
621
+ t.datetime "last_activity_at"
622
+ t.integer "failed_logins_count", :default => 0
623
+ t.datetime "lock_expires_at"
624
+ t.string "remember_me_token"
625
+ t.datetime "remember_me_token_expires_at"
626
+ t.string "reset_password_token"
627
+ t.datetime "reset_password_token_expires_at"
628
+ t.datetime "reset_password_email_sent_at"
629
+ t.string "activation_state"
630
+ t.string "activation_token"
631
+ t.datetime "activation_token_expires_at"
632
+ t.string "security_question_1"
633
+ t.string "security_answer_1"
634
+ t.string "security_question_2"
635
+ t.string "security_answer_2"
636
+ t.datetime "created_at", :null => false
637
+ t.datetime "updated_at", :null => false
638
+ end
639
+
640
+ add_index "users", ["activation_token"], :name => "index_users_on_activation_token"
641
+ add_index "users", ["email"], :name => "index_users_on_email", :unique => true
642
+ add_index "users", ["last_logout_at", "last_activity_at"], :name => "activity_idx"
643
+ add_index "users", ["remember_me_token"], :name => "index_users_on_remember_me_token"
644
+ add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token"
645
+ add_index "users", ["username"], :name => "index_users_on_username", :unique => true
646
+
647
+ create_table "valid_note_types", :force => true do |t|
648
+ t.integer "valid_note_type_record_id"
649
+ t.string "valid_note_type_record_type"
650
+ t.integer "note_type_id"
651
+ t.datetime "created_at", :null => false
652
+ t.datetime "updated_at", :null => false
653
+ end
654
+
655
+ add_index "valid_note_types", ["note_type_id"], :name => "index_valid_note_types_on_note_type_id"
656
+ add_index "valid_note_types", ["valid_note_type_record_id", "valid_note_type_record_type"], :name => "valid_note_type_record_idx"
657
+
658
+ create_table "view_types", :force => true do |t|
659
+ t.string "internal_identifier"
660
+ t.string "description"
661
+ t.datetime "created_at", :null => false
662
+ t.datetime "updated_at", :null => false
663
+ end
664
+
665
+ end