erp_commerce 3.1.2 → 3.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/db/data_migrations/20130408200643_add_credit_card_biz_txn_acct_types.rb +57 -0
  2. data/lib/erp_commerce/version.rb +1 -1
  3. data/spec/dummy/db/data_migrations/20101011152441_payment_gateway_actions.erp_commerce.rb +28 -0
  4. data/spec/dummy/db/data_migrations/20101014142230_financial_txn_types.erp_txns_and_accts.rb +16 -0
  5. data/spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb +15 -0
  6. data/spec/dummy/db/data_migrations/20110324010232_product_role_types.erp_products.rb +24 -0
  7. data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +12 -0
  8. data/spec/dummy/db/data_migrations/20110527160807_add_default_prod_avail_types.erp_products.rb +27 -0
  9. data/spec/dummy/db/data_migrations/20110605231556_create_order_party_roles.erp_orders.rb +24 -0
  10. data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +19 -0
  11. data/spec/dummy/db/data_migrations/20110728201729_erp_app_setup.erp_app.rb +252 -0
  12. data/spec/dummy/db/data_migrations/20110728201730_create_desktop_app_product_manager.erp_products.rb +26 -0
  13. data/spec/dummy/db/data_migrations/20110728201731_create_desktop_app_order_manager.erp_orders.rb +26 -0
  14. data/spec/dummy/db/data_migrations/20110728201732_create_organizer_app_order_management.erp_orders.rb +15 -0
  15. data/spec/dummy/db/data_migrations/20110728201733_update_preferences.erp_app.rb +53 -0
  16. data/spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +16 -0
  17. data/spec/dummy/db/data_migrations/20110816161238_create_desktop_app_audit_log_viewer.erp_app.rb +21 -0
  18. data/spec/dummy/db/data_migrations/20110817160743_add_file_manager_application.erp_app.rb +32 -0
  19. data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +12 -0
  20. data/spec/dummy/db/data_migrations/20111108183739_add_default_capabilities.erp_app.rb +23 -0
  21. data/spec/dummy/db/data_migrations/20111108183740_add_new_contact_widgets.erp_app.rb +42 -0
  22. data/spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb +22 -0
  23. data/spec/dummy/db/data_migrations/20120229160222_add_userinfo_widget.erp_app.rb +29 -0
  24. data/spec/dummy/db/data_migrations/20120229174343_add_orders_widget.erp_orders.rb +29 -0
  25. data/spec/dummy/db/data_migrations/20120405193721_create_party_and_role_type_for_communication_events.erp_app.rb +11 -0
  26. data/spec/dummy/db/data_migrations/20120411180756_create_user_management_mobile_application.erp_app.rb +19 -0
  27. data/spec/dummy/db/data_migrations/20120418164215_create_configuration_management_desktop_application.erp_app.rb +23 -0
  28. data/spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb +20 -0
  29. data/spec/dummy/db/data_migrations/20121130201859_upgrade_remove_system_mgmt_app.erp_app.rb +16 -0
  30. data/spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb +24 -0
  31. data/spec/dummy/db/data_migrations/20121218175028_create_security_management_desktop_application.erp_app.rb +23 -0
  32. data/spec/dummy/db/data_migrations/20130422155150_upgrade_compass_ae_instances_data.erp_base_erp_svcs.rb +19 -0
  33. data/spec/dummy/db/data_migrations/20130422155151_add_guid_to_instances.erp_base_erp_svcs.rb +10 -0
  34. data/spec/dummy/db/data_migrations/20130422155152_create_job_tracker_desktop_application.erp_app.rb +23 -0
  35. data/spec/dummy/db/data_migrations/20130422155153_created_tracked_jobs.erp_app.rb +15 -0
  36. data/spec/dummy/db/data_migrations/20130422155154_add_job_tracker_mobile_app.erp_app.rb +17 -0
  37. data/spec/dummy/db/data_migrations/20130422155155_add_credit_card_biz_txn_acct_types.erp_commerce.rb +58 -0
  38. data/spec/dummy/db/migrate/20130107205819_base_erp_services.erp_base_erp_svcs.rb +461 -0
  39. data/spec/dummy/db/migrate/20130107205820_base_tech_services.erp_tech_svcs.rb +271 -0
  40. data/spec/dummy/db/migrate/20130107205821_create_has_attribute_tables.erp_tech_svcs.rb +39 -0
  41. data/spec/dummy/db/migrate/20130107205822_create_groups.erp_tech_svcs.rb +19 -0
  42. data/spec/dummy/db/migrate/20130107205823_upgrade_security.erp_tech_svcs.rb +54 -0
  43. data/spec/dummy/db/migrate/20130107205824_upgrade_security2.erp_tech_svcs.rb +270 -0
  44. data/spec/dummy/db/migrate/20130107205825_base_app_framework.erp_app.rb +276 -0
  45. data/spec/dummy/db/migrate/20130107205826_base_txns_and_accts.erp_txns_and_accts.rb +364 -0
  46. data/spec/dummy/db/migrate/20130107205827_agreements_services.erp_agreements.rb +160 -0
  47. data/spec/dummy/db/migrate/20130107205828_agreements_services_indexes.erp_agreements.rb +52 -0
  48. data/spec/dummy/db/migrate/20130107205829_base_products.erp_products.rb +234 -0
  49. data/spec/dummy/db/migrate/20130107205830_base_products_indexes.erp_products.rb +59 -0
  50. data/spec/dummy/db/migrate/20130107205831_base_orders.erp_orders.rb +178 -0
  51. data/spec/dummy/db/migrate/20130107205832_erp_commerce_base.erp_commerce.rb +442 -0
  52. data/spec/dummy/db/migrate/20130422155141_add_txn_status.erp_base_erp_svcs.rb +37 -0
  53. data/spec/dummy/db/migrate/20130422155142_upgrade_compass_ae_instances.erp_base_erp_svcs.rb +34 -0
  54. data/spec/dummy/db/migrate/20130422155143_add_uuid_compass_ae_instance.erp_base_erp_svcs.rb +17 -0
  55. data/spec/dummy/db/migrate/20130422155144_add_long_lat_to_address.erp_base_erp_svcs.rb +16 -0
  56. data/spec/dummy/db/migrate/20130422155145_add_queue_to_delayed_jobs.erp_tech_svcs.rb +14 -0
  57. data/spec/dummy/db/migrate/20130422155146_add_job_tracker.erp_app.rb +20 -0
  58. data/spec/dummy/db/migrate/20130422155147_update_mobile_application.erp_app.rb +28 -0
  59. data/spec/dummy/db/migrate/20130422155148_add_biz_txn_acct_type_id_to_biz_txn_acct_root.erp_txns_and_accts.rb +6 -0
  60. data/spec/dummy/db/migrate/20130422155149_add_product_instances_nested_set_indexes.erp_products.rb +10 -0
  61. data/spec/dummy/db/schema.rb +1884 -0
  62. data/spec/dummy/db/spec.sqlite3 +0 -0
  63. data/spec/dummy/log/spec.log +7181 -0
  64. metadata +126 -3
