erp_tech_svcs 4.0.0 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -24
- data/app/controllers/api/v1/audit_log_items_controller.rb +33 -0
- data/app/controllers/api/v1/audit_logs_controller.rb +32 -0
- data/app/controllers/api/v1/capabilities_controller.rb +160 -0
- data/app/controllers/api/v1/file_assets_controller.rb +40 -0
- data/app/controllers/api/v1/groups_controller.rb +236 -0
- data/app/controllers/api/v1/security_roles_controller.rb +276 -0
- data/app/controllers/api/v1/users_controller.rb +262 -0
- data/app/controllers/erp_tech_svcs/session_controller.rb +8 -5
- data/app/controllers/erp_tech_svcs/user_controller.rb +14 -15
- data/app/mailers/user_mailer.rb +8 -5
- data/app/models/audit_log.rb +111 -36
- data/app/models/audit_log_item.rb +30 -0
- data/app/models/audit_log_item_type.rb +1 -0
- data/app/models/audit_log_type.rb +19 -0
- data/app/models/capability.rb +22 -6
- data/app/models/extensions/tracked_status_type.rb +3 -0
- data/app/models/file_asset.rb +245 -20
- data/app/models/file_asset_holder.rb +20 -0
- data/app/models/group.rb +38 -25
- data/app/models/notification.rb +32 -13
- data/app/models/notification_type.rb +13 -0
- data/app/models/security_role.rb +17 -4
- data/app/models/user.rb +116 -29
- data/app/validators/password_strength_validator.rb +1 -1
- data/app/views/user_mailer/activation_needed_email.html.erb +293 -15
- data/app/views/user_mailer/reset_password_email.html.erb +268 -13
- data/config/initializers/logger.rb +19 -0
- data/config/initializers/sorcery.rb +2 -0
- data/config/initializers/wickedpdf.rb +4 -0
- data/config/routes.rb +64 -0
- data/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.rb +1 -5
- data/db/data_migrations/20150819140550_create_job_tracker_for_notification.rb +14 -0
- data/db/migrate/20080805000010_base_tech_services.rb +99 -39
- data/db/migrate/20150414151421_add_nested_set_columns_to_security_role.rb +13 -0
- data/db/migrate/20150609003216_update_user_for_sorcery.rb +11 -0
- data/db/migrate/20150819135108_add_custom_fields_to_notifications.rb +5 -0
- data/db/migrate/20160122155402_add_description_to_file_asset.rb +13 -0
- data/db/migrate/20160310163060_add_created_by_updated_by_to_erp_tech_svcs.rb +35 -0
- data/db/migrate/20160313161611_add_tenant_id_to_audit_log.rb +16 -0
- data/lib/erp_tech_svcs.rb +6 -10
- data/lib/erp_tech_svcs/config.rb +7 -2
- data/lib/erp_tech_svcs/delayed_jobs/delete_expired_sessions_job.rb +49 -0
- data/lib/erp_tech_svcs/delayed_jobs/notification_job.rb +50 -0
- data/lib/erp_tech_svcs/engine.rb +0 -1
- data/lib/erp_tech_svcs/erp_tech_svcs_audit_log.rb +12 -6
- data/lib/erp_tech_svcs/extensions.rb +0 -1
- data/lib/erp_tech_svcs/extensions/active_record/has_capability_accessors.rb +57 -29
- data/lib/erp_tech_svcs/extensions/active_record/has_file_assets.rb +57 -31
- data/lib/erp_tech_svcs/extensions/active_record/has_security_roles.rb +12 -4
- data/lib/erp_tech_svcs/extensions/active_record/is_json.rb +22 -15
- data/lib/erp_tech_svcs/extensions/active_record/scoped_by.rb +16 -13
- data/lib/erp_tech_svcs/extensions/compass_ae/erp_base_erp_svcs/controllers/api/parties_controller.rb +15 -0
- data/lib/erp_tech_svcs/file_support.rb +1 -0
- data/lib/erp_tech_svcs/file_support/file_system_manager.rb +77 -44
- data/lib/erp_tech_svcs/file_support/manager.rb +12 -3
- data/lib/erp_tech_svcs/file_support/railties/compass_ae_resolver.rb +49 -0
- data/lib/erp_tech_svcs/file_support/s3_manager.rb +73 -51
- data/lib/erp_tech_svcs/utils/compass_access_negotiator.rb +11 -2
- data/lib/erp_tech_svcs/utils/default_nested_set_methods.rb +238 -46
- data/lib/erp_tech_svcs/version.rb +1 -1
- data/lib/tasks/erp_tech_svcs_tasks.rake +43 -5
- metadata +73 -42
- data/app/models/user_defined_data.rb +0 -6
- data/app/models/user_defined_field.rb +0 -8
- data/config/initializers/pdfkit.rb +0 -18
- data/db/data_migrations/20121130212146_note_capabilities.rb +0 -23
- data/db/migrate/20121116151510_create_groups.rb +0 -18
- data/db/migrate/20121126171612_upgrade_security.rb +0 -53
- data/db/migrate/20121126173506_upgrade_security2.rb +0 -274
- data/db/migrate/20130410135419_add_queue_to_delayed_jobs.rb +0 -13
- data/db/migrate/20130610163240_create_notifications.rb +0 -37
- data/db/migrate/20130725212647_add_party_id_idx_to_users.rb +0 -9
- data/db/migrate/20131113213843_add_audit_log_item_old_value.rb +0 -13
- data/db/migrate/20131113213844_add_erp_tech_svcs_missing_indexes.rb +0 -31
- data/db/migrate/20131129203603_add_user_defined_fields.rb +0 -43
- data/db/migrate/20141013060204_add_custom_fields_to_notifications.rb +0 -12
- data/db/migrate/20141108182427_add_scoped_by_to_file_assets.rb +0 -14
- data/lib/erp_tech_svcs/extensions/active_record/has_user_defined_data.rb +0 -147
- data/lib/erp_tech_svcs/sessions/delete_expired_sessions_job.rb +0 -47
- data/lib/erp_tech_svcs/sessions/delete_expired_sessions_service.rb +0 -15
- data/lib/erp_tech_svcs/utils/compass_logger.rb +0 -87
@@ -1,274 +0,0 @@
|
|
1
|
-
class UpgradeSecurity2 < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
if table_exists?(:secured_models)
|
4
|
-
Website.all.each do |w|
|
5
|
-
old_role_iid = "website_#{w.name.underscore.gsub("'","").gsub(",","")}_access"
|
6
|
-
|
7
|
-
r = SecurityRole.find_by_internal_identifier(old_role_iid)
|
8
|
-
unless r.nil?
|
9
|
-
r.internal_identifier = w.website_role_iid
|
10
|
-
r.save
|
11
|
-
end
|
12
|
-
end
|
13
|
-
instance = ScopeType.create(:description => 'Instance', :internal_identifier => 'instance')
|
14
|
-
class_scope_type = ScopeType.create(:description => 'Class', :internal_identifier => 'class')
|
15
|
-
ScopeType.create(:description => 'Query', :internal_identifier => 'query')
|
16
|
-
|
17
|
-
execute('BEGIN TRANSACTION')
|
18
|
-
puts "populating parties_security_roles"
|
19
|
-
sql =
|
20
|
-
"INSERT INTO parties_security_roles (
|
21
|
-
party_id,
|
22
|
-
security_role_id
|
23
|
-
)
|
24
|
-
SELECT
|
25
|
-
u.party_id AS party_id,
|
26
|
-
rsm.role_id AS security_role_id
|
27
|
-
FROM secured_models sm
|
28
|
-
JOIN roles_secured_models rsm ON sm.id=rsm.secured_model_id
|
29
|
-
JOIN users u ON sm.secured_record_id=u.id
|
30
|
-
WHERE sm.secured_record_type='User'"
|
31
|
-
|
32
|
-
execute(sql)
|
33
|
-
execute('COMMIT')
|
34
|
-
|
35
|
-
execute('BEGIN TRANSACTION')
|
36
|
-
puts "populating capabilities with secure File Assets"
|
37
|
-
sql =
|
38
|
-
"INSERT INTO capabilities (
|
39
|
-
capability_type_id,
|
40
|
-
capability_resource_type,
|
41
|
-
capability_resource_id,
|
42
|
-
scope_type_id
|
43
|
-
)
|
44
|
-
SELECT
|
45
|
-
c.capability_type_id AS capability_type_id,
|
46
|
-
'FileAsset' AS capability_resource_type,
|
47
|
-
cm.capable_model_record_id AS capability_resource_id,
|
48
|
-
#{instance.id} AS scope_type_id
|
49
|
-
FROM capable_models AS cm
|
50
|
-
JOIN capabilities_capable_models AS ccm ON ccm.capable_model_id = cm.id
|
51
|
-
JOIN capabilities AS c ON ccm.capability_id = c.id
|
52
|
-
JOIN secured_models AS sm ON sm.secured_record_id = c.id AND sm.secured_record_type = 'Capability'
|
53
|
-
JOIN roles_secured_models AS rsm ON rsm.secured_model_id = sm.id
|
54
|
-
JOIN security_roles AS r ON r.id = rsm.role_id
|
55
|
-
WHERE cm.capable_model_record_type = 'FileAsset'"
|
56
|
-
|
57
|
-
execute(sql)
|
58
|
-
execute('COMMIT')
|
59
|
-
|
60
|
-
view = CapabilityType.find_by_internal_identifier('view')
|
61
|
-
|
62
|
-
execute('BEGIN TRANSACTION')
|
63
|
-
puts "populating capabilities with secure Website Sections"
|
64
|
-
sql =
|
65
|
-
"INSERT INTO capabilities (
|
66
|
-
capability_type_id,
|
67
|
-
capability_resource_type,
|
68
|
-
capability_resource_id,
|
69
|
-
scope_type_id
|
70
|
-
)
|
71
|
-
SELECT
|
72
|
-
#{view.id} AS capability_type_id,
|
73
|
-
'WebsiteSection' AS capability_resource_type,
|
74
|
-
ws.id AS capability_resource_id,
|
75
|
-
#{instance.id} AS scope_type_id
|
76
|
-
FROM secured_models sm
|
77
|
-
JOIN roles_secured_models rsm ON sm.id=rsm.secured_model_id
|
78
|
-
JOIN website_sections ws ON sm.secured_record_id=ws.id
|
79
|
-
WHERE sm.secured_record_type='WebsiteSection'"
|
80
|
-
|
81
|
-
execute(sql)
|
82
|
-
execute('COMMIT')
|
83
|
-
|
84
|
-
execute('BEGIN TRANSACTION')
|
85
|
-
puts "populating capabilities with secure Website Nav Items"
|
86
|
-
sql =
|
87
|
-
"INSERT INTO capabilities (
|
88
|
-
capability_type_id,
|
89
|
-
capability_resource_type,
|
90
|
-
capability_resource_id,
|
91
|
-
scope_type_id
|
92
|
-
)
|
93
|
-
SELECT
|
94
|
-
#{view.id} AS capability_type_id,
|
95
|
-
'WebsiteNavItem' AS capability_resource_type,
|
96
|
-
ws.id AS capability_resource_id,
|
97
|
-
#{instance.id} AS scope_type_id
|
98
|
-
FROM secured_models sm
|
99
|
-
JOIN roles_secured_models rsm ON sm.id=rsm.secured_model_id
|
100
|
-
JOIN website_sections ws ON sm.secured_record_id=ws.id
|
101
|
-
WHERE sm.secured_record_type='WebsiteNavItem'"
|
102
|
-
|
103
|
-
execute(sql)
|
104
|
-
execute('COMMIT')
|
105
|
-
|
106
|
-
# delete obsolete records: Application, Widget, dupes?
|
107
|
-
Capability.where("capability_resource_type IS NULL").delete_all
|
108
|
-
|
109
|
-
admin = SecurityRole.find_by_internal_identifier('admin')
|
110
|
-
website_author = SecurityRole.find_by_internal_identifier('website_author')
|
111
|
-
layout_author = SecurityRole.find_by_internal_identifier('layout_author')
|
112
|
-
content_author = SecurityRole.find_by_internal_identifier('content_author')
|
113
|
-
designer = SecurityRole.find_by_internal_identifier('designer')
|
114
|
-
publisher = SecurityRole.find_by_internal_identifier('publisher')
|
115
|
-
|
116
|
-
# add instance capabilities to roles
|
117
|
-
instance_capabilities = Capability.where(:scope_type_id => instance.id).all
|
118
|
-
instance_capabilities.each do |c|
|
119
|
-
case c.capability_resource_type
|
120
|
-
when 'FileAsset'
|
121
|
-
admin.add_capability(c)
|
122
|
-
website_author.add_capability(c)
|
123
|
-
content_author.add_capability(c)
|
124
|
-
if c.capability_resource.file_asset_holder_type == 'Website'
|
125
|
-
website_role = c.capability_resource.file_asset_holder.role
|
126
|
-
website_role.add_capability(c)
|
127
|
-
end
|
128
|
-
when 'WebsiteSection'
|
129
|
-
admin.add_capability(c)
|
130
|
-
website_author.add_capability(c)
|
131
|
-
website_role = c.capability_resource.website.role
|
132
|
-
website_role.add_capability(c)
|
133
|
-
when 'WebsiteNavItem'
|
134
|
-
admin.add_capability(c)
|
135
|
-
website_author.add_capability(c)
|
136
|
-
website_role = c.capability_resource.website_nav.website.role
|
137
|
-
website_role.add_capability(c)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
# adding user mgmt capabilities to admin role
|
142
|
-
admin.add_capability('create', 'User')
|
143
|
-
admin.add_capability('delete', 'User')
|
144
|
-
admin.add_capability('edit', 'User')
|
145
|
-
|
146
|
-
# add knitkit class capabilities to roles
|
147
|
-
admin.add_capability('create', 'WebsiteNav')
|
148
|
-
admin.add_capability('delete', 'WebsiteNav')
|
149
|
-
admin.add_capability('edit', 'WebsiteNav')
|
150
|
-
|
151
|
-
website_author.add_capability('create', 'WebsiteNav')
|
152
|
-
website_author.add_capability('delete', 'WebsiteNav')
|
153
|
-
website_author.add_capability('edit', 'WebsiteNav')
|
154
|
-
|
155
|
-
admin.add_capability('create', 'Website')
|
156
|
-
admin.add_capability('delete', 'Website')
|
157
|
-
admin.add_capability('edit', 'Website')
|
158
|
-
admin.add_capability('import', 'Website')
|
159
|
-
admin.add_capability('publish', 'Website')
|
160
|
-
admin.add_capability('activate', 'Website')
|
161
|
-
|
162
|
-
website_author.add_capability('create', 'Website')
|
163
|
-
website_author.add_capability('delete', 'Website')
|
164
|
-
website_author.add_capability('edit', 'Website')
|
165
|
-
website_author.add_capability('import', 'Website')
|
166
|
-
publisher.add_capability('publish', 'Website')
|
167
|
-
publisher.add_capability('activate', 'Website')
|
168
|
-
|
169
|
-
admin.add_capability('create', 'WebsiteHost')
|
170
|
-
admin.add_capability('delete', 'WebsiteHost')
|
171
|
-
admin.add_capability('edit', 'WebsiteHost')
|
172
|
-
|
173
|
-
website_author.add_capability('create', 'WebsiteHost')
|
174
|
-
website_author.add_capability('delete', 'WebsiteHost')
|
175
|
-
website_author.add_capability('edit', 'WebsiteHost')
|
176
|
-
|
177
|
-
admin.add_capability('create', 'WebsiteSection')
|
178
|
-
admin.add_capability('delete', 'WebsiteSection')
|
179
|
-
admin.add_capability('edit', 'WebsiteSection')
|
180
|
-
admin.add_capability('secure', 'WebsiteSection')
|
181
|
-
admin.add_capability('unsecure', 'WebsiteSection')
|
182
|
-
|
183
|
-
website_author.add_capability('create', 'WebsiteSection')
|
184
|
-
website_author.add_capability('delete', 'WebsiteSection')
|
185
|
-
website_author.add_capability('edit', 'WebsiteSection')
|
186
|
-
website_author.add_capability('secure', 'WebsiteSection')
|
187
|
-
website_author.add_capability('unsecure', 'WebsiteSection')
|
188
|
-
|
189
|
-
admin.add_capability('create', 'WebsiteSectionLayout')
|
190
|
-
admin.add_capability('edit', 'WebsiteSectionLayout')
|
191
|
-
|
192
|
-
layout_author.add_capability('create', 'WebsiteSectionLayout')
|
193
|
-
layout_author.add_capability('edit', 'WebsiteSectionLayout')
|
194
|
-
|
195
|
-
admin.add_capability('create', 'Content')
|
196
|
-
admin.add_capability('delete', 'Content')
|
197
|
-
admin.add_capability('edit', 'Content')
|
198
|
-
admin.add_capability('publish', 'Content')
|
199
|
-
admin.add_capability('revert_version', 'Content')
|
200
|
-
admin.add_capability('add_existing', 'Content')
|
201
|
-
admin.add_capability('edit_html', 'Content')
|
202
|
-
admin.add_capability('edit_excerpt', 'Content')
|
203
|
-
|
204
|
-
content_author.add_capability('create', 'Content')
|
205
|
-
content_author.add_capability('delete', 'Content')
|
206
|
-
content_author.add_capability('edit', 'Content')
|
207
|
-
content_author.add_capability('publish', 'Content')
|
208
|
-
content_author.add_capability('revert_version', 'Content')
|
209
|
-
content_author.add_capability('add_existing', 'Content')
|
210
|
-
content_author.add_capability('edit_html', 'Content')
|
211
|
-
content_author.add_capability('edit_excerpt', 'Content')
|
212
|
-
|
213
|
-
admin.add_capability('create', 'WebsiteNavItem')
|
214
|
-
admin.add_capability('delete', 'WebsiteNavItem')
|
215
|
-
admin.add_capability('edit', 'WebsiteNavItem')
|
216
|
-
admin.add_capability('secure', 'WebsiteNavItem')
|
217
|
-
admin.add_capability('unsecure', 'WebsiteNavItem')
|
218
|
-
|
219
|
-
website_author.add_capability('create', 'WebsiteNavItem')
|
220
|
-
website_author.add_capability('delete', 'WebsiteNavItem')
|
221
|
-
website_author.add_capability('edit', 'WebsiteNavItem')
|
222
|
-
website_author.add_capability('secure', 'WebsiteNavItem')
|
223
|
-
website_author.add_capability('unsecure', 'WebsiteNavItem')
|
224
|
-
|
225
|
-
admin.add_capability('view', 'Theme')
|
226
|
-
designer.add_capability('view', 'Theme')
|
227
|
-
|
228
|
-
admin.add_capability('view', 'SiteImageAsset')
|
229
|
-
website_author.add_capability('view', 'SiteImageAsset')
|
230
|
-
content_author.add_capability('view', 'SiteImageAsset')
|
231
|
-
|
232
|
-
content_author.add_capability('view', 'GlobalImageAsset')
|
233
|
-
|
234
|
-
admin.add_capability('view', 'GlobalImageAsset')
|
235
|
-
admin.add_capability('upload', 'GlobalImageAsset')
|
236
|
-
admin.add_capability('delete', 'GlobalImageAsset')
|
237
|
-
|
238
|
-
website_author.add_capability('view', 'GlobalImageAsset')
|
239
|
-
website_author.add_capability('upload', 'GlobalImageAsset')
|
240
|
-
website_author.add_capability('delete', 'GlobalImageAsset')
|
241
|
-
|
242
|
-
admin.add_capability('view', 'SiteFileAsset')
|
243
|
-
website_author.add_capability('view', 'SiteFileAsset')
|
244
|
-
content_author.add_capability('view', 'SiteFileAsset')
|
245
|
-
|
246
|
-
content_author.add_capability('view', 'GlobalFileAsset')
|
247
|
-
|
248
|
-
admin.add_capability('view', 'GlobalFileAsset')
|
249
|
-
admin.add_capability('upload', 'GlobalFileAsset')
|
250
|
-
admin.add_capability('delete', 'GlobalFileAsset')
|
251
|
-
|
252
|
-
website_author.add_capability('view', 'GlobalFileAsset')
|
253
|
-
website_author.add_capability('upload', 'GlobalFileAsset')
|
254
|
-
website_author.add_capability('delete', 'GlobalFileAsset')
|
255
|
-
|
256
|
-
admin.add_capability('drag_item', 'WebsiteTree')
|
257
|
-
website_author.add_capability('drag_item', 'WebsiteTree')
|
258
|
-
|
259
|
-
# update capability descriptions
|
260
|
-
Capability.all.each do |c|
|
261
|
-
c.update_description
|
262
|
-
end
|
263
|
-
|
264
|
-
drop_table :capable_models
|
265
|
-
drop_table :capabilities_capable_models
|
266
|
-
drop_table :secured_models
|
267
|
-
drop_table :roles_secured_models
|
268
|
-
remove_column :capabilities, :resource
|
269
|
-
end
|
270
|
-
end
|
271
|
-
|
272
|
-
def self.down
|
273
|
-
end
|
274
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class AddQueueToDelayedJobs < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
unless columns(:delayed_jobs).collect {|c| c.name}.include?('queue')
|
4
|
-
add_column :delayed_jobs, :queue, :string
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
def down
|
9
|
-
if columns(:delayed_jobs).collect {|c| c.name}.include?('queue')
|
10
|
-
remove_column :delayed_jobs, :queue, :string
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
class CreateNotifications < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
|
4
|
-
unless table_exists? :notifications
|
5
|
-
create_table :notifications do |t|
|
6
|
-
t.string :type
|
7
|
-
t.references :created_by
|
8
|
-
t.text :message
|
9
|
-
t.references :notification_type
|
10
|
-
t.string :current_state
|
11
|
-
|
12
|
-
t.timestamps
|
13
|
-
end
|
14
|
-
|
15
|
-
add_index :notifications, :notification_type_id
|
16
|
-
add_index :notifications, :created_by_id
|
17
|
-
add_index :notifications, :type
|
18
|
-
end
|
19
|
-
|
20
|
-
unless table_exists? :notification_types
|
21
|
-
create_table :notification_types do |t|
|
22
|
-
t.string :internal_identifier
|
23
|
-
t.string :description
|
24
|
-
|
25
|
-
t.timestamps
|
26
|
-
end
|
27
|
-
|
28
|
-
add_index :notification_types, :internal_identifier
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
32
|
-
|
33
|
-
def down
|
34
|
-
drop_table :notifications if table_exists? :notifications
|
35
|
-
drop_table :notification_types if table_exists? :notification_types
|
36
|
-
end
|
37
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
class AddPartyIdIdxToUsers < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
add_index :users, :party_id, :name => 'users_party_id_idx' unless indexes(:users).collect {|i| i.name}.include?('users_party_id_idx')
|
4
|
-
end
|
5
|
-
|
6
|
-
def down
|
7
|
-
remove_index :users, :party_id if indexes(:users).collect {|i| i.name}.include?('users_party_id_idx')
|
8
|
-
end
|
9
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
class AddAuditLogItemOldValue < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
unless AuditLogItem.columns.include?(:audit_log_item_old_value)
|
4
|
-
add_column :audit_log_items, :audit_log_item_old_value, :string
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
def down
|
9
|
-
if AuditLogItem.columns.include?(:audit_log_item_old_value)
|
10
|
-
remove_column :audit_log_items, :audit_log_item_old_value
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
class AddErpTechSvcsMissingIndexes < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
if indexes(:role_types).select { |index| index.name == 'role_types_parent_id_idx' }.empty?
|
4
|
-
add_index :role_types, :parent_id, :name => 'role_types_parent_id_idx'
|
5
|
-
add_index :security_roles, :internal_identifier, :name => 'security_roles_internal_identifier_idx'
|
6
|
-
add_index :audit_logs, :audit_log_type_id, :name => 'audit_logs_audit_log_type_id_idx'
|
7
|
-
add_index :audit_log_types, :internal_identifier, :name => 'audit_log_types_internal_identifier_idx'
|
8
|
-
add_index :audit_log_types, :parent_id, :name => 'audit_log_types_parent_id_idx'
|
9
|
-
add_index :audit_log_items, :audit_log_id, :name => 'audit_log_items_audit_log_id_idx'
|
10
|
-
add_index :audit_log_items, :audit_log_item_type_id, :name => 'audit_log_items_audit_log_item_type_id_idx'
|
11
|
-
add_index :audit_log_item_types, :internal_identifier, :name => 'audit_log_item_types_internal_identifier_idx'
|
12
|
-
add_index :audit_log_item_types, :parent_id, :name => 'audit_log_item_types_parent_id_idx'
|
13
|
-
add_index :capability_types, :internal_identifier, :name => 'capability_types_internal_identifier_idx'
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def down
|
18
|
-
unless indexes(:role_types).select { |index| index.name == 'role_types_parent_id_idx' }.empty?
|
19
|
-
remove_index :role_types, :parent_id
|
20
|
-
remove_index :security_roles, :internal_identifier
|
21
|
-
remove_index :audit_logs, :audit_log_type_id
|
22
|
-
remove_index :audit_log_types, :internal_identifier
|
23
|
-
remove_index :audit_log_types, :parent_id
|
24
|
-
remove_index :audit_log_items, :audit_log_id
|
25
|
-
remove_index :audit_log_items, :audit_log_item_type_id
|
26
|
-
remove_index :audit_log_item_types, :internal_identifier
|
27
|
-
remove_index :audit_log_item_types, :parent_id
|
28
|
-
remove_index :capability_types, :internal_identifier
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
class AddUserDefinedFields < ActiveRecord::Migration
|
2
|
-
def up
|
3
|
-
|
4
|
-
unless table_exists? :user_defined_data
|
5
|
-
create_table :user_defined_data do |t|
|
6
|
-
t.string :scope
|
7
|
-
t.string :model_name
|
8
|
-
|
9
|
-
t.timestamps
|
10
|
-
end
|
11
|
-
|
12
|
-
add_index :user_defined_data, :scope
|
13
|
-
end
|
14
|
-
|
15
|
-
unless table_exists? :user_defined_fields
|
16
|
-
create_table :user_defined_fields do |t|
|
17
|
-
t.string :field_name
|
18
|
-
t.string :label
|
19
|
-
t.string :data_type
|
20
|
-
t.references :user_defined_data
|
21
|
-
|
22
|
-
t.timestamps
|
23
|
-
end
|
24
|
-
|
25
|
-
add_index :user_defined_fields, :user_defined_data_id
|
26
|
-
add_index :user_defined_fields, :field_name
|
27
|
-
end
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
def down
|
32
|
-
|
33
|
-
if table_exists? :user_defined_data
|
34
|
-
drop_table :user_defined_data
|
35
|
-
end
|
36
|
-
|
37
|
-
if table_exists? :user_defined_fields
|
38
|
-
drop_table :user_defined_fields
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
class AddCustomFieldsToNotifications < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
if ::ActiveRecord::Base.connection.instance_values["config"][:adapter] == 'postgresql'
|
4
|
-
execute('CREATE EXTENSION IF NOT EXISTS hstore;')
|
5
|
-
|
6
|
-
add_column :notifications, :custom_fields, :hstore
|
7
|
-
add_hstore_index :notifications, :custom_fields
|
8
|
-
else
|
9
|
-
add_column :notifications, :custom_fields, :text
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
class AddScopedByToFileAssets < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
|
4
|
-
if ::ActiveRecord::Base.connection.instance_values["config"][:adapter] == 'postgresql'
|
5
|
-
execute('CREATE EXTENSION IF NOT EXISTS hstore;')
|
6
|
-
|
7
|
-
add_column :file_assets, :scoped_by, :hstore
|
8
|
-
add_hstore_index :file_assets, :scoped_by
|
9
|
-
else
|
10
|
-
add_column :file_assets, :scoped_by, :text
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
14
|
-
end
|