erp_txns_and_accts 3.0.6 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/base_txn_context.rb +1 -0
- data/app/models/biz_acct_txn_task.rb +1 -0
- data/app/models/biz_txn_acct_party_role.rb +1 -0
- data/app/models/biz_txn_acct_pty_rtype.rb +2 -0
- data/app/models/biz_txn_acct_rel_type.rb +1 -1
- data/app/models/biz_txn_acct_relationship.rb +1 -0
- data/app/models/biz_txn_acct_root.rb +14 -14
- data/app/models/biz_txn_acct_status.rb +1 -1
- data/app/models/biz_txn_acct_status_type.rb +1 -1
- data/app/models/biz_txn_acct_type.rb +2 -0
- data/app/models/biz_txn_agreement_role.rb +1 -0
- data/app/models/biz_txn_agreement_role_type.rb +2 -0
- data/app/models/biz_txn_event.rb +1 -0
- data/app/models/biz_txn_event_desc.rb +1 -0
- data/app/models/biz_txn_party_role.rb +1 -0
- data/app/models/biz_txn_party_role_type.rb +2 -0
- data/app/models/biz_txn_rel_type.rb +2 -0
- data/app/models/biz_txn_relationship.rb +1 -0
- data/app/models/biz_txn_status.rb +1 -1
- data/app/models/biz_txn_task.rb +1 -1
- data/app/models/biz_txn_task_type.rb +1 -1
- data/app/models/biz_txn_type.rb +1 -0
- data/app/models/financial_txn.rb +2 -0
- data/app/models/financial_txn_account.rb +2 -0
- data/lib/erp_txns_and_accts.rb +2 -0
- data/lib/erp_txns_and_accts/extensions/active_record/acts_as_biz_txn_account.rb +8 -9
- data/lib/erp_txns_and_accts/version.rb +2 -2
- data/spec/dummy/config/application.rb +6 -0
- data/spec/dummy/config/environments/spec.rb +3 -0
- data/spec/dummy/db/data_migrations/20101011152441_payment_gateway_actions.erp_commerce.rb +28 -0
- data/spec/dummy/db/data_migrations/20101014142230_financial_txn_types.erp_txns_and_accts.rb +16 -0
- data/spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb +15 -0
- data/spec/dummy/db/data_migrations/20110324010232_product_role_types.erp_products.rb +24 -0
- data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +12 -0
- data/spec/dummy/db/data_migrations/20110527160807_add_default_prod_avail_types.erp_products.rb +27 -0
- data/spec/dummy/db/data_migrations/20110605231556_create_order_party_roles.erp_orders.rb +24 -0
- data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +19 -0
- data/spec/dummy/db/data_migrations/20110728201729_erp_app_setup.erp_app.rb +252 -0
- data/spec/dummy/db/data_migrations/20110728201730_create_desktop_app_product_manager.erp_products.rb +26 -0
- data/spec/dummy/db/data_migrations/20110728201731_create_desktop_app_order_manager.erp_orders.rb +26 -0
- data/spec/dummy/db/data_migrations/20110728201732_create_organizer_app_order_management.erp_orders.rb +15 -0
- data/spec/dummy/db/data_migrations/20110728201733_update_preferences.erp_app.rb +53 -0
- data/spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +16 -0
- data/spec/dummy/db/data_migrations/20110816161238_create_desktop_app_audit_log_viewer.erp_app.rb +21 -0
- data/spec/dummy/db/data_migrations/20110817160743_add_file_manager_application.erp_app.rb +32 -0
- data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +12 -0
- data/spec/dummy/db/data_migrations/20111108183739_add_default_capabilities.erp_app.rb +23 -0
- data/spec/dummy/db/data_migrations/20111108183740_add_new_contact_widgets.erp_app.rb +42 -0
- data/spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb +22 -0
- data/spec/dummy/db/data_migrations/20120109173616_create_download_capability_type.erp_tech_svcs.rb +14 -0
- data/spec/dummy/db/data_migrations/20120229160222_add_userinfo_widget.erp_app.rb +29 -0
- data/spec/dummy/db/data_migrations/20120229174343_add_orders_widget.erp_orders.rb +29 -0
- data/spec/dummy/db/data_migrations/20120405193721_create_party_and_role_type_for_communication_events.erp_app.rb +11 -0
- data/spec/dummy/db/data_migrations/20120411180756_create_user_management_mobile_application.erp_app.rb +19 -0
- data/spec/dummy/db/data_migrations/20120418164215_create_configuration_management_desktop_application.erp_app.rb +23 -0
- data/spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb +20 -0
- data/spec/dummy/db/data_migrations/20121130201859_upgrade_remove_system_mgmt_app.erp_app.rb +16 -0
- data/spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb +24 -0
- data/spec/dummy/db/data_migrations/20121218175028_create_security_management_desktop_application.erp_app.rb +23 -0
- data/spec/dummy/db/migrate/20130107214858_base_erp_services.erp_base_erp_svcs.rb +461 -0
- data/spec/dummy/db/migrate/20130107214859_base_txns_and_accts.erp_txns_and_accts.rb +364 -0
- data/spec/dummy/db/migrate/20130107214860_base_tech_services.erp_tech_svcs.rb +271 -0
- data/spec/dummy/db/migrate/20130107214861_create_has_attribute_tables.erp_tech_svcs.rb +39 -0
- data/spec/dummy/db/migrate/20130107214862_create_groups.erp_tech_svcs.rb +19 -0
- data/spec/dummy/db/migrate/20130107214863_upgrade_security.erp_tech_svcs.rb +54 -0
- data/spec/dummy/db/migrate/20130107214864_upgrade_security2.erp_tech_svcs.rb +270 -0
- data/spec/dummy/db/migrate/20130107214865_agreements_services.erp_agreements.rb +160 -0
- data/spec/dummy/db/migrate/20130107214866_agreements_services_indexes.erp_agreements.rb +52 -0
- data/spec/dummy/db/migrate/20130107214867_base_app_framework.erp_app.rb +276 -0
- data/spec/dummy/db/migrate/20130107214868_base_products.erp_products.rb +234 -0
- data/spec/dummy/db/migrate/20130107214869_base_products_indexes.erp_products.rb +59 -0
- data/spec/dummy/db/migrate/20130107214870_base_orders.erp_orders.rb +178 -0
- data/spec/dummy/db/migrate/20130107214871_erp_commerce_base.erp_commerce.rb +442 -0
- data/spec/dummy/db/schema.rb +1821 -0
- data/spec/dummy/db/spec.sqlite3 +0 -0
- data/spec/dummy/log/spec.log +12768 -0
- data/spec/spec_helper.rb +11 -3
- metadata +106 -11
- data/db/migrate/20110609230152_update_financial_txns.rb +0 -21
- data/db/migrate/20130408195119_add_biz_txn_acct_type_id_to_biz_txn_acct_root.rb +0 -5
- data/db/migrate/upgrade/20120118135738_add_type_column_to_biz_txn_acct_root.rb +0 -7
- data/db/migrate/upgrade/20120118143602_add_apply_date_to_financial_txn.rb +0 -7
- data/db/migrate/upgrade/20120515155000_update_financial_txn_acct_due_date.rb +0 -9
@@ -0,0 +1,52 @@
|
|
1
|
+
# This migration comes from erp_agreements (originally 20080805000071)
|
2
|
+
class AgreementsServicesIndexes < ActiveRecord::Migration
|
3
|
+
def self.up
|
4
|
+
add_index :agreements, :agreement_type_id
|
5
|
+
add_index :agreements, :product_id
|
6
|
+
|
7
|
+
add_index :agreement_types, :parent_id
|
8
|
+
|
9
|
+
add_index :agreement_items, :agreement_id
|
10
|
+
add_index :agreement_items, :agreement_item_type_id
|
11
|
+
|
12
|
+
add_index :agreement_item_types, :parent_id
|
13
|
+
|
14
|
+
add_index :agreement_party_roles, :agreement_id
|
15
|
+
add_index :agreement_party_roles, :party_id
|
16
|
+
add_index :agreement_party_roles, :role_type_id
|
17
|
+
|
18
|
+
add_index :agreement_relationships, :agreement_reln_type_id
|
19
|
+
add_index :agreement_relationships, :status_type_id
|
20
|
+
|
21
|
+
add_index :agreement_reln_types, :parent_id
|
22
|
+
add_index :agreement_reln_types, :valid_from_role_type_id
|
23
|
+
add_index :agreement_reln_types, :valid_to_role_type_id
|
24
|
+
|
25
|
+
add_index :agreement_role_types, :parent_id
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.down
|
29
|
+
remove_index :agreements, :agreement_type_id
|
30
|
+
remove_index :agreements, :product_id
|
31
|
+
|
32
|
+
remove_index :agreement_types, :parent_id
|
33
|
+
|
34
|
+
remove_index :agreement_items, :agreement_id
|
35
|
+
remove_index :agreement_items, :agreement_item_type_id
|
36
|
+
|
37
|
+
remove_index :agreement_item_types, :parent_id
|
38
|
+
|
39
|
+
remove_index :agreement_party_roles, :agreement_id
|
40
|
+
remove_index :agreement_party_roles, :party_id
|
41
|
+
remove_index :agreement_party_roles, :role_type_id
|
42
|
+
|
43
|
+
remove_index :agreement_relationships, :agreement_reln_type_id
|
44
|
+
remove_index :agreement_relationships, :status_type_id
|
45
|
+
|
46
|
+
remove_index :agreement_reln_types, :parent_id
|
47
|
+
remove_index :agreement_reln_types, :valid_from_role_type_id
|
48
|
+
remove_index :agreement_reln_types, :valid_to_role_type_id
|
49
|
+
|
50
|
+
remove_index :agreement_role_types, :parent_id
|
51
|
+
end
|
52
|
+
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,234 @@
|
|
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
|