@@ -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,364 @@
1
+ # This migration comes from erp_txns_and_accts (originally 20080805000030)
2
+ class BaseTxnsAndAccts < ActiveRecord::Migration
3
+ def self.up
4
+
5
+ unless table_exists?(:biz_txn_events)
6
+ create_table :biz_txn_events do |t|
7
+ t.column :description, :string
8
+ t.column :biz_txn_acct_root_id, :integer
9
+ t.column :biz_txn_type_id, :integer
10
+ t.column :entered_date, :datetime
11
+ t.column :post_date, :datetime
12
+ t.column :biz_txn_record_id, :integer
13
+ t.column :biz_txn_record_type, :string
14
+ t.column :external_identifier, :string
15
+ t.column :external_id_source, :string
16
+ t.timestamps
17
+ end
18
+
19
+ add_index :biz_txn_events, :biz_txn_acct_root_id
20
+ add_index :biz_txn_events, :biz_txn_type_id
21
+ add_index :biz_txn_events, [:biz_txn_record_id, :biz_txn_record_type], :name => "btai_1"
22
+ end
23
+
24
+ unless table_exists?(:biz_txn_event_descs)
25
+ create_table :biz_txn_event_descs do |t|
26
+ t.column :biz_txn_event_id, :integer
27
+ t.column :language_id, :integer
28
+ t.column :locale_id, :integer
29
+ t.column :priority, :integer
30
+ t.column :sequence, :integer
31
+ t.column :short_description, :string
32
+ t.column :long_description, :string
33
+ t.timestamps
34
+ end
35
+
36
+ add_index :biz_txn_event_descs, :biz_txn_event_id
37
+ add_index :biz_txn_event_descs, :language_id
38
+ add_index :biz_txn_event_descs, :locale_id
39
+ end
40
+
41
+ unless table_exists?(:biz_txn_types)
42
+ create_table :biz_txn_types do |t|
43
+ t.column :parent_id, :integer
44
+ t.column :lft, :integer
45
+ t.column :rgt, :integer
46
+
47
+ #custom columns go here
48
+ t.column :description, :string
49
+ t.column :comments, :string
50
+ t.column :internal_identifier, :string
51
+ t.column :external_identifier, :string
52
+ t.column :external_id_source, :string
53
+ t.timestamps
54
+ end
55
+
56
+ add_index :biz_txn_types, [:parent_id,:lft,:rgt], :name => 'biz_txn_type_nested_set_idx'
57
+ end
58
+
59
+ unless table_exists?(:biz_txn_relationships)
60
+ create_table :biz_txn_relationships do |t|
61
+ t.column :biz_txn_rel_type_id, :integer
62
+ t.column :description, :string
63
+ t.column :txn_event_id_from, :integer
64
+ t.column :txn_event_id_to, :integer
65
+ t.column :status_type_id, :integer
66
+ t.column :from_date, :date
67
+ t.column :thru_date, :date
68
+ t.timestamps
69
+ end
70
+
71
+ add_index :biz_txn_relationships, :biz_txn_rel_type_id
72
+ add_index :biz_txn_relationships, :status_type_id
73
+ end
74
+
75
+ unless table_exists?(:biz_txn_rel_types)
76
+ create_table :biz_txn_rel_types do |t|
77
+ t.column :parent_id, :integer
78
+ t.column :lft, :integer
79
+ t.column :rgt, :integer
80
+ #custom columns go here
81
+ t.column :description, :string
82
+ t.column :comments, :string
83
+ t.column :internal_identifier, :string
84
+ t.column :external_identifier, :string
85
+ t.column :external_id_source, :string
86
+ t.timestamps
87
+ end
88
+
89
+ add_index :biz_txn_rel_types, :parent_id
90
+ end
91
+
92
+ unless table_exists?(:biz_txn_statuses)
93
+ create_table :biz_txn_statuses do |t|
94
+ t.column :description, :string
95
+ t.column :comments, :string
96
+ t.timestamps
97
+ end
98
+ end
99
+
100
+ unless table_exists?(:biz_txn_tasks)
101
+ create_table :biz_txn_tasks do |t|
102
+ t.column :description, :string
103
+ t.timestamps
104
+ end
105
+ end
106
+
107
+ unless table_exists?(:biz_txn_task_types)
108
+ create_table :biz_txn_task_types do |t|
109
+ t.column :parent_id, :integer
110
+ t.column :lft, :integer
111
+ t.column :rgt, :integer
112
+ #custom columns go here
113
+ t.column :description, :string
114
+ t.column :comments, :string
115
+ t.timestamps
116
+ end
117
+
118
+ add_index :biz_txn_task_types, :parent_id
119
+ end
120
+
121
+ unless table_exists?(:biz_txn_party_roles)
122
+ create_table :biz_txn_party_roles do |t|
123
+ t.column :biz_txn_event_id, :integer
124
+ t.column :party_id, :integer
125
+ t.column :biz_txn_party_role_type_id, :integer
126
+ t.timestamps
127
+ end
128
+
129
+ add_index :biz_txn_party_roles, :biz_txn_event_id
130
+ add_index :biz_txn_party_roles, :party_id
131
+ add_index :biz_txn_party_roles, :biz_txn_party_role_type_id
132
+ end
133
+
134
+ unless table_exists?(:biz_txn_party_role_types)
135
+ create_table :biz_txn_party_role_types do |t|
136
+ t.column :parent_id, :integer
137
+ t.column :lft, :integer
138
+ t.column :rgt, :integer
139
+ #custom columns go here
140
+ t.column :description, :string
141
+ t.column :comments, :string
142
+ t.column :internal_identifier, :string
143
+ t.timestamps
144
+ end
145
+
146
+ add_index :biz_txn_party_role_types, :parent_id
147
+ end
148
+
149
+ unless table_exists?(:biz_txn_acct_roots)
150
+ create_table :biz_txn_acct_roots do |t|
151
+ t.column :description, :string
152
+ t.column :status, :integer
153
+ t.column :biz_txn_acct_id, :integer
154
+ t.column :biz_txn_acct_type, :string
155
+ t.column :external_identifier, :string
156
+ t.column :external_id_source, :string
157
+ t.column :type, :string
158
+ t.timestamps
159
+ end
160
+
161
+ add_index :biz_txn_acct_roots, [:biz_txn_acct_id, :biz_txn_acct_type], :name => "btai_2"
162
+ end
163
+
164
+ unless table_exists?(:biz_txn_acct_status_types)
165
+ create_table :biz_txn_acct_status_types do |t|
166
+ t.timestamps
167
+ end
168
+ end
169
+
170
+ unless table_exists?(:biz_txn_acct_types)
171
+ create_table :biz_txn_acct_types do |t|
172
+ t.column :parent_id, :integer
173
+ t.column :lft, :integer
174
+ t.column :rgt, :integer
175
+ #custom columns go here
176
+ t.column :description, :string
177
+ t.column :comments, :string
178
+ t.column :internal_identifier, :string
179
+ t.column :external_identifier, :string
180
+ t.column :external_id_source, :string
181
+ t.timestamps
182
+ end
183
+
184
+ add_index :biz_txn_acct_types, :parent_id
185
+ end
186
+
187
+ unless table_exists?(:biz_txn_acct_statuses)
188
+ create_table :biz_txn_acct_statuses do |t|
189
+ t.timestamps
190
+ end
191
+ end
192
+
193
+ unless table_exists?(:biz_txn_acct_rel_types)
194
+ create_table :biz_txn_acct_rel_types do |t|
195
+ t.column :parent_id, :integer
196
+ t.column :lft, :integer
197
+ t.column :rgt, :integer
198
+ #custom columns go here
199
+ t.column :description, :string
200
+ t.column :comments, :string
201
+ t.column :internal_identifier, :string
202
+ t.column :external_identifier, :string
203
+ t.column :external_id_source, :string
204
+ t.timestamps
205
+ end
206
+
207
+ add_index :biz_txn_acct_rel_types, :parent_id
208
+ end
209
+
210
+ unless table_exists?(:biz_txn_acct_relationships)
211
+ create_table :biz_txn_acct_relationships do |t|
212
+ t.column :biz_txn_acct_rel_type_id, :integer
213
+ t.column :description, :string
214
+ t.column :biz_txn_acct_root_id_from, :integer
215
+ t.column :biz_txn_acct_root_id_to, :integer
216
+ t.column :status_type_id, :integer
217
+ t.column :from_date, :date
218
+ t.column :thru_date, :date
219
+ t.timestamps
220
+ end
221
+
222
+ add_index :biz_txn_acct_relationships, :biz_txn_acct_rel_type_id
223
+ add_index :biz_txn_acct_relationships, :status_type_id
224
+
225
+ end
226
+
227
+ unless table_exists?(:biz_txn_acct_party_roles)
228
+ create_table :biz_txn_acct_party_roles do |t|
229
+ t.column :description, :string
230
+ t.column :biz_txn_acct_root_id, :integer
231
+ t.column :party_id, :integer
232
+ t.column :biz_txn_acct_pty_rtype_id, :integer
233
+ t.column :is_default_billing_acct_flag, :integer
234
+ t.timestamps
235
+ end
236
+
237
+ add_index :biz_txn_acct_party_roles, :biz_txn_acct_root_id
238
+ add_index :biz_txn_acct_party_roles, :party_id
239
+ add_index :biz_txn_acct_party_roles, :biz_txn_acct_pty_rtype_id
240
+ end
241
+
242
+ unless table_exists?(:biz_txn_acct_pty_rtypes)
243
+ create_table :biz_txn_acct_pty_rtypes do |t|
244
+ t.column :parent_id, :integer
245
+ t.column :lft, :integer
246
+ t.column :rgt, :integer
247
+ #custom columns go here
248
+ t.column :description, :string
249
+ t.column :comments, :string
250
+ t.column :internal_identifier, :string
251
+ t.column :external_identifier, :string
252
+ t.column :external_id_source, :string
253
+ t.timestamps
254
+ end
255
+
256
+ add_index :biz_txn_acct_pty_rtypes, :parent_id
257
+ end
258
+
259
+ unless table_exists?(:biz_acct_txn_tasks)
260
+ create_table :biz_acct_txn_tasks do |t|
261
+ t.column :biz_txn_task_id, :integer
262
+ t.column :biz_txn_account_id, :integer
263
+ t.column :description, :string
264
+ t.column :comments, :string
265
+ t.column :entered_date, :datetime
266
+ t.column :requested_date, :datetime
267
+ t.timestamps
268
+ end
269
+
270
+ add_index :biz_acct_txn_tasks, :biz_txn_task_id
271
+ add_index :biz_acct_txn_tasks, :biz_txn_account_id
272
+ end
273
+
274
+ unless table_exists?(:biz_txn_agreement_role_types)
275
+ create_table :biz_txn_agreement_role_types do |t|
276
+ t.column :parent_id, :integer
277
+ t.column :lft, :integer
278
+ t.column :rgt, :integer
279
+ #custom columns go here
280
+ t.column :description, :string
281
+ t.column :comments, :string
282
+ t.column :internal_identifier, :string
283
+ t.timestamps
284
+ end
285
+
286
+ add_index :biz_txn_agreement_role_types, :parent_id
287
+ end
288
+
289
+ unless table_exists?(:biz_txn_agreement_roles)
290
+ create_table :biz_txn_agreement_roles do |t|
291
+ t.references :biz_txn_event, :polymorphic => true
292
+ t.column :agreement_id, :integer
293
+ t.column :biz_txn_agreement_role_type_id, :integer
294
+ t.timestamps
295
+ end
296
+
297
+ add_index :biz_txn_agreement_roles, :agreement_id
298
+ add_index :biz_txn_agreement_roles, :biz_txn_agreement_role_type_id
299
+ end
300
+
301
+ unless table_exists?(:financial_txns)
302
+ create_table :financial_txns do |t|
303
+ t.integer :money_id
304
+ t.date :apply_date
305
+
306
+ t.timestamps
307
+ end
308
+ end
309
+
310
+ unless table_exists?(:financial_txn_assns)
311
+ create_table :financial_txn_assns do |t|
312
+ t.references :financial_txn
313
+ t.references :financial_txn_record, :polymorphic => true
314
+
315
+ t.timestamps
316
+ end
317
+ end
318
+
319
+ unless table_exists?(:financial_txn_accounts)
320
+ create_table :financial_txn_accounts do |t|
321
+ t.column :account_number, :string
322
+ t.column :agreement_id, :integer
323
+ t.column :balance_id, :integer
324
+ t.column :balance_date, :date
325
+ t.column :calculate_balance, :boolean
326
+ t.column :payment_due_id, :integer
327
+ t.column :due_date, :date
328
+
329
+ #polymorphic tables
330
+ t.references :financial_account, :polymorphic => true
331
+
332
+ t.timestamps
333
+ end
334
+ end
335
+
336
+ unless table_exists?(:base_txn_contexts)
337
+ create_table :base_txn_contexts do |t|
338
+ t.references :biz_txn_event
339
+ t.references :txn_context_record, :polymorphic => true
340
+
341
+ t.timestamps
342
+ end
343
+
344
+ add_index :base_txn_contexts, [:txn_context_record_id, :txn_context_record_type], :name => 'txn_context_record_idx'
345
+ end
346
+
347
+ end
348
+
349
+ def self.down
350
+ [
351
+ :biz_txn_agreement_roles, :biz_txn_agreement_role_types, :biz_acct_txn_tasks,
352
+ :biz_txn_acct_pty_rtypes, :biz_txn_acct_party_roles, :biz_txn_acct_relationships,
353
+ :biz_txn_acct_rel_types, :biz_txn_acct_statuses, :biz_txn_acct_types,
354
+ :biz_txn_acct_status_types, :biz_txn_acct_roots, :biz_txn_party_role_types,
355
+ :biz_txn_party_roles, :biz_txn_task_types, :biz_txn_tasks,
356
+ :biz_txn_statuses, :biz_txn_rel_types, :biz_txn_relationships,:base_txn_contexts,
357
+ :biz_txn_types, :biz_txn_event_descs, :biz_txn_events,:financial_txn_accounts,:financial_txns
358
+ ].each do |tbl|
359
+ if table_exists?(tbl)
360
+ drop_table tbl
361
+ end
362
+ end
363
+ end
364
+ end