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.
Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/app/models/order_line_item.rb +6 -0
  3. data/app/models/order_line_item_pty_role.rb +1 -1
  4. data/app/models/order_txn.rb +6 -3
  5. data/config/routes.rb +0 -10
  6. data/db/migrate/20131005232344_update_order_line_pty_role_indexes.erp_orders.rb +19 -0
  7. data/db/migrate/20131005232611_remove_order_line_specific_rtype.rb +32 -0
  8. data/db/migrate/20140129200040_add_uom_to_order_line_item.rb +13 -0
  9. data/db/migrate/20140930152140_add_custom_fields_to_order_txn.rb +12 -0
  10. data/lib/erp_orders/engine.rb +2 -1
  11. data/lib/erp_orders/extensions/active_record/acts_as_order_line_item.rb +71 -0
  12. data/lib/erp_orders/extensions/active_record/acts_as_order_txn.rb +62 -61
  13. data/lib/erp_orders/extensions.rb +2 -1
  14. data/lib/erp_orders/version.rb +7 -3
  15. metadata +33 -144
  16. data/app/assets/javascripts/erp_orders/application.js +0 -9
  17. data/app/assets/stylesheets/erp_orders/application.css +0 -7
  18. data/app/controllers/erp_orders/erp_app/desktop/order_manager/base_controller.rb +0 -147
  19. data/app/controllers/erp_orders/erp_app/organizer/order_management/base_controller.rb +0 -19
  20. data/app/helpers/erp_orders/application_helper.rb +0 -4
  21. data/app/models/line_item_role_type.rb +0 -6
  22. data/app/views/layouts/erp_orders/application.html.erb +0 -14
  23. data/db/data_migrations/20110728201731_create_desktop_app_order_manager.rb +0 -25
  24. data/db/data_migrations/20110728201732_create_organizer_app_order_management.rb +0 -14
  25. data/db/data_migrations/20120229174343_add_orders_widget.rb +0 -28
  26. data/public/javascripts/erp_app/desktop/applications/order_manager/line_items_grid_panel.js +0 -100
  27. data/public/javascripts/erp_app/desktop/applications/order_manager/module.js +0 -85
  28. data/public/javascripts/erp_app/desktop/applications/order_manager/orders_grid_panel.js +0 -162
  29. data/public/javascripts/erp_app/desktop/applications/order_manager/payments_grid_panel.js +0 -109
  30. data/public/javascripts/erp_app/organizer/applications/order_management/base.js +0 -124
  31. data/public/javascripts/erp_app/organizer/applications/order_management/extensions.js +0 -113
  32. data/public/javascripts/erp_app/organizer/applications/order_management/line_items_grid_panel.js +0 -99
  33. data/public/javascripts/erp_app/organizer/applications/order_management/orders_grid_panel.1.js +0 -209
  34. data/public/javascripts/erp_app/organizer/applications/order_management/payments_grid_panel.js +0 -93
  35. data/spec/dummy/db/data_migrations/20101011152441_payment_gateway_actions.erp_commerce.rb +0 -28
  36. data/spec/dummy/db/data_migrations/20101014142230_financial_txn_types.erp_txns_and_accts.rb +0 -16
  37. data/spec/dummy/db/data_migrations/20110109173616_create_capability_scope_types.erp_tech_svcs.rb +0 -15
  38. data/spec/dummy/db/data_migrations/20110324010232_product_role_types.erp_products.rb +0 -24
  39. data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +0 -12
  40. data/spec/dummy/db/data_migrations/20110527160807_add_default_prod_avail_types.erp_products.rb +0 -27
  41. data/spec/dummy/db/data_migrations/20110605231556_create_order_party_roles.erp_orders.rb +0 -24
  42. data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +0 -19
  43. data/spec/dummy/db/data_migrations/20110728201729_erp_app_setup.erp_app.rb +0 -252
  44. data/spec/dummy/db/data_migrations/20110728201730_create_desktop_app_product_manager.erp_products.rb +0 -26
  45. data/spec/dummy/db/data_migrations/20110728201731_create_desktop_app_order_manager.erp_orders.rb +0 -26
  46. data/spec/dummy/db/data_migrations/20110728201732_create_organizer_app_order_management.erp_orders.rb +0 -15
  47. data/spec/dummy/db/data_migrations/20110728201733_update_preferences.erp_app.rb +0 -53
  48. data/spec/dummy/db/data_migrations/20110802200222_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +0 -16
  49. data/spec/dummy/db/data_migrations/20110816161238_create_desktop_app_audit_log_viewer.erp_app.rb +0 -21
  50. data/spec/dummy/db/data_migrations/20110817160743_add_file_manager_application.erp_app.rb +0 -32
  51. data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +0 -12
  52. data/spec/dummy/db/data_migrations/20111108183739_add_default_capabilities.erp_app.rb +0 -23
  53. data/spec/dummy/db/data_migrations/20111108183740_add_new_contact_widgets.erp_app.rb +0 -42
  54. data/spec/dummy/db/data_migrations/20111111144706_setup_audit_log_types.erp_tech_svcs.rb +0 -22
  55. data/spec/dummy/db/data_migrations/20120229160222_add_userinfo_widget.erp_app.rb +0 -29
  56. data/spec/dummy/db/data_migrations/20120229174343_add_orders_widget.erp_orders.rb +0 -29
  57. data/spec/dummy/db/data_migrations/20120405193721_create_party_and_role_type_for_communication_events.erp_app.rb +0 -11
  58. data/spec/dummy/db/data_migrations/20120411180756_create_user_management_mobile_application.erp_app.rb +0 -19
  59. data/spec/dummy/db/data_migrations/20120418164215_create_configuration_management_desktop_application.erp_app.rb +0 -23
  60. data/spec/dummy/db/data_migrations/20121116155018_create_group_relationship_and_role_types.erp_tech_svcs.rb +0 -20
  61. data/spec/dummy/db/data_migrations/20121130201859_upgrade_remove_system_mgmt_app.erp_app.rb +0 -16
  62. data/spec/dummy/db/data_migrations/20121130212146_note_capabilities.erp_tech_svcs.rb +0 -24
  63. data/spec/dummy/db/data_migrations/20121218175028_create_security_management_desktop_application.erp_app.rb +0 -23
  64. data/spec/dummy/db/migrate/20130107205931_base_erp_services.erp_base_erp_svcs.rb +0 -461
  65. data/spec/dummy/db/migrate/20130107205932_base_orders.erp_orders.rb +0 -178
  66. data/spec/dummy/db/migrate/20130107205933_base_tech_services.erp_tech_svcs.rb +0 -271
  67. data/spec/dummy/db/migrate/20130107205934_create_has_attribute_tables.erp_tech_svcs.rb +0 -39
  68. data/spec/dummy/db/migrate/20130107205935_create_groups.erp_tech_svcs.rb +0 -19
  69. data/spec/dummy/db/migrate/20130107205936_upgrade_security.erp_tech_svcs.rb +0 -54
  70. data/spec/dummy/db/migrate/20130107205937_upgrade_security2.erp_tech_svcs.rb +0 -270
  71. data/spec/dummy/db/migrate/20130107205938_base_products.erp_products.rb +0 -234
  72. data/spec/dummy/db/migrate/20130107205939_base_products_indexes.erp_products.rb +0 -59
  73. data/spec/dummy/db/migrate/20130107205940_base_txns_and_accts.erp_txns_and_accts.rb +0 -364
  74. data/spec/dummy/db/migrate/20130107205941_agreements_services.erp_agreements.rb +0 -160
  75. data/spec/dummy/db/migrate/20130107205942_agreements_services_indexes.erp_agreements.rb +0 -52
  76. data/spec/dummy/db/migrate/20130107205943_base_app_framework.erp_app.rb +0 -276
  77. data/spec/dummy/db/migrate/20130107205944_erp_commerce_base.erp_commerce.rb +0 -442
  78. data/spec/dummy/db/schema.rb +0 -1821
  79. data/spec/dummy/db/spec.sqlite3 +0 -0
