erp_agreements 3.1.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +7 -0
  2. data/lib/erp_agreements/version.rb +6 -2
  3. metadata +23 -81
  4. data/app/assets/javascripts/erp_agreements/application.js +0 -9
  5. data/app/assets/stylesheets/erp_agreements/application.css +0 -7
  6. data/app/controllers/erp_agreements/application_controller.rb +0 -4
  7. data/app/helpers/erp_agreements/application_helper.rb +0 -4
  8. data/app/views/layouts/erp_agreements/application.html.erb +0 -14
  9. data/spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb +0 -15
  10. data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +0 -12
  11. data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +0 -19
  12. data/spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +0 -16
  13. data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +0 -12
  14. data/spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb +0 -22
  15. data/spec/dummy/db/data_migrations/20120109173616_create_download_capability_type.erp_tech_svcs.rb +0 -14
  16. data/spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb +0 -20
  17. data/spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb +0 -24
  18. data/spec/dummy/db/migrate/20130107214618_base_erp_services.erp_base_erp_svcs.rb +0 -461
  19. data/spec/dummy/db/migrate/20130107214619_agreements_services.erp_agreements.rb +0 -160
  20. data/spec/dummy/db/migrate/20130107214620_agreements_services_indexes.erp_agreements.rb +0 -52
  21. data/spec/dummy/db/migrate/20130107214621_base_tech_services.erp_tech_svcs.rb +0 -271
  22. data/spec/dummy/db/migrate/20130107214622_create_has_attribute_tables.erp_tech_svcs.rb +0 -39
  23. data/spec/dummy/db/migrate/20130107214623_create_groups.erp_tech_svcs.rb +0 -19
  24. data/spec/dummy/db/migrate/20130107214624_upgrade_security.erp_tech_svcs.rb +0 -54
  25. data/spec/dummy/db/migrate/20130107214625_upgrade_security2.erp_tech_svcs.rb +0 -270
  26. data/spec/dummy/db/schema.rb +0 -747
  27. data/spec/dummy/db/spec.sqlite3 +0 -0
  28. data/spec/dummy/log/development.log +0 -2
  29. data/spec/dummy/log/spec.log +0 -13137
