erp_app 3.1.7 → 3.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/erp_app/version.rb +1 -1
- data/public/javascripts/erp_app/shared/file_upload/Ext.ux.panel.UploadPanel.js +1 -1
- data/spec/dummy/db/data_migrations/20130422163128_add_usd_currency.erp_base_erp_svcs.rb +12 -0
- data/spec/dummy/db/data_migrations/20130422163129_add_iso_codes.erp_base_erp_svcs.rb +19 -0
- data/spec/dummy/db/data_migrations/20130422163130_setup_compass_ae_instance.erp_base_erp_svcs.rb +21 -0
- data/spec/dummy/db/data_migrations/20130422163131_upgrade_compass_ae_instances_data.erp_base_erp_svcs.rb +19 -0
- data/spec/dummy/db/data_migrations/20130422163132_add_guid_to_instances.erp_base_erp_svcs.rb +10 -0
- data/spec/dummy/db/data_migrations/20130422163133_create_capability_scope_types.erp_tech_svcs.rb +15 -0
- data/spec/dummy/db/data_migrations/20130422163134_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +16 -0
- data/spec/dummy/db/data_migrations/20130422163135_setup_audit_log_types.erp_tech_svcs.rb +22 -0
- data/spec/dummy/db/data_migrations/20130422163136_create_group_relationship_and_role_types.erp_tech_svcs.rb +20 -0
- data/spec/dummy/db/data_migrations/20130422163137_note_capabilities.erp_tech_svcs.rb +24 -0
- data/spec/dummy/db/data_migrations/20130422163138_erp_app_setup.erp_app.rb +252 -0
- data/spec/dummy/db/data_migrations/20130422163139_update_preferences.erp_app.rb +53 -0
- data/spec/dummy/db/data_migrations/20130422163140_create_desktop_app_audit_log_viewer.erp_app.rb +24 -0
- data/spec/dummy/db/data_migrations/20130422163141_add_file_manager_application.erp_app.rb +32 -0
- data/spec/dummy/db/data_migrations/20130422163142_add_default_capabilities.erp_app.rb +23 -0
- data/spec/dummy/db/data_migrations/20130422163143_add_new_contact_widgets.erp_app.rb +42 -0
- data/spec/dummy/db/data_migrations/20130422163144_add_userinfo_widget.erp_app.rb +29 -0
- data/spec/dummy/db/data_migrations/20130422163145_create_party_and_role_type_for_communication_events.erp_app.rb +11 -0
- data/spec/dummy/db/data_migrations/20130422163146_create_user_management_mobile_application.erp_app.rb +17 -0
- data/spec/dummy/db/data_migrations/20130422163147_create_configuration_management_desktop_application.erp_app.rb +27 -0
- data/spec/dummy/db/data_migrations/20130422163148_create_job_tracker_desktop_application.erp_app.rb +23 -0
- data/spec/dummy/db/data_migrations/20130422163149_created_tracked_jobs.erp_app.rb +15 -0
- data/spec/dummy/db/data_migrations/20130422163150_upgrade_remove_system_mgmt_app.erp_app.rb +16 -0
- data/spec/dummy/db/data_migrations/20130422163151_create_security_management_desktop_application.erp_app.rb +29 -0
- data/spec/dummy/db/data_migrations/20130422163152_add_job_tracker_mobile_app.erp_app.rb +17 -0
- data/spec/dummy/db/migrate/20130422163121_base_erp_services.erp_base_erp_svcs.rb +486 -0
- data/spec/dummy/db/migrate/20130422163122_add_txn_status.erp_base_erp_svcs.rb +37 -0
- data/spec/dummy/db/migrate/20130422163123_upgrade_compass_ae_instances.erp_base_erp_svcs.rb +34 -0
- data/spec/dummy/db/migrate/20130422163124_add_uuid_compass_ae_instance.erp_base_erp_svcs.rb +17 -0
- data/spec/dummy/db/migrate/20130422163125_add_long_lat_to_address.erp_base_erp_svcs.rb +16 -0
- data/spec/dummy/db/migrate/20130422163126_base_tech_services.erp_tech_svcs.rb +271 -0
- data/spec/dummy/db/migrate/20130422163127_create_has_attribute_tables.erp_tech_svcs.rb +39 -0
- data/spec/dummy/db/migrate/20130422163128_create_groups.erp_tech_svcs.rb +19 -0
- data/spec/dummy/db/migrate/20130422163129_upgrade_security.erp_tech_svcs.rb +54 -0
- data/spec/dummy/db/migrate/20130422163130_upgrade_security2.erp_tech_svcs.rb +275 -0
- data/spec/dummy/db/migrate/20130422163131_add_queue_to_delayed_jobs.erp_tech_svcs.rb +14 -0
- data/spec/dummy/db/migrate/20130422163132_base_app_framework.erp_app.rb +276 -0
- data/spec/dummy/db/migrate/20130422163133_add_job_tracker.erp_app.rb +20 -0
- data/spec/dummy/db/migrate/20130422163134_update_mobile_application.erp_app.rb +28 -0
- data/spec/dummy/db/schema.rb +883 -0
- data/spec/dummy/db/spec.sqlite3 +0 -0
- data/spec/dummy/log/adam.log +1 -0
- data/spec/dummy/log/spec.log +113709 -0
- metadata +89 -3
@@ -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,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,276 @@
|
|
1
|
+
# This migration comes from erp_app (originally 20080805000096)
|
2
|
+
class BaseAppFramework < ActiveRecord::Migration
|
3
|
+
def self.up
|
4
|
+
|
5
|
+
unless table_exists?(:preferences)
|
6
|
+
create_table :preferences do |t|
|
7
|
+
t.references :preference_option
|
8
|
+
t.references :preference_type
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
add_index :preferences, :preference_option_id
|
13
|
+
add_index :preferences, :preference_type_id
|
14
|
+
end
|
15
|
+
|
16
|
+
unless table_exists?(:preference_types)
|
17
|
+
create_table :preference_types do |t|
|
18
|
+
t.string :description
|
19
|
+
t.string :internal_identifier
|
20
|
+
t.integer :default_pref_option_id
|
21
|
+
|
22
|
+
t.timestamps
|
23
|
+
end
|
24
|
+
|
25
|
+
add_index :preference_types, :default_pref_option_id
|
26
|
+
end
|
27
|
+
|
28
|
+
unless table_exists?(:preference_options)
|
29
|
+
create_table :preference_options do |t|
|
30
|
+
t.string :description
|
31
|
+
t.string :internal_identifier
|
32
|
+
t.string :value
|
33
|
+
|
34
|
+
t.timestamps
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
unless table_exists?(:preference_options_preference_types)
|
39
|
+
create_table :preference_options_preference_types, {:id => false} do |t|
|
40
|
+
t.references :preference_type
|
41
|
+
t.references :preference_option
|
42
|
+
end
|
43
|
+
|
44
|
+
add_index :preference_options_preference_types, :preference_type_id, :name => 'pref_opt_pref_type_pref_type_id_idx'
|
45
|
+
add_index :preference_options_preference_types, :preference_option_id, :name => 'pref_opt_pref_type_pref_opt_id_idx'
|
46
|
+
end
|
47
|
+
|
48
|
+
unless table_exists?(:valid_preference_types)
|
49
|
+
create_table :valid_preference_types do |t|
|
50
|
+
t.references :preference_type
|
51
|
+
t.references :preferenced_record, :polymorphic => true
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
unless table_exists?(:user_preferences)
|
56
|
+
create_table :user_preferences do |t|
|
57
|
+
t.references :user
|
58
|
+
t.references :preference
|
59
|
+
|
60
|
+
t.references :preferenced_record, :polymorphic => true
|
61
|
+
|
62
|
+
t.timestamps
|
63
|
+
end
|
64
|
+
add_index :user_preferences, :user_id
|
65
|
+
add_index :user_preferences, :preference_id
|
66
|
+
add_index :user_preferences, :preferenced_record_id
|
67
|
+
add_index :user_preferences, :preferenced_record_type
|
68
|
+
end
|
69
|
+
|
70
|
+
unless table_exists?(:app_containers)
|
71
|
+
create_table :app_containers do |t|
|
72
|
+
t.references :user
|
73
|
+
t.string :description
|
74
|
+
t.string :internal_identifier
|
75
|
+
t.string :type
|
76
|
+
|
77
|
+
t.timestamps
|
78
|
+
end
|
79
|
+
add_index :app_containers, :user_id
|
80
|
+
add_index :app_containers, :type
|
81
|
+
end
|
82
|
+
|
83
|
+
unless table_exists?(:applications)
|
84
|
+
create_table :applications do |t|
|
85
|
+
t.column :description, :string
|
86
|
+
t.column :icon, :string
|
87
|
+
t.column :internal_identifier, :string
|
88
|
+
t.column :javascript_class_name, :string
|
89
|
+
t.column :shortcut_id, :string
|
90
|
+
t.column :base_url, :string
|
91
|
+
t.column :type, :string
|
92
|
+
|
93
|
+
t.timestamps
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
unless table_exists?(:app_containers_applications)
|
98
|
+
create_table :app_containers_applications, {:id => false} do |t|
|
99
|
+
t.column :app_container_id, :integer
|
100
|
+
t.column :application_id, :integer
|
101
|
+
end
|
102
|
+
|
103
|
+
add_index :app_containers_applications, :application_id
|
104
|
+
add_index :app_containers_applications, :app_container_id
|
105
|
+
end
|
106
|
+
|
107
|
+
unless table_exists?(:widgets)
|
108
|
+
create_table :widgets do |t|
|
109
|
+
t.column :description, :string
|
110
|
+
t.column :internal_identifier, :string
|
111
|
+
t.column :icon, :string
|
112
|
+
t.column :xtype, :string
|
113
|
+
|
114
|
+
t.timestamps
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
unless table_exists?(:applications_widgets)
|
119
|
+
create_table :applications_widgets, {:id => false} do |t|
|
120
|
+
t.column :application_id, :integer
|
121
|
+
t.column :widget_id, :integer
|
122
|
+
end
|
123
|
+
add_index :applications_widgets, :application_id
|
124
|
+
add_index :applications_widgets, :widget_id
|
125
|
+
end
|
126
|
+
|
127
|
+
unless table_exists?(:tree_menu_node_defs)
|
128
|
+
create_table :tree_menu_node_defs do |t|
|
129
|
+
t.string :node_type
|
130
|
+
t.integer :parent_id
|
131
|
+
t.integer :lft
|
132
|
+
t.integer :rgt
|
133
|
+
t.string :menu_short_name
|
134
|
+
t.string :menu_description
|
135
|
+
t.string :text
|
136
|
+
t.string :icon_url
|
137
|
+
t.string :target_url
|
138
|
+
t.string :resource_class
|
139
|
+
t.timestamps
|
140
|
+
end
|
141
|
+
add_index :tree_menu_node_defs, :parent_id
|
142
|
+
end
|
143
|
+
|
144
|
+
unless table_exists? :configurations
|
145
|
+
create_table :configurations do |t|
|
146
|
+
#custom columns go here
|
147
|
+
t.string :description
|
148
|
+
t.string :internal_identifier
|
149
|
+
t.boolean :active
|
150
|
+
t.boolean :is_template, :default => false
|
151
|
+
|
152
|
+
t.timestamps
|
153
|
+
end
|
154
|
+
|
155
|
+
add_index :configurations, :is_template
|
156
|
+
end
|
157
|
+
|
158
|
+
unless table_exists? :valid_configurations
|
159
|
+
create_table :valid_configurations do |t|
|
160
|
+
#foreign keys
|
161
|
+
t.references :configured_item, :polymorphic => true
|
162
|
+
t.references :configuration
|
163
|
+
|
164
|
+
t.timestamps
|
165
|
+
end
|
166
|
+
|
167
|
+
add_index :valid_configurations, [:configured_item_id, :configured_item_type], :name => 'configured_item_poly_idx'
|
168
|
+
add_index :valid_configurations, :configuration_id
|
169
|
+
end
|
170
|
+
|
171
|
+
unless table_exists? :configuration_items
|
172
|
+
create_table :configuration_items do |t|
|
173
|
+
#foreign keys
|
174
|
+
t.references :configuration
|
175
|
+
t.references :configuration_item_type
|
176
|
+
t.references :configuration_option
|
177
|
+
|
178
|
+
t.timestamps
|
179
|
+
end
|
180
|
+
|
181
|
+
add_index :configuration_items, :configuration_id
|
182
|
+
add_index :configuration_items, :configuration_item_type_id
|
183
|
+
add_index :configuration_items, :configuration_option_id
|
184
|
+
end
|
185
|
+
|
186
|
+
unless table_exists? :configuration_item_types
|
187
|
+
create_table :configuration_item_types do |t|
|
188
|
+
#awesome nested set columns
|
189
|
+
t.integer :parent_id
|
190
|
+
t.integer :lft
|
191
|
+
t.integer :rgt
|
192
|
+
|
193
|
+
#custom columns go here
|
194
|
+
t.string :description
|
195
|
+
t.string :internal_identifier
|
196
|
+
t.boolean :allow_user_defined_options, :default => false
|
197
|
+
t.boolean :is_multi_optional, :default => false
|
198
|
+
|
199
|
+
t.timestamps
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
unless table_exists?(:configuration_item_types_configurations)
|
204
|
+
create_table :configuration_item_types_configurations, {:id => false} do |t|
|
205
|
+
t.references :configuration_item_type
|
206
|
+
t.references :configuration
|
207
|
+
end
|
208
|
+
|
209
|
+
add_index :configuration_item_types_configurations, :configuration_item_type_id, :name => 'conf_conf_type_id_item_idx'
|
210
|
+
add_index :configuration_item_types_configurations, :configuration_id, :name => 'conf_id_idx'
|
211
|
+
add_index :configuration_item_types_configurations, [:configuration_item_type_id, :configuration_id], :unique => true, :name => 'conf_config_type_uniq_idx'
|
212
|
+
end
|
213
|
+
|
214
|
+
unless table_exists? :configuration_options
|
215
|
+
create_table :configuration_options do |t|
|
216
|
+
#custom columns go here
|
217
|
+
t.string :description
|
218
|
+
t.string :internal_identifier
|
219
|
+
t.string :value
|
220
|
+
t.text :comment
|
221
|
+
t.boolean :user_defined, :default => false
|
222
|
+
|
223
|
+
t.timestamps
|
224
|
+
end
|
225
|
+
|
226
|
+
add_index :configuration_options, :value
|
227
|
+
add_index :configuration_options, :internal_identifier
|
228
|
+
add_index :configuration_options, :user_defined
|
229
|
+
end
|
230
|
+
|
231
|
+
unless table_exists?(:configuration_item_types_configuration_options)
|
232
|
+
create_table :configuration_item_types_configuration_options do |t|
|
233
|
+
t.references :configuration_item_type
|
234
|
+
t.references :configuration_option
|
235
|
+
t.boolean :is_default, :default => false
|
236
|
+
|
237
|
+
t.timestamps
|
238
|
+
end
|
239
|
+
|
240
|
+
add_index :configuration_item_types_configuration_options, :configuration_item_type_id, :name => 'conf_item_type_conf_opt_id_item_idx'
|
241
|
+
add_index :configuration_item_types_configuration_options, :configuration_option_id, :name => 'conf_item_type_conf_opt_id_opt_idx'
|
242
|
+
end
|
243
|
+
|
244
|
+
unless table_exists?(:configuration_items_configuration_options)
|
245
|
+
create_table :configuration_items_configuration_options, {:id => false} do |t|
|
246
|
+
t.references :configuration_item
|
247
|
+
t.references :configuration_option
|
248
|
+
end
|
249
|
+
|
250
|
+
add_index :configuration_items_configuration_options, :configuration_item_id, :name => 'conf_item_conf_opt_id_item_idx'
|
251
|
+
add_index :configuration_items_configuration_options, :configuration_option_id, :name => 'conf_item_conf_opt_id_opt_idx'
|
252
|
+
end
|
253
|
+
|
254
|
+
end
|
255
|
+
|
256
|
+
def self.down
|
257
|
+
[
|
258
|
+
:preferences, :preference_types,
|
259
|
+
:preference_options, :preference_options_preference_types,
|
260
|
+
:valid_preference_types, :user_preferences,
|
261
|
+
:app_containers, :app_containers_applications,
|
262
|
+
:applications_widgets, :widgets, :tree_menu_node_defs,
|
263
|
+
:applications, :applications_desktops,
|
264
|
+
:configurations, :configuration_items,
|
265
|
+
:configuration_item_types, :configuration_options,
|
266
|
+
:configuration_item_types_configuration_options,
|
267
|
+
:configuration_items_configuration_options, :configured_items,
|
268
|
+
:configuration_item_types_configurations
|
269
|
+
].each do |tbl|
|
270
|
+
if table_exists?(tbl)
|
271
|
+
drop_table(tbl)
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# This migration comes from erp_app (originally 20120920145259)
|
2
|
+
class AddJobTracker < ActiveRecord::Migration
|
3
|
+
def up
|
4
|
+
unless table_exists?(:job_trackers)
|
5
|
+
create_table :job_trackers do |t|
|
6
|
+
t.string :job_name
|
7
|
+
t.string :job_klass
|
8
|
+
t.string :run_time
|
9
|
+
t.datetime :last_run_at
|
10
|
+
t.datetime :next_run_at
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def down
|
16
|
+
if table_exists?(:job_trackers)
|
17
|
+
drop_table :job_trackers
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# This migration comes from erp_app (originally 20130410182333)
|
2
|
+
class UpdateMobileApplication < ActiveRecord::Migration
|
3
|
+
def up
|
4
|
+
unless columns(:applications).collect { |c| c.name }.include?('xtype')
|
5
|
+
rename_column :applications, :base_url, :xtype
|
6
|
+
|
7
|
+
user_management = MobileApplication.find_by_internal_identifier('user_management')
|
8
|
+
if user_management.nil?
|
9
|
+
MobileApplication.create(
|
10
|
+
:description => 'User Mgmt',
|
11
|
+
:icon => 'icon-user',
|
12
|
+
:internal_identifier => 'user_management',
|
13
|
+
:xtype => 'compass-erpapp-mobile-usermanagement-application'
|
14
|
+
)
|
15
|
+
else
|
16
|
+
user_management.description = 'User Mgmt'
|
17
|
+
user_management.xtype = 'compass-erpapp-mobile-usermanagement-application'
|
18
|
+
user_management.save
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def down
|
24
|
+
if columns(:applications).collect { |c| c.name }.include?('xtype')
|
25
|
+
rename_column :applications, :xtype, :base_url
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|