@@ -1,276 +0,0 @@
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
@@ -1,442 +0,0 @@
1
- # This migration comes from erp_commerce (originally 20100823174238)
2
- class ErpCommerceBase < ActiveRecord::Migration
3
- def self.up
4
- #fees
5
- unless table_exists?(:fees)
6
- create_table :fees do |t|
7
- t.references :fee_record, :polymorphic => true
8
- t.references :money
9
- t.references :fee_type
10
- t.string :description
11
- t.datetime :start_date
12
- t.datetime :end_date
13
- t.string :external_identifier
14
- t.string :external_id_source
15
-
16
- t.timestamps
17
- end
18
-
19
- add_index :fees, [:fee_record_id, :fee_record_type], :name => 'fee_record_idx'
20
- add_index :fees, :fee_type_id
21
- add_index :fees, :money_id
22
- end
23
-
24
- unless table_exists?(:fee_types)
25
- create_table :fee_types do |t|
26
- t.string :internal_identifier
27
- t.string :description
28
- t.string :comments
29
- t.string :external_identifier
30
- t.string :external_id_source
31
-
32
- #these columns are required to support the behavior of the plugin 'awesome_nested_set'
33
- t.integer :parent_id
34
- t.integer :lft
35
- t.integer :rgt
36
-
37
- t.timestamps
38
- end
39
- end
40
-
41
- #pricing tables
42
- unless table_exists?(:price_component_types)
43
- create_table :price_component_types do |t|
44
-
45
- t.string :description
46
- t.string :internal_identifier
47
- t.string :external_identifier
48
- t.string :external_id_source
49
-
50
- t.timestamps
51
- end
52
- end
53
-
54
- unless table_exists?(:pricing_plans)
55
- create_table :pricing_plans do |t|
56
-
57
- t.string :description
58
- t.string :comments
59
-
60
- t.string :internal_identifier
61
-
62
- t.string :external_identifier
63
- t.string :external_id_source
64
-
65
- t.date :from_date
66
- t.date :thru_date
67
-
68
- #this is here as a placeholder for an 'interpreter' or 'rule' pattern
69
- t.string :matching_rules
70
- #this is here as a placeholder for an 'interpreter' or 'rule' pattern
71
- t.string :pricing_calculation
72
-
73
- #support for simple assignment of a single money amount
74
- t.boolean :is_simple_amount
75
- t.integer :currency_id
76
- t.decimal :money_amount, :precision => 8, :scale => 2
77
-
78
- t.timestamps
79
- end
80
- end
81
-
82
- unless table_exists?(:pricing_plan_components)
83
- create_table :pricing_plan_components do |t|
84
-
85
- t.integer :price_component_type_id
86
- t.string :description
87
- t.string :comments
88
-
89
- t.string :internal_identifier
90
- t.string :external_identifier
91
- t.string :external_id_source
92
-
93
-
94
- #this is here as a placeholder for an 'interpreter' or 'rule' pattern
95
- t.string :matching_rules
96
- #this is here as a placeholder for an 'interpreter' or 'rule' pattern
97
- t.string :pricing_calculation
98
-
99
- #support for simple assignment of a single money amount
100
- t.boolean :is_simple_amount
101
- t.integer :currency_id
102
- t.decimal :money_amount, :precision => 8, :scale => 2
103
-
104
- t.timestamps
105
-
106
- end
107
- add_index :pricing_plan_components, :price_component_type_id
108
- end
109
-
110
- unless table_exists?(:valid_price_plan_components)
111
- create_table :valid_price_plan_components do |t|
112
-
113
- t.references :pricing_plan
114
- t.references :pricing_plan_component
115
-
116
- t.timestamps
117
-
118
- end
119
- add_index :valid_price_plan_components, :pricing_plan_id
120
- add_index :valid_price_plan_components, :pricing_plan_component_id
121
- end
122
-
123
- unless table_exists?(:pricing_plan_assignments)
124
- create_table :pricing_plan_assignments do |t|
125
-
126
- t.references :pricing_plan
127
-
128
- #support a polymorhic interface to the thing we want to price
129
- t.integer :priceable_item_id
130
- t.string :priceable_item_type
131
-
132
- t.integer :priority
133
-
134
- t.timestamps
135
-
136
- end
137
- add_index :pricing_plan_assignments, :pricing_plan_id
138
- add_index :pricing_plan_assignments, [:priceable_item_id,:priceable_item_type], :name => 'priceable_item_idx'
139
- end
140
-
141
- unless table_exists?(:prices)
142
- create_table :prices do |t|
143
-
144
- t.string :description
145
-
146
- #support a polymorhic interface to the thing that HAS BEEN priced
147
- t.integer :priced_item_id
148
- t.string :priced_item_type
149
-
150
- #refer to the pricing plan by which this price was calculated
151
- t.references :pricing_plan
152
-
153
- t.references :money
154
-
155
- t.timestamps
156
-
157
- end
158
- add_index :prices, :money_id
159
- add_index :prices, :pricing_plan_id
160
- add_index :prices, [:priced_item_id,:priced_item_type], :name => 'priced_item_idx'
161
- end
162
-
163
- unless table_exists?(:price_components)
164
- create_table :price_components do |t|
165
-
166
- t.string :description
167
- t.references :pricing_plan_component
168
- t.references :price
169
- t.references :money
170
-
171
- #polymorphic relationship
172
- t.integer :priced_component_id
173
- t.string :priced_component_type
174
-
175
- t.timestamps
176
-
177
- end
178
- add_index :price_components, :money_id
179
- add_index :price_components, :pricing_plan_component_id
180
- add_index :price_components, :price_id
181
- add_index :price_components, [:priced_component_id,:priced_component_type], :name => 'priced_component_idx'
182
- end
183
-
184
- #payment tables
185
- unless table_exists?(:payments)
186
- create_table :payments do |t|
187
-
188
- t.column :success, :boolean
189
- t.column :reference_number, :string
190
- t.column :financial_txn_id, :integer
191
- t.column :current_state, :string
192
- t.column :authorization_code, :string
193
- t.string :external_identifier
194
-
195
- t.timestamps
196
- end
197
-
198
- add_index :payments, :financial_txn_id
199
- end
200
-
201
- unless table_exists?(:payment_gateways)
202
- create_table :payment_gateways do |t|
203
-
204
- t.column :params, :string
205
- t.column :payment_gateway_action_id, :integer
206
- t.column :payment_id, :integer
207
- t.column :response, :string
208
-
209
- t.timestamps
210
- end
211
- end
212
-
213
- unless table_exists?(:payment_gateway_actions)
214
- create_table :payment_gateway_actions do |t|
215
-
216
- t.column :internal_identifier, :string
217
- t.column :description, :string
218
-
219
- t.timestamps
220
- end
221
- end
222
-
223
- add_index :payment_gateway_actions, :internal_identifier
224
-
225
- #tables
226
- unless table_exists?(:credit_cards)
227
- create_table :credit_cards do |t|
228
-
229
- t.column :crypted_private_card_number, :string
230
- t.column :expiration_month, :integer
231
- t.column :expiration_year, :integer
232
-
233
- t.column :description, :string
234
- t.column :first_name_on_card, :string
235
- t.column :last_name_on_card, :string
236
- t.column :card_type, :string
237
-
238
- t.column :postal_address_id, :integer
239
- t.column :credit_card_account_purpose_id, :integer
240
- t.column :credit_card_token, :string
241
-
242
- t.timestamps
243
- end
244
- end
245
-
246
- unless table_exists?(:credit_card_accounts)
247
- create_table :credit_card_accounts do |t|
248
-
249
- t.timestamps
250
- end
251
- end
252
-
253
- unless table_exists?(:credit_card_account_party_roles)
254
- create_table :credit_card_account_party_roles do |t|
255
- t.column :credit_card_account_id, :integer
256
- t.column :role_type_id, :integer
257
- t.column :party_id, :integer
258
- t.column :credit_card_id, :integer
259
-
260
- t.timestamps
261
- end
262
-
263
- add_index :credit_card_account_party_roles, :credit_card_account_id
264
- add_index :credit_card_account_party_roles, :role_type_id
265
- add_index :credit_card_account_party_roles, :party_id
266
- add_index :credit_card_account_party_roles, :credit_card_id
267
- end
268
-
269
- unless table_exists?(:credit_card_account_purposes)
270
- create_table :credit_card_account_purposes do |t|
271
-
272
- t.column :parent_id, :integer
273
- t.column :lft, :integer
274
- t.column :rgt, :integer
275
-
276
- #custom columns go here
277
-
278
- t.column :description, :string
279
- t.column :comments, :string
280
-
281
- t.column :internal_identifier, :string
282
- t.column :external_identifier, :string
283
- t.column :external_id_source, :string
284
-
285
- t.timestamps
286
- end
287
- end
288
-
289
- unless table_exists?(:accepted_credit_cards)
290
- create_table :accepted_credit_cards do |t|
291
-
292
- t.references :organization
293
- t.string :card_type
294
-
295
- t.timestamps
296
- end
297
- end
298
-
299
- unless table_exists?(:bank_account_types)
300
- create_table :bank_account_types do |t|
301
- t.string :description
302
- t.string :internal_identifier
303
-
304
- t.timestamps
305
- end
306
- end
307
-
308
- unless table_exists?(:bank_accounts)
309
- create_table :bank_accounts do |t|
310
- t.string :routing_number
311
- t.string :crypted_private_account_number
312
- t.string :name_on_account
313
- t.references :bank_account_type
314
-
315
- t.timestamps
316
- end
317
-
318
- add_index :bank_accounts, :bank_account_type_id, :name => 'bank_accounts_account_type_idx'
319
- end
320
- #end tables
321
-
322
- #columns
323
- unless columns(:order_txns).collect {|c| c.name}.include?('payment_gateway_txn_id')
324
- add_column :order_txns, :payment_gateway_txn_id, :string
325
- end
326
-
327
- unless columns(:order_txns).collect {|c| c.name}.include?('credit_card_id')
328
- add_column :order_txns, :credit_card_id, :integer
329
- end
330
-
331
- unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_first_name')
332
- add_column :order_txns, :bill_to_first_name, :string
333
- end
334
-
335
- unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_last_name')
336
- add_column :order_txns, :bill_to_last_name, :string
337
- end
338
-
339
- unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_address_line_1')
340
- add_column :order_txns, :bill_to_address_line_1, :string
341
- end
342
-
343
- unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_address_line_2')
344
- add_column :order_txns, :bill_to_address_line_2, :string
345
- end
346
-
347
- unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_city')
348
- add_column :order_txns, :bill_to_city, :string
349
- end
350
-
351
- unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_state')
352
- add_column :order_txns, :bill_to_state, :string
353
- end
354
-
355
- unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_postal_code')
356
- add_column :order_txns, :bill_to_postal_code, :string
357
- end
358
-
359
- unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_country')
360
- add_column :order_txns, :bill_to_country, :string
361
- end
362
-
363
- unless columns(:order_txns).collect {|c| c.name}.include?('bill_to_country_name')
364
- rename_column :order_txns, :bill_to_country, :bill_to_country_name
365
- rename_column :order_txns, :ship_to_country, :ship_to_country_name
366
- add_column :order_txns, :bill_to_country, :string
367
- add_column :order_txns, :ship_to_country, :string
368
- end
369
- #end
370
- end
371
-
372
- def self.down
373
-
374
- if columns(:order_txns).collect {|c| c.name}.include?('payment_gateway_txn_id')
375
- remove_column :order_txns, :payment_gateway_txn_id
376
- end
377
-
378
- if columns(:order_txns).collect {|c| c.name}.include?('credit_card_id')
379
- remove_column :order_txns, :credit_card_id, :integer
380
- end
381
-
382
- if columns(:order_txns).collect {|c| c.name}.include?('bill_to_first_name')
383
- remove_column :order_txns, :bill_to_first_name, :string
384
- end
385
-
386
- if columns(:order_txns).collect {|c| c.name}.include?('bill_to_last_name')
387
- remove_column :order_txns, :bill_to_last_name, :string
388
- end
389
-
390
- if columns(:order_txns).collect {|c| c.name}.include?('bill_to_address')
391
- remove_column :order_txns, :bill_to_address, :string
392
- end
393
-
394
- if columns(:order_txns).collect {|c| c.name}.include?('bill_to_city')
395
- remove_column :order_txns, :bill_to_city, :string
396
- end
397
-
398
- if columns(:order_txns).collect {|c| c.name}.include?('bill_to_state')
399
- remove_column :order_txns, :bill_to_state, :string
400
- end
401
-
402
- if columns(:order_txns).collect {|c| c.name}.include?('bill_to_postal_code')
403
- remove_column :order_txns, :bill_to_postal_code, :string
404
- end
405
-
406
- if columns(:order_txns).collect {|c| c.name}.include?('bill_to_country')
407
- remove_column :order_txns, :bill_to_country, :string
408
- end
409
-
410
- if columns(:order_txns).collect {|c| c.name}.include?('bill_to_country_name')
411
- remove_column :order_txns, :bill_to_country, :bill_to_country_name
412
- remove_column :order_txns, :ship_to_country, :ship_to_country_name
413
- end
414
-
415
- #tables
416
- drop_tables = [
417
- :bank_account_types,
418
- :bank_accounts,
419
- :credit_cards,
420
- :credit_card_accounts,
421
- :credit_card_account_party_roles,
422
- :credit_card_account_purposes,
423
- :payments,
424
- :payment_gateways,
425
- :payment_gateway_actions,
426
- :pricing_plans,
427
- :pricing_plan_components,
428
- :valid_price_plan_components,
429
- :pricing_plan_assignments,
430
- :prices,
431
- :price_components,
432
- :price_component_types,
433
- :fees,:fee_types
434
- ]
435
- drop_tables.each do |table|
436
- if table_exists?(table)
437
- drop_table table
438
- end
439
- end
440
-
441
- end
442
- end