@@ -1,39 +0,0 @@
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
@@ -1,19 +0,0 @@
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
@@ -1,54 +0,0 @@
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
@@ -1,270 +0,0 @@
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
@@ -1,747 +0,0 @@
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 => 20130107214625) do
15
-
16
- create_table "agreement_item_types", :force => true do |t|
17
- t.integer "parent_id"
18
- t.integer "lft"
19
- t.integer "rgt"
20
- t.string "description"
21
- t.string "comments"
22
- t.string "internal_identifier"
23
- t.string "external_identifier"
24
- t.string "external_id_source"
25
- t.datetime "created_at", :null => false
26
- t.datetime "updated_at", :null => false
27
- end
28
-
29
- add_index "agreement_item_types", ["parent_id"], :name => "index_agreement_item_types_on_parent_id"
30
-
31
- create_table "agreement_items", :force => true do |t|
32
- t.integer "agreement_id"
33
- t.integer "agreement_item_type_id"
34
- t.string "agreement_item_value"
35
- t.string "description"
36
- t.string "agreement_item_rule_string"
37
- t.datetime "created_at", :null => false
38
- t.datetime "updated_at", :null => false
39
- end
40
-
41
- add_index "agreement_items", ["agreement_id"], :name => "index_agreement_items_on_agreement_id"
42
- add_index "agreement_items", ["agreement_item_type_id"], :name => "index_agreement_items_on_agreement_item_type_id"
43
-
44
- create_table "agreement_party_roles", :force => true do |t|
45
- t.string "description"
46
- t.integer "agreement_id"
47
- t.integer "party_id"
48
- t.integer "role_type_id"
49
- t.string "external_identifier"
50
- t.string "external_id_source"
51
- t.datetime "created_at", :null => false
52
- t.datetime "updated_at", :null => false
53
- end
54
-
55
- add_index "agreement_party_roles", ["agreement_id"], :name => "index_agreement_party_roles_on_agreement_id"
56
- add_index "agreement_party_roles", ["party_id"], :name => "index_agreement_party_roles_on_party_id"
57
- add_index "agreement_party_roles", ["role_type_id"], :name => "index_agreement_party_roles_on_role_type_id"
58
-
59
- create_table "agreement_relationships", :force => true do |t|
60
- t.integer "agreement_reln_type_id"
61
- t.string "description"
62
- t.integer "agreement_id_from"
63
- t.integer "agreement_id_to"
64
- t.integer "role_type_id_from"
65
- t.integer "role_type_id_to"
66
- t.integer "status_type_id"
67
- t.date "from_date"
68
- t.date "thru_date"
69
- t.datetime "created_at", :null => false
70
- t.datetime "updated_at", :null => false
71
- end
72
-
73
- add_index "agreement_relationships", ["agreement_reln_type_id"], :name => "index_agreement_relationships_on_agreement_reln_type_id"
74
- add_index "agreement_relationships", ["status_type_id"], :name => "index_agreement_relationships_on_status_type_id"
75
-
76
- create_table "agreement_reln_types", :force => true do |t|
77
- t.integer "parent_id"
78
- t.integer "lft"
79
- t.integer "rgt"
80
- t.integer "valid_from_role_type_id"
81
- t.integer "valid_to_role_type_id"
82
- t.string "name"
83
- t.string "description"
84
- t.string "internal_identifier"
85
- t.string "external_identifier"
86
- t.string "external_id_source"
87
- t.datetime "created_at", :null => false
88
- t.datetime "updated_at", :null => false
89
- end
90
-
91
- add_index "agreement_reln_types", ["parent_id"], :name => "index_agreement_reln_types_on_parent_id"
92
- add_index "agreement_reln_types", ["valid_from_role_type_id"], :name => "index_agreement_reln_types_on_valid_from_role_type_id"
93
- add_index "agreement_reln_types", ["valid_to_role_type_id"], :name => "index_agreement_reln_types_on_valid_to_role_type_id"
94
-
95
- create_table "agreement_role_types", :force => true do |t|
96
- t.integer "parent_id"
97
- t.integer "lft"
98
- t.integer "rgt"
99
- t.string "description"
100
- t.string "comments"
101
- t.string "internal_identifier"
102
- t.string "external_identifier"
103
- t.string "external_id_source"
104
- t.datetime "created_at", :null => false
105
- t.datetime "updated_at", :null => false
106
- end
107
-
108
- add_index "agreement_role_types", ["parent_id"], :name => "index_agreement_role_types_on_parent_id"
109
-
110
- create_table "agreement_types", :force => true do |t|
111
- t.integer "parent_id"
112
- t.integer "lft"
113
- t.integer "rgt"
114
- t.string "description"
115
- t.string "comments"
116
- t.string "internal_identifier"
117
- t.string "external_identifier"
118
- t.string "external_id_source"
119
- t.datetime "created_at", :null => false
120
- t.datetime "updated_at", :null => false
121
- end
122
-
123
- add_index "agreement_types", ["parent_id"], :name => "index_agreement_types_on_parent_id"
124
-
125
- create_table "agreements", :force => true do |t|
126
- t.string "description"
127
- t.integer "agreement_type_id"
128
- t.string "agreement_status"
129
- t.integer "product_id"
130
- t.date "agreement_date"
131
- t.date "from_date"
132
- t.date "thru_date"
133
- t.string "external_identifier"
134
- t.string "external_id_source"
135
- t.datetime "created_at", :null => false
136
- t.datetime "updated_at", :null => false
137
- end
138
-
139
- add_index "agreements", ["agreement_type_id"], :name => "index_agreements_on_agreement_type_id"
140
- add_index "agreements", ["product_id"], :name => "index_agreements_on_product_id"
141
-
142
- create_table "attribute_types", :force => true do |t|
143
- t.string "internal_identifier"
144
- t.string "description"
145
- t.string "data_type"
146
- t.datetime "created_at", :null => false
147
- t.datetime "updated_at", :null => false
148
- end
149
-
150
- add_index "attribute_types", ["internal_identifier"], :name => ":attribute_types_iid_idx"
151
-
152
- create_table "attribute_values", :force => true do |t|
153
- t.integer "attributed_record_id"
154
- t.string "attributed_record_type"
155
- t.integer "attribute_type_id"
156
- t.string "value"
157
- t.datetime "created_at", :null => false
158
- t.datetime "updated_at", :null => false
159
- end
160
-
161
- add_index "attribute_values", ["attribute_type_id"], :name => "attribute_values_attributed_type_idx"
162
- add_index "attribute_values", ["attributed_record_id", "attributed_record_type"], :name => "attribute_values_attributed_record_idx"
163
- add_index "attribute_values", ["value"], :name => "attribute_values_value_idx"
164
-
165
- create_table "audit_log_item_types", :force => true do |t|
166
- t.string "internal_identifier"
167
- t.string "external_identifier"
168
- t.string "external_id_source"
169
- t.string "description"
170
- t.string "comments"
171
- t.integer "parent_id"
172
- t.integer "lft"
173
- t.integer "rgt"
174
- t.datetime "created_at", :null => false
175
- t.datetime "updated_at", :null => false
176
- end
177
-
178
- create_table "audit_log_items", :force => true do |t|
179
- t.integer "audit_log_id"
180
- t.integer "audit_log_item_type_id"
181
- t.string "audit_log_item_value"
182
- t.string "description"
183
- t.datetime "created_at", :null => false
184
- t.datetime "updated_at", :null => false
185
- end
186
-
187
- create_table "audit_log_types", :force => true do |t|
188
- t.string "description"
189
- t.string "error_code"
190
- t.string "comments"
191
- t.string "internal_identifier"
192
- t.string "external_identifier"
193
- t.string "external_id_source"
194
- t.integer "parent_id"
195
- t.integer "lft"
196
- t.integer "rgt"
197
- t.datetime "created_at", :null => false
198
- t.datetime "updated_at", :null => false
199
- end
200
-
201
- create_table "audit_logs", :force => true do |t|
202
- t.string "application"
203
- t.string "description"
204
- t.integer "party_id"
205
- t.text "additional_info"
206
- t.integer "audit_log_type_id"
207
- t.integer "event_record_id"
208
- t.string "event_record_type"
209
- t.datetime "created_at", :null => false
210
- t.datetime "updated_at", :null => false
211
- end
212
-
213
- add_index "audit_logs", ["event_record_id", "event_record_type"], :name => "event_record_index"
214
- add_index "audit_logs", ["party_id"], :name => "index_audit_logs_on_party_id"
215
-
216
- create_table "capabilities", :force => true do |t|
217
- t.string "description"
218
- t.integer "capability_type_id"
219
- t.string "capability_resource_type"
220
- t.integer "capability_resource_id"
221
- t.integer "scope_type_id"
222
- t.text "scope_query"
223
- t.datetime "created_at", :null => false
224
- t.datetime "updated_at", :null => false
225
- end
226
-
227
- add_index "capabilities", ["capability_resource_id", "capability_resource_type"], :name => "capability_resource_index"
228
- add_index "capabilities", ["capability_type_id"], :name => "index_capabilities_on_capability_type_id"
229
- add_index "capabilities", ["scope_type_id"], :name => "index_capabilities_on_scope_type_id"
230
-
231
- create_table "capability_accessors", :force => true do |t|
232
- t.string "capability_accessor_record_type"
233
- t.integer "capability_accessor_record_id"
234
- t.integer "capability_id"
235
- t.datetime "created_at", :null => false
236
- t.datetime "updated_at", :null => false
237
- end
238
-
239
- add_index "capability_accessors", ["capability_accessor_record_id", "capability_accessor_record_type"], :name => "capability_accessor_record_index"
240
- add_index "capability_accessors", ["capability_id"], :name => "index_capability_accessors_on_capability_id"
241
-
242
- create_table "capability_types", :force => true do |t|
243
- t.string "internal_identifier"
244
- t.string "description"
245
- t.datetime "created_at", :null => false
246
- t.datetime "updated_at", :null => false
247
- end
248
-
249
- create_table "capable_models", :force => true do |t|
250
- t.integer "capable_model_record_id"
251
- t.string "capable_model_record_type"
252
- t.datetime "created_at", :null => false
253
- t.datetime "updated_at", :null => false
254
- end
255
-
256
- add_index "capable_models", ["capable_model_record_id", "capable_model_record_type"], :name => "capable_model_record_idx"
257
-
258
- create_table "categories", :force => true do |t|
259
- t.string "description"
260
- t.string "external_identifier"
261
- t.datetime "from_date"
262
- t.datetime "to_date"
263
- t.string "internal_identifier"
264
- t.integer "category_record_id"
265
- t.string "category_record_type"
266
- t.integer "parent_id"
267
- t.integer "lft"
268
- t.integer "rgt"
269
- t.datetime "created_at", :null => false
270
- t.datetime "updated_at", :null => false
271
- end
272
-
273
- add_index "categories", ["category_record_id", "category_record_type"], :name => "category_polymorphic"
274
-
275
- create_table "category_classifications", :force => true do |t|
276
- t.integer "category_id"
277
- t.string "classification_type"
278
- t.integer "classification_id"
279
- t.datetime "from_date"
280
- t.datetime "to_date"
281
- t.datetime "created_at", :null => false
282
- t.datetime "updated_at", :null => false
283
- end
284
-
285
- add_index "category_classifications", ["classification_id", "classification_type"], :name => "classification_polymorphic"
286
-
287
- create_table "compass_ae_instances", :force => true do |t|
288
- t.decimal "version", :precision => 8, :scale => 3
289
- t.datetime "created_at", :null => false
290
- t.datetime "updated_at", :null => false
291
- end
292
-
293
- create_table "contact_purposes", :force => true do |t|
294
- t.integer "parent_id"
295
- t.integer "lft"
296
- t.integer "rgt"
297
- t.string "description"
298
- t.string "comments"
299
- t.string "internal_identifier"
300
- t.string "external_identifier"
301
- t.string "external_id_source"
302
- t.datetime "created_at", :null => false
303
- t.datetime "updated_at", :null => false
304
- end
305
-
306
- add_index "contact_purposes", ["parent_id"], :name => "index_contact_purposes_on_parent_id"
307
-
308
- create_table "contact_purposes_contacts", :id => false, :force => true do |t|
309
- t.integer "contact_id"
310
- t.integer "contact_purpose_id"
311
- end
312
-
313
- add_index "contact_purposes_contacts", ["contact_id", "contact_purpose_id"], :name => "contact_purposes_contacts_index"
314
-
315
- create_table "contact_types", :force => true do |t|
316
- t.integer "parent_id"
317
- t.integer "lft"
318
- t.integer "rgt"
319
- t.string "description"
320
- t.string "comments"
321
- t.string "internal_identifier"
322
- t.string "external_identifier"
323
- t.string "external_id_source"
324
- t.datetime "created_at", :null => false
325
- t.datetime "updated_at", :null => false
326
- end
327
-
328
- add_index "contact_types", ["parent_id"], :name => "index_contact_types_on_parent_id"
329
-
330
- create_table "contacts", :force => true do |t|
331
- t.integer "party_id"
332
- t.integer "contact_mechanism_id"
333
- t.string "contact_mechanism_type"
334
- t.string "external_identifier"
335
- t.string "external_id_source"
336
- t.datetime "created_at", :null => false
337
- t.datetime "updated_at", :null => false
338
- end
339
-
340
- add_index "contacts", ["contact_mechanism_id", "contact_mechanism_type"], :name => "besi_2"
341
- add_index "contacts", ["party_id"], :name => "index_contacts_on_party_id"
342
-
343
- create_table "currencies", :force => true do |t|
344
- t.string "name"
345
- t.string "definition"
346
- t.string "internal_identifier"
347
- t.string "numeric_code"
348
- t.string "major_unit_symbol"
349
- t.string "minor_unit_symbol"
350
- t.string "ratio_of_minor_unit_to_major_unit"
351
- t.string "postfix_label"
352
- t.datetime "introduction_date"
353
- t.datetime "expiration_date"
354
- t.datetime "created_at", :null => false
355
- t.datetime "updated_at", :null => false
356
- end
357
-
358
- add_index "currencies", ["internal_identifier"], :name => "index_currencies_on_internal_identifier"
359
-
360
- create_table "delayed_jobs", :force => true do |t|
361
- t.integer "priority", :default => 0
362
- t.integer "attempts", :default => 0
363
- t.text "handler"
364
- t.text "last_error"
365
- t.datetime "run_at"
366
- t.datetime "locked_at"
367
- t.datetime "failed_at"
368
- t.string "locked_by"
369
- t.string "queue"
370
- t.datetime "created_at", :null => false
371
- t.datetime "updated_at", :null => false
372
- end
373
-
374
- add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
375
-
376
- create_table "descriptive_assets", :force => true do |t|
377
- t.integer "view_type_id"
378
- t.string "internal_identifier"
379
- t.text "description"
380
- t.string "external_identifier"
381
- t.string "external_id_source"
382
- t.integer "described_record_id"
383
- t.string "described_record_type"
384
- t.datetime "created_at", :null => false
385
- t.datetime "updated_at", :null => false
386
- end
387
-
388
- add_index "descriptive_assets", ["described_record_id", "described_record_type"], :name => "described_record_idx"
389
- add_index "descriptive_assets", ["view_type_id"], :name => "index_descriptive_assets_on_view_type_id"
390
-
391
- create_table "email_addresses", :force => true do |t|
392
- t.string "email_address"
393
- t.string "description"
394
- t.datetime "created_at", :null => false
395
- t.datetime "updated_at", :null => false
396
- end
397
-
398
- create_table "file_assets", :force => true do |t|
399
- t.integer "file_asset_holder_id"
400
- t.string "file_asset_holder_type"
401
- t.string "type"
402
- t.string "name"
403
- t.string "directory"
404
- t.string "data_file_name"
405
- t.string "data_content_type"
406
- t.integer "data_file_size"
407
- t.datetime "data_updated_at"
408
- t.string "width"
409
- t.string "height"
410
- t.datetime "created_at", :null => false
411
- t.datetime "updated_at", :null => false
412
- end
413
-
414
- add_index "file_assets", ["directory"], :name => "index_file_assets_on_directory"
415
- add_index "file_assets", ["file_asset_holder_id", "file_asset_holder_type"], :name => "file_asset_holder_idx"
416
- add_index "file_assets", ["name"], :name => "index_file_assets_on_name"
417
- add_index "file_assets", ["type"], :name => "index_file_assets_on_type"
418
-
419
- create_table "geo_countries", :force => true do |t|
420
- t.string "name"
421
- t.string "iso_code_2"
422
- t.string "iso_code_3"
423
- t.boolean "display", :default => true
424
- t.integer "external_id"
425
- t.datetime "created_at"
426
- end
427
-
428
- add_index "geo_countries", ["iso_code_2"], :name => "index_geo_countries_on_iso_code_2"
429
- add_index "geo_countries", ["name"], :name => "index_geo_countries_on_name"
430
-
431
- create_table "geo_zones", :force => true do |t|
432
- t.integer "geo_country_id"
433
- t.string "zone_code", :default => "2"
434
- t.string "zone_name"
435
- t.datetime "created_at"
436
- end
437
-
438
- add_index "geo_zones", ["geo_country_id"], :name => "index_geo_zones_on_geo_country_id"
439
- add_index "geo_zones", ["zone_code"], :name => "index_geo_zones_on_zone_code"
440
- add_index "geo_zones", ["zone_name"], :name => "index_geo_zones_on_zone_name"
441
-
442
- create_table "groups", :force => true do |t|
443
- t.string "description"
444
- t.datetime "created_at", :null => false
445
- t.datetime "updated_at", :null => false
446
- end
447
-
448
- create_table "individuals", :force => true do |t|
449
- t.integer "party_id"
450
- t.string "current_last_name"
451
- t.string "current_first_name"
452
- t.string "current_middle_name"
453
- t.string "current_personal_title"
454
- t.string "current_suffix"
455
- t.string "current_nickname"
456
- t.string "gender", :limit => 1
457
- t.date "birth_date"
458
- t.decimal "height", :precision => 5, :scale => 2
459
- t.integer "weight"
460
- t.string "mothers_maiden_name"
461
- t.string "marital_status", :limit => 1
462
- t.string "social_security_number"
463
- t.integer "current_passport_number"
464
- t.date "current_passport_expire_date"
465
- t.integer "total_years_work_experience"
466
- t.string "comments"
467
- t.string "encrypted_ssn"
468
- t.string "temp_ssn"
469
- t.string "salt"
470
- t.string "ssn_last_four"
471
- t.datetime "created_at", :null => false
472
- t.datetime "updated_at", :null => false
473
- end
474
-
475
- add_index "individuals", ["party_id"], :name => "index_individuals_on_party_id"
476
-
477
- create_table "loyalty_program_codes", :force => true do |t|
478
- t.string "identifier"
479
- t.string "name"
480
- t.string "description"
481
- t.datetime "created_at", :null => false
482
- t.datetime "updated_at", :null => false
483
- end
484
-
485
- create_table "money", :force => true do |t|
486
- t.string "description"
487
- t.decimal "amount", :precision => 8, :scale => 2
488
- t.integer "currency_id"
489
- t.datetime "created_at", :null => false
490
- t.datetime "updated_at", :null => false
491
- end
492
-
493
- add_index "money", ["currency_id"], :name => "index_money_on_currency_id"
494
-
495
- create_table "note_types", :force => true do |t|
496
- t.integer "parent_id"
497
- t.integer "lft"
498
- t.integer "rgt"
499
- t.string "description"
500
- t.string "internal_identifier"
501
- t.string "external_identifier"
502
- t.integer "note_type_record_id"
503
- t.string "note_type_record_type"
504
- t.datetime "created_at", :null => false
505
- t.datetime "updated_at", :null => false
506
- end
507
-
508
- add_index "note_types", ["note_type_record_id", "note_type_record_type"], :name => "note_type_record_idx"
509
-
510
- create_table "notes", :force => true do |t|
511
- t.integer "created_by_id"
512
- t.text "content"
513
- t.integer "noted_record_id"
514
- t.string "noted_record_type"
515
- t.integer "note_type_id"
516
- t.datetime "created_at", :null => false
517
- t.datetime "updated_at", :null => false
518
- end
519
-
520
- add_index "notes", ["created_by_id"], :name => "index_notes_on_created_by_id"
521
- add_index "notes", ["note_type_id"], :name => "index_notes_on_note_type_id"
522
- add_index "notes", ["noted_record_id", "noted_record_type"], :name => "index_notes_on_noted_record_id_and_noted_record_type"
523
-
524
- create_table "organizations", :force => true do |t|
525
- t.string "description"
526
- t.string "tax_id_number"
527
- t.datetime "created_at", :null => false
528
- t.datetime "updated_at", :null => false
529
- end
530
-
531
- create_table "parties", :force => true do |t|
532
- t.string "description"
533
- t.integer "business_party_id"
534
- t.string "business_party_type"
535
- t.integer "list_view_image_id"
536
- t.string "enterprise_identifier"
537
- t.datetime "created_at", :null => false
538
- t.datetime "updated_at", :null => false
539
- end
540
-
541
- add_index "parties", ["business_party_id", "business_party_type"], :name => "besi_1"
542
-
543
- create_table "parties_security_roles", :id => false, :force => true do |t|
544
- t.integer "party_id"
545
- t.integer "security_role_id"
546
- end
547
-
548
- add_index "parties_security_roles", ["party_id"], :name => "index_parties_security_roles_on_party_id"
549
- add_index "parties_security_roles", ["security_role_id"], :name => "index_parties_security_roles_on_security_role_id"
550
-
551
- create_table "party_relationships", :force => true do |t|
552
- t.string "description"
553
- t.integer "party_id_from"
554
- t.integer "party_id_to"
555
- t.integer "role_type_id_from"
556
- t.integer "role_type_id_to"
557
- t.integer "status_type_id"
558
- t.integer "priority_type_id"
559
- t.integer "relationship_type_id"
560
- t.date "from_date"
561
- t.date "thru_date"
562
- t.string "external_identifier"
563
- t.string "external_id_source"
564
- t.datetime "created_at", :null => false
565
- t.datetime "updated_at", :null => false
566
- end
567
-
568
- add_index "party_relationships", ["priority_type_id"], :name => "index_party_relationships_on_priority_type_id"
569
- add_index "party_relationships", ["relationship_type_id"], :name => "index_party_relationships_on_relationship_type_id"
570
- add_index "party_relationships", ["status_type_id"], :name => "index_party_relationships_on_status_type_id"
571
-
572
- create_table "party_roles", :force => true do |t|
573
- t.string "type"
574
- t.integer "party_id"
575
- t.integer "role_type_id"
576
- t.datetime "created_at", :null => false
577
- t.datetime "updated_at", :null => false
578
- end
579
-
580
- add_index "party_roles", ["party_id"], :name => "index_party_roles_on_party_id"
581
- add_index "party_roles", ["role_type_id"], :name => "index_party_roles_on_role_type_id"
582
-
583
- create_table "party_search_facts", :force => true do |t|
584
- t.integer "party_id"
585
- t.string "eid"
586
- t.string "type"
587
- t.text "roles"
588
- t.string "party_description"
589
- t.string "party_business_party_type"
590
- t.string "user_login"
591
- t.string "individual_current_last_name"
592
- t.string "individual_current_first_name"
593
- t.string "individual_current_middle_name"
594
- t.string "individual_birth_date"
595
- t.string "individual_ssn"
596
- t.string "party_phone_number"
597
- t.string "party_email_address"
598
- t.string "party_address_1"
599
- t.string "party_address_2"
600
- t.string "party_primary_address_city"
601
- t.string "party_primary_address_state"
602
- t.string "party_primary_address_zip"
603
- t.string "party_primary_address_country"
604
- t.boolean "user_enabled"
605
- t.string "user_type"
606
- t.boolean "reindex"
607
- t.datetime "created_at", :null => false
608
- t.datetime "updated_at", :null => false
609
- end
610
-
611
- create_table "phone_numbers", :force => true do |t|
612
- t.string "phone_number"
613
- t.string "description"
614
- t.datetime "created_at", :null => false
615
- t.datetime "updated_at", :null => false
616
- end
617
-
618
- create_table "postal_addresses", :force => true do |t|
619
- t.string "address_line_1"
620
- t.string "address_line_2"
621
- t.string "city"
622
- t.string "state"
623
- t.string "zip"
624
- t.string "country"
625
- t.string "description"
626
- t.integer "geo_country_id"
627
- t.integer "geo_zone_id"
628
- t.datetime "created_at", :null => false
629
- t.datetime "updated_at", :null => false
630
- end
631
-
632
- add_index "postal_addresses", ["geo_country_id"], :name => "index_postal_addresses_on_geo_country_id"
633
- add_index "postal_addresses", ["geo_zone_id"], :name => "index_postal_addresses_on_geo_zone_id"
634
-
635
- create_table "relationship_types", :force => true do |t|
636
- t.integer "parent_id"
637
- t.integer "lft"
638
- t.integer "rgt"
639
- t.integer "valid_from_role_type_id"
640
- t.integer "valid_to_role_type_id"
641
- t.string "name"
642
- t.string "description"
643
- t.string "internal_identifier"
644
- t.string "external_identifier"
645
- t.string "external_id_source"
646
- t.datetime "created_at", :null => false
647
- t.datetime "updated_at", :null => false
648
- end
649
-
650
- add_index "relationship_types", ["valid_from_role_type_id"], :name => "index_relationship_types_on_valid_from_role_type_id"
651
- add_index "relationship_types", ["valid_to_role_type_id"], :name => "index_relationship_types_on_valid_to_role_type_id"
652
-
653
- create_table "role_types", :force => true do |t|
654
- t.integer "parent_id"
655
- t.integer "lft"
656
- t.integer "rgt"
657
- t.string "description"
658
- t.string "comments"
659
- t.string "internal_identifier"
660
- t.string "external_identifier"
661
- t.string "external_id_source"
662
- t.datetime "created_at", :null => false
663
- t.datetime "updated_at", :null => false
664
- end
665
-
666
- create_table "scope_types", :force => true do |t|
667
- t.string "description"
668
- t.string "internal_identifier"
669
- t.datetime "created_at", :null => false
670
- t.datetime "updated_at", :null => false
671
- end
672
-
673
- add_index "scope_types", ["internal_identifier"], :name => "index_scope_types_on_internal_identifier"
674
-
675
- create_table "security_roles", :force => true do |t|
676
- t.string "description"
677
- t.string "internal_identifier"
678
- t.string "external_identifier"
679
- t.string "external_id_source"
680
- t.datetime "created_at", :null => false
681
- t.datetime "updated_at", :null => false
682
- end
683
-
684
- create_table "sessions", :force => true do |t|
685
- t.string "session_id", :null => false
686
- t.text "data"
687
- t.datetime "created_at", :null => false
688
- t.datetime "updated_at", :null => false
689
- end
690
-
691
- add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
692
- add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
693
-
694
- create_table "users", :force => true do |t|
695
- t.string "username"
696
- t.string "email"
697
- t.integer "party_id"
698
- t.string "type"
699
- t.string "salt"
700
- t.string "crypted_password"
701
- t.datetime "last_login_at"
702
- t.datetime "last_logout_at"
703
- t.datetime "last_activity_at"
704
- t.integer "failed_logins_count", :default => 0
705
- t.datetime "lock_expires_at"
706
- t.string "remember_me_token"
707
- t.datetime "remember_me_token_expires_at"
708
- t.string "reset_password_token"
709
- t.datetime "reset_password_token_expires_at"
710
- t.datetime "reset_password_email_sent_at"
711
- t.string "activation_state"
712
- t.string "activation_token"
713
- t.datetime "activation_token_expires_at"
714
- t.string "security_question_1"
715
- t.string "security_answer_1"
716
- t.string "security_question_2"
717
- t.string "security_answer_2"
718
- t.datetime "created_at", :null => false
719
- t.datetime "updated_at", :null => false
720
- end
721
-
722
- add_index "users", ["activation_token"], :name => "index_users_on_activation_token"
723
- add_index "users", ["email"], :name => "index_users_on_email", :unique => true
724
- add_index "users", ["last_logout_at", "last_activity_at"], :name => "activity_idx"
725
- add_index "users", ["remember_me_token"], :name => "index_users_on_remember_me_token"
726
- add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token"
727
- add_index "users", ["username"], :name => "index_users_on_username", :unique => true
728
-
729
- create_table "valid_note_types", :force => true do |t|
730
- t.integer "valid_note_type_record_id"
731
- t.string "valid_note_type_record_type"
732
- t.integer "note_type_id"
733
- t.datetime "created_at", :null => false
734
- t.datetime "updated_at", :null => false
735
- end
736
-
737
- add_index "valid_note_types", ["note_type_id"], :name => "index_valid_note_types_on_note_type_id"
738
- add_index "valid_note_types", ["valid_note_type_record_id", "valid_note_type_record_type"], :name => "valid_note_type_record_idx"
739
-
740
- create_table "view_types", :force => true do |t|
741
- t.string "internal_identifier"
742
- t.string "description"
743
- t.datetime "created_at", :null => false
744
- t.datetime "updated_at", :null => false
745
- end
746
-
747
- end