erp_orders 3.1.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/app/models/order_line_item.rb +6 -0
- data/app/models/order_line_item_pty_role.rb +1 -1
- data/app/models/order_txn.rb +6 -3
- data/config/routes.rb +0 -10
- data/db/migrate/20131005232344_update_order_line_pty_role_indexes.erp_orders.rb +19 -0
- data/db/migrate/20131005232611_remove_order_line_specific_rtype.rb +32 -0
- data/db/migrate/20140129200040_add_uom_to_order_line_item.rb +13 -0
- data/db/migrate/20140930152140_add_custom_fields_to_order_txn.rb +12 -0
- data/lib/erp_orders/engine.rb +2 -1
- data/lib/erp_orders/extensions/active_record/acts_as_order_line_item.rb +71 -0
- data/lib/erp_orders/extensions/active_record/acts_as_order_txn.rb +62 -61
- data/lib/erp_orders/extensions.rb +2 -1
- data/lib/erp_orders/version.rb +7 -3
- metadata +33 -144
- data/app/assets/javascripts/erp_orders/application.js +0 -9
- data/app/assets/stylesheets/erp_orders/application.css +0 -7
- data/app/controllers/erp_orders/erp_app/desktop/order_manager/base_controller.rb +0 -147
- data/app/controllers/erp_orders/erp_app/organizer/order_management/base_controller.rb +0 -19
- data/app/helpers/erp_orders/application_helper.rb +0 -4
- data/app/models/line_item_role_type.rb +0 -6
- data/app/views/layouts/erp_orders/application.html.erb +0 -14
- data/db/data_migrations/20110728201731_create_desktop_app_order_manager.rb +0 -25
- data/db/data_migrations/20110728201732_create_organizer_app_order_management.rb +0 -14
- data/db/data_migrations/20120229174343_add_orders_widget.rb +0 -28
- data/public/javascripts/erp_app/desktop/applications/order_manager/line_items_grid_panel.js +0 -100
- data/public/javascripts/erp_app/desktop/applications/order_manager/module.js +0 -85
- data/public/javascripts/erp_app/desktop/applications/order_manager/orders_grid_panel.js +0 -162
- data/public/javascripts/erp_app/desktop/applications/order_manager/payments_grid_panel.js +0 -109
- data/public/javascripts/erp_app/organizer/applications/order_management/base.js +0 -124
- data/public/javascripts/erp_app/organizer/applications/order_management/extensions.js +0 -113
- data/public/javascripts/erp_app/organizer/applications/order_management/line_items_grid_panel.js +0 -99
- data/public/javascripts/erp_app/organizer/applications/order_management/orders_grid_panel.1.js +0 -209
- data/public/javascripts/erp_app/organizer/applications/order_management/payments_grid_panel.js +0 -93
- data/spec/dummy/db/data_migrations/20101011152441_payment_gateway_actions.erp_commerce.rb +0 -28
- data/spec/dummy/db/data_migrations/20101014142230_financial_txn_types.erp_txns_and_accts.rb +0 -16
- data/spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb +0 -15
- data/spec/dummy/db/data_migrations/20110324010232_product_role_types.erp_products.rb +0 -24
- data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +0 -12
- data/spec/dummy/db/data_migrations/20110527160807_add_default_prod_avail_types.erp_products.rb +0 -27
- data/spec/dummy/db/data_migrations/20110605231556_create_order_party_roles.erp_orders.rb +0 -24
- data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +0 -19
- data/spec/dummy/db/data_migrations/20110728201729_erp_app_setup.erp_app.rb +0 -252
- data/spec/dummy/db/data_migrations/20110728201730_create_desktop_app_product_manager.erp_products.rb +0 -26
- data/spec/dummy/db/data_migrations/20110728201731_create_desktop_app_order_manager.erp_orders.rb +0 -26
- data/spec/dummy/db/data_migrations/20110728201732_create_organizer_app_order_management.erp_orders.rb +0 -15
- data/spec/dummy/db/data_migrations/20110728201733_update_preferences.erp_app.rb +0 -53
- data/spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +0 -16
- data/spec/dummy/db/data_migrations/20110816161238_create_desktop_app_audit_log_viewer.erp_app.rb +0 -21
- data/spec/dummy/db/data_migrations/20110817160743_add_file_manager_application.erp_app.rb +0 -32
- data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +0 -12
- data/spec/dummy/db/data_migrations/20111108183739_add_default_capabilities.erp_app.rb +0 -23
- data/spec/dummy/db/data_migrations/20111108183740_add_new_contact_widgets.erp_app.rb +0 -42
- data/spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb +0 -22
- data/spec/dummy/db/data_migrations/20120229160222_add_userinfo_widget.erp_app.rb +0 -29
- data/spec/dummy/db/data_migrations/20120229174343_add_orders_widget.erp_orders.rb +0 -29
- data/spec/dummy/db/data_migrations/20120405193721_create_party_and_role_type_for_communication_events.erp_app.rb +0 -11
- data/spec/dummy/db/data_migrations/20120411180756_create_user_management_mobile_application.erp_app.rb +0 -19
- data/spec/dummy/db/data_migrations/20120418164215_create_configuration_management_desktop_application.erp_app.rb +0 -23
- data/spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb +0 -20
- data/spec/dummy/db/data_migrations/20121130201859_upgrade_remove_system_mgmt_app.erp_app.rb +0 -16
- data/spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb +0 -24
- data/spec/dummy/db/data_migrations/20121218175028_create_security_management_desktop_application.erp_app.rb +0 -23
- data/spec/dummy/db/migrate/20130107205931_base_erp_services.erp_base_erp_svcs.rb +0 -461
- data/spec/dummy/db/migrate/20130107205932_base_orders.erp_orders.rb +0 -178
- data/spec/dummy/db/migrate/20130107205933_base_tech_services.erp_tech_svcs.rb +0 -271
- data/spec/dummy/db/migrate/20130107205934_create_has_attribute_tables.erp_tech_svcs.rb +0 -39
- data/spec/dummy/db/migrate/20130107205935_create_groups.erp_tech_svcs.rb +0 -19
- data/spec/dummy/db/migrate/20130107205936_upgrade_security.erp_tech_svcs.rb +0 -54
- data/spec/dummy/db/migrate/20130107205937_upgrade_security2.erp_tech_svcs.rb +0 -270
- data/spec/dummy/db/migrate/20130107205938_base_products.erp_products.rb +0 -234
- data/spec/dummy/db/migrate/20130107205939_base_products_indexes.erp_products.rb +0 -59
- data/spec/dummy/db/migrate/20130107205940_base_txns_and_accts.erp_txns_and_accts.rb +0 -364
- data/spec/dummy/db/migrate/20130107205941_agreements_services.erp_agreements.rb +0 -160
- data/spec/dummy/db/migrate/20130107205942_agreements_services_indexes.erp_agreements.rb +0 -52
- data/spec/dummy/db/migrate/20130107205943_base_app_framework.erp_app.rb +0 -276
- data/spec/dummy/db/migrate/20130107205944_erp_commerce_base.erp_commerce.rb +0 -442
- data/spec/dummy/db/schema.rb +0 -1821
- data/spec/dummy/db/spec.sqlite3 +0 -0
@@ -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,234 +0,0 @@
|
|
1
|
-
# This migration comes from erp_products (originally 20080805000040)
|
2
|
-
class BaseProducts < ActiveRecord::Migration
|
3
|
-
def self.up
|
4
|
-
|
5
|
-
unless table_exists?(:product_types)
|
6
|
-
create_table :product_types do |t|
|
7
|
-
#these columns are required to support the behavior of the plugin 'better_nested_set'
|
8
|
-
#ALL products have the ability to act as packages in a nested set-type structure
|
9
|
-
#
|
10
|
-
#The package behavior is treated differently from other product_relationship behavior
|
11
|
-
#which is implemented using a standard relationship structure.
|
12
|
-
#
|
13
|
-
#This is to allow quick construction of highly nested product types.
|
14
|
-
t.column :parent_id, :integer
|
15
|
-
t.column :lft, :integer
|
16
|
-
t.column :rgt, :integer
|
17
|
-
|
18
|
-
#custom columns go here
|
19
|
-
t.column :description, :string
|
20
|
-
t.column :product_type_record_id, :integer
|
21
|
-
t.column :product_type_record_type, :string
|
22
|
-
t.column :external_identifier, :string
|
23
|
-
t.column :internal_identifier, :string
|
24
|
-
t.column :external_id_source, :string
|
25
|
-
t.column :default_image_url, :string
|
26
|
-
t.column :list_view_image_id, :integer
|
27
|
-
t.timestamps
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
unless table_exists?(:product_instances)
|
32
|
-
create_table :product_instances do |t|
|
33
|
-
#these columns are required to support the behavior of the plugin 'better_nested_set'
|
34
|
-
#ALL products have the ability to act as packages in a nested set-type structure
|
35
|
-
#
|
36
|
-
#The package behavior is treated differently from other product_relationship behavior
|
37
|
-
#which is implemented using a standard relationship structure.
|
38
|
-
#
|
39
|
-
#This is to allow quick construction of highly nested product types.
|
40
|
-
t.column :parent_id, :integer
|
41
|
-
t.column :lft, :integer
|
42
|
-
t.column :rgt, :integer
|
43
|
-
|
44
|
-
#custom columns go here
|
45
|
-
t.column :description, :string
|
46
|
-
t.column :product_instance_record_id, :integer
|
47
|
-
t.column :product_instance_record_type, :string
|
48
|
-
t.column :external_identifier, :string
|
49
|
-
t.column :external_id_source, :string
|
50
|
-
t.column :product_type_id, :integer
|
51
|
-
t.column :type, :string
|
52
|
-
|
53
|
-
t.references :prod_availability_status_type
|
54
|
-
|
55
|
-
t.timestamps
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
unless table_exists?(:product_offers)
|
60
|
-
create_table :product_offers do |t|
|
61
|
-
t.column :description, :string
|
62
|
-
t.column :product_offer_record_id, :integer
|
63
|
-
t.column :product_offer_record_type, :string
|
64
|
-
t.column :external_identifier, :string
|
65
|
-
t.column :external_id_source, :string
|
66
|
-
t.timestamps
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
unless table_exists?(:simple_product_offers)
|
71
|
-
create_table :simple_product_offers do |t|
|
72
|
-
t.column :description, :string
|
73
|
-
t.column :product_id, :integer
|
74
|
-
t.column :base_price, :decimal, :precision => 8, :scale => 2
|
75
|
-
t.column :uom, :integer
|
76
|
-
t.timestamps
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
unless table_exists?(:prod_instance_reln_types)
|
81
|
-
create_table :prod_instance_reln_types do |t|
|
82
|
-
t.column :parent_id, :integer
|
83
|
-
t.column :lft, :integer
|
84
|
-
t.column :rgt, :integer
|
85
|
-
|
86
|
-
#custom columns go here
|
87
|
-
t.column :description, :string
|
88
|
-
t.column :comments, :string
|
89
|
-
t.column :internal_identifier, :string
|
90
|
-
t.column :external_identifier, :string
|
91
|
-
t.column :external_id_source, :string
|
92
|
-
t.timestamps
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
unless table_exists?(:prod_instance_role_types)
|
97
|
-
create_table :prod_instance_role_types do |t|
|
98
|
-
t.column :parent_id, :integer
|
99
|
-
t.column :lft, :integer
|
100
|
-
t.column :rgt, :integer
|
101
|
-
#custom columns go here
|
102
|
-
t.column :description, :string
|
103
|
-
t.column :comments, :string
|
104
|
-
t.column :internal_identifier, :string
|
105
|
-
t.column :external_identifier, :string
|
106
|
-
t.column :external_id_source, :string
|
107
|
-
t.timestamps
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
unless table_exists?(:prod_instance_relns)
|
112
|
-
create_table :prod_instance_relns do |t|
|
113
|
-
t.column :prod_instance_reln_type_id, :integer
|
114
|
-
t.column :description, :string
|
115
|
-
t.column :prod_instance_id_from, :integer
|
116
|
-
t.column :prod_instance_id_to, :integer
|
117
|
-
t.column :role_type_id_from, :integer
|
118
|
-
t.column :role_type_id_to, :integer
|
119
|
-
t.column :status_type_id, :integer
|
120
|
-
t.column :from_date, :date
|
121
|
-
t.column :thru_date, :date
|
122
|
-
t.timestamps
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
unless table_exists?(:prod_type_reln_types)
|
127
|
-
create_table :prod_type_reln_types do |t|
|
128
|
-
t.column :parent_id, :integer
|
129
|
-
t.column :lft, :integer
|
130
|
-
t.column :rgt, :integer
|
131
|
-
#custom columns go here
|
132
|
-
t.column :description, :string
|
133
|
-
t.column :comments, :string
|
134
|
-
t.column :internal_identifier, :string
|
135
|
-
t.column :external_identifier, :string
|
136
|
-
t.column :external_id_source, :string
|
137
|
-
t.timestamps
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
unless table_exists?(:prod_type_role_types)
|
142
|
-
create_table :prod_type_role_types do |t|
|
143
|
-
t.column :parent_id, :integer
|
144
|
-
t.column :lft, :integer
|
145
|
-
t.column :rgt, :integer
|
146
|
-
#custom columns go here
|
147
|
-
t.column :description, :string
|
148
|
-
t.column :comments, :string
|
149
|
-
t.column :internal_identifier, :string
|
150
|
-
t.column :external_identifier, :string
|
151
|
-
t.column :external_id_source, :string
|
152
|
-
t.timestamps
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
unless table_exists?(:prod_type_relns)
|
157
|
-
create_table :prod_type_relns do |t|
|
158
|
-
t.column :prod_type_reln_type_id, :integer
|
159
|
-
t.column :description, :string
|
160
|
-
t.column :prod_type_id_from, :integer
|
161
|
-
t.column :prod_type_id_to, :integer
|
162
|
-
t.column :role_type_id_from, :integer
|
163
|
-
t.column :role_type_id_to, :integer
|
164
|
-
t.column :status_type_id, :integer
|
165
|
-
t.column :from_date, :date
|
166
|
-
t.column :thru_date, :date
|
167
|
-
t.timestamps
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
unless table_exists?(:product_instance_status_types)
|
172
|
-
create_table :product_instance_status_types do |t|
|
173
|
-
#better nested set colummns
|
174
|
-
t.column :parent_id, :integer
|
175
|
-
t.column :lft, :integer
|
176
|
-
t.column :rgt, :integer
|
177
|
-
|
178
|
-
t.column :description, :string
|
179
|
-
t.column :internal_identifier, :string
|
180
|
-
t.column :external_identifier, :string
|
181
|
-
t.column :external_id_source, :string
|
182
|
-
|
183
|
-
t.timestamps
|
184
|
-
end
|
185
|
-
end
|
186
|
-
|
187
|
-
unless table_exists?(:prod_availability_status_types)
|
188
|
-
create_table :prod_availability_status_types do |t|
|
189
|
-
#better nested set colummns
|
190
|
-
t.column :parent_id, :integer
|
191
|
-
t.column :lft, :integer
|
192
|
-
t.column :rgt, :integer
|
193
|
-
|
194
|
-
t.column :description, :string
|
195
|
-
t.column :internal_identifier, :string
|
196
|
-
t.column :external_identifier, :string
|
197
|
-
t.column :external_id_source, :string
|
198
|
-
|
199
|
-
t.timestamps
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
unless table_exists?(:prod_availability_status_types)
|
204
|
-
create_table :prod_availability_status_types do |t|
|
205
|
-
#better nested set colummns
|
206
|
-
t.column :parent_id, :integer
|
207
|
-
t.column :lft, :integer
|
208
|
-
t.column :rgt, :integer
|
209
|
-
|
210
|
-
t.column :description, :string
|
211
|
-
t.column :internal_identifier, :string
|
212
|
-
t.column :external_identifier, :string
|
213
|
-
t.column :external_id_source, :string
|
214
|
-
|
215
|
-
t.timestamps
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
|
220
|
-
end
|
221
|
-
|
222
|
-
def self.down
|
223
|
-
[
|
224
|
-
:prod_type_relns, :prod_type_role_types, :prod_type_reln_types,
|
225
|
-
:prod_instance_relns, :prod_instance_role_types, :prod_instance_reln_types,
|
226
|
-
:simple_product_offers, :product_offers, :product_instances,
|
227
|
-
:product_types,:prod_availability_status_types
|
228
|
-
].each do |tbl|
|
229
|
-
if table_exists?(tbl)
|
230
|
-
drop_table tbl
|
231
|
-
end
|
232
|
-
end
|
233
|
-
end
|
234
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
# This migration comes from erp_products (originally 20080805000041)
|
2
|
-
class BaseProductsIndexes < ActiveRecord::Migration
|
3
|
-
def self.up
|
4
|
-
add_index :product_types, :parent_id
|
5
|
-
add_index :product_types, [:product_type_record_id, :product_type_record_type],
|
6
|
-
:name => "bpi_1"
|
7
|
-
|
8
|
-
add_index :product_instances, :parent_id
|
9
|
-
add_index :product_instances, [:product_instance_record_id, :product_instance_record_type],
|
10
|
-
:name => "bpi_2"
|
11
|
-
add_index :product_instances, :product_type_id
|
12
|
-
|
13
|
-
add_index :product_offers, [:product_offer_record_id, :product_offer_record_type],
|
14
|
-
:name => "bpi_3"
|
15
|
-
|
16
|
-
add_index :simple_product_offers, :product_id
|
17
|
-
|
18
|
-
add_index :prod_instance_reln_types, :parent_id
|
19
|
-
|
20
|
-
add_index :prod_instance_role_types, :parent_id
|
21
|
-
|
22
|
-
add_index :prod_instance_relns, :prod_instance_reln_type_id
|
23
|
-
add_index :prod_instance_relns, :status_type_id
|
24
|
-
|
25
|
-
add_index :prod_type_reln_types, :parent_id
|
26
|
-
|
27
|
-
add_index :prod_type_role_types, :parent_id
|
28
|
-
|
29
|
-
add_index :prod_type_relns, :prod_type_reln_type_id
|
30
|
-
add_index :prod_type_relns, :status_type_id
|
31
|
-
end
|
32
|
-
|
33
|
-
def self.down
|
34
|
-
remove_index :product_types, :parent_id
|
35
|
-
remove_index :product_types, :name => "bpi_1"
|
36
|
-
|
37
|
-
remove_index :product_instances, :parent_id
|
38
|
-
remove_index :product_instances, :name => "bpi_2"
|
39
|
-
remove_index :product_instances, :product_type_id
|
40
|
-
|
41
|
-
remove_index :product_offers, :name => "bpi_3"
|
42
|
-
|
43
|
-
remove_index :simple_product_offers, :product_id
|
44
|
-
|
45
|
-
remove_index :prod_instance_reln_types, :parent_id
|
46
|
-
|
47
|
-
remove_index :prod_instance_role_types, :parent_id
|
48
|
-
|
49
|
-
remove_index :prod_instance_relns, :prod_instance_reln_type_id
|
50
|
-
remove_index :prod_instance_relns, :status_type_id
|
51
|
-
|
52
|
-
remove_index :prod_type_reln_types, :parent_id
|
53
|
-
|
54
|
-
remove_index :prod_type_role_types, :parent_id
|
55
|
-
|
56
|
-
remove_index :prod_type_relns, :prod_type_reln_type_id
|
57
|
-
remove_index :prod_type_relns, :status_type_id
|
58
|
-
end
|
59
|
-
end
|