erp_rules 3.1.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/erp_rules/rules_engine/pricing_engine.rb +1 -1
- data/lib/erp_rules/search/search_base.rb +1 -1
- data/lib/erp_rules/version.rb +6 -2
- metadata +27 -115
- data/app/assets/javascripts/erp_rules/application.js +0 -9
- data/app/assets/stylesheets/erp_rules/application.css +0 -7
- data/app/controllers/erp_rules/application_controller.rb +0 -4
- data/app/helpers/erp_rules/application_helper.rb +0 -4
- data/app/views/layouts/erp_rules/application.html.erb +0 -14
- 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/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +0 -12
- 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/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/20120109173616_create_download_capability_type.erp_tech_svcs.rb +0 -14
- data/spec/dummy/db/data_migrations/20120229160222_add_userinfo_widget.erp_app.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/20121214005236_base_erp_services.erp_base_erp_svcs.rb +0 -461
- data/spec/dummy/db/migrate/20121214005237_base_tech_services.erp_tech_svcs.rb +0 -255
- data/spec/dummy/db/migrate/20121214005238_create_has_attribute_tables.erp_tech_svcs.rb +0 -39
- data/spec/dummy/db/migrate/20121214005239_base_txns_and_accts.erp_txns_and_accts.rb +0 -364
- data/spec/dummy/db/migrate/20121214005240_agreements_services.erp_agreements.rb +0 -160
- data/spec/dummy/db/migrate/20121214005241_agreements_services_indexes.erp_agreements.rb +0 -52
- data/spec/dummy/db/migrate/20121214005242_base_app_framework.erp_app.rb +0 -276
- data/spec/dummy/db/migrate/20130107181307_create_groups.erp_tech_svcs.rb +0 -19
- data/spec/dummy/db/migrate/20130107181308_upgrade_security.erp_tech_svcs.rb +0 -54
- data/spec/dummy/db/migrate/20130107181309_upgrade_security2.erp_tech_svcs.rb +0 -270
- data/spec/dummy/db/schema.rb +0 -1247
- data/spec/dummy/db/spec.sqlite3 +0 -0
- data/spec/dummy/log/spec.log +0 -10110
@@ -1,255 +0,0 @@
|
|
1
|
-
# This migration comes from erp_tech_svcs (originally 20080805000010)
|
2
|
-
class BaseTechServices < ActiveRecord::Migration
|
3
|
-
def self.up
|
4
|
-
unless table_exists?(:users)
|
5
|
-
# Create the users table
|
6
|
-
create_table :users do |t|
|
7
|
-
t.string :username
|
8
|
-
t.string :email
|
9
|
-
t.references :party
|
10
|
-
t.string :type
|
11
|
-
t.string :salt, :default => nil
|
12
|
-
t.string :crypted_password, :default => nil
|
13
|
-
|
14
|
-
#activity logging
|
15
|
-
t.datetime :last_login_at, :default => nil
|
16
|
-
t.datetime :last_logout_at, :default => nil
|
17
|
-
t.datetime :last_activity_at, :default => nil
|
18
|
-
|
19
|
-
#brute force protection
|
20
|
-
t.integer :failed_logins_count, :default => 0
|
21
|
-
t.datetime :lock_expires_at, :default => nil
|
22
|
-
|
23
|
-
#remember me
|
24
|
-
t.string :remember_me_token, :default => nil
|
25
|
-
t.datetime :remember_me_token_expires_at, :default => nil
|
26
|
-
|
27
|
-
#reset password
|
28
|
-
t.string :reset_password_token, :default => nil
|
29
|
-
t.datetime :reset_password_token_expires_at, :default => nil
|
30
|
-
t.datetime :reset_password_email_sent_at, :default => nil
|
31
|
-
|
32
|
-
#user activation
|
33
|
-
t.string :activation_state, :default => nil
|
34
|
-
t.string :activation_token, :default => nil
|
35
|
-
t.datetime :activation_token_expires_at, :default => nil
|
36
|
-
|
37
|
-
t.string :security_question_1
|
38
|
-
t.string :security_answer_1
|
39
|
-
t.string :security_question_2
|
40
|
-
t.string :security_answer_2
|
41
|
-
|
42
|
-
t.timestamps
|
43
|
-
end
|
44
|
-
add_index :users, :email, :unique => true
|
45
|
-
add_index :users, :username, :unique => true
|
46
|
-
add_index :users, [:last_logout_at, :last_activity_at], :name => 'activity_idx'
|
47
|
-
add_index :users, :remember_me_token
|
48
|
-
add_index :users, :reset_password_token
|
49
|
-
add_index :users, :activation_token
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
unless table_exists?(:roles)
|
54
|
-
# create the roles table
|
55
|
-
create_table :roles do |t|
|
56
|
-
t.column :description, :string
|
57
|
-
t.column :internal_identifier, :string
|
58
|
-
t.column :external_identifier, :string
|
59
|
-
t.column :external_id_source, :string
|
60
|
-
|
61
|
-
t.timestamps
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
unless table_exists?(:sessions)
|
66
|
-
# Create sessions table
|
67
|
-
create_table :sessions do |t|
|
68
|
-
t.string :session_id, :null => false
|
69
|
-
t.text :data
|
70
|
-
t.timestamps
|
71
|
-
end
|
72
|
-
add_index :sessions, :session_id
|
73
|
-
add_index :sessions, :updated_at
|
74
|
-
end
|
75
|
-
|
76
|
-
unless table_exists?(:audit_logs)
|
77
|
-
# Create audit_logs
|
78
|
-
create_table :audit_logs do |t|
|
79
|
-
t.string :application
|
80
|
-
t.string :description
|
81
|
-
t.integer :party_id
|
82
|
-
t.text :additional_info
|
83
|
-
t.references :audit_log_type
|
84
|
-
|
85
|
-
#polymorphic columns
|
86
|
-
t.references :event_record, :polymorphic => true
|
87
|
-
|
88
|
-
t.timestamps
|
89
|
-
end
|
90
|
-
add_index :audit_logs, :party_id
|
91
|
-
add_index :audit_logs, [:event_record_id, :event_record_type], :name => 'event_record_index'
|
92
|
-
end
|
93
|
-
|
94
|
-
unless table_exists?(:audit_log_types)
|
95
|
-
# Create audit_logs
|
96
|
-
create_table :audit_log_types do |t|
|
97
|
-
t.string :description
|
98
|
-
t.string :error_code
|
99
|
-
t.string :comments
|
100
|
-
t.string :internal_identifier
|
101
|
-
t.string :external_identifier
|
102
|
-
t.string :external_id_source
|
103
|
-
|
104
|
-
#better nested set columns
|
105
|
-
t.integer :parent_id
|
106
|
-
t.integer :lft
|
107
|
-
t.integer :rgt
|
108
|
-
|
109
|
-
t.timestamps
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
unless table_exists?(:audit_log_items)
|
114
|
-
# Create audit_log_items
|
115
|
-
create_table :audit_log_items do |t|
|
116
|
-
t.references :audit_log
|
117
|
-
t.references :audit_log_item_type
|
118
|
-
t.string :audit_log_item_value
|
119
|
-
t.string :description
|
120
|
-
|
121
|
-
t.timestamps
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
unless table_exists?(:audit_log_item_types)
|
126
|
-
# Create audit_log_item_types
|
127
|
-
create_table :audit_log_item_types do |t|
|
128
|
-
t.string :internal_identifier
|
129
|
-
t.string :external_identifier
|
130
|
-
t.string :external_id_source
|
131
|
-
t.string :description
|
132
|
-
t.string :comments
|
133
|
-
|
134
|
-
#better nested set columns
|
135
|
-
t.integer :parent_id
|
136
|
-
t.integer :lft
|
137
|
-
t.integer :rgt
|
138
|
-
|
139
|
-
t.timestamps
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
unless table_exists?(:secured_models)
|
144
|
-
create_table :secured_models do |t|
|
145
|
-
t.references :secured_record, :polymorphic => true
|
146
|
-
|
147
|
-
t.timestamps
|
148
|
-
end
|
149
|
-
add_index :secured_models, [:secured_record_id, :secured_record_type], :name => 'secured_record_idx'
|
150
|
-
end
|
151
|
-
|
152
|
-
unless table_exists?(:roles_secured_models)
|
153
|
-
create_table :roles_secured_models, :id => false do |t|
|
154
|
-
t.references :secured_model
|
155
|
-
t.references :role
|
156
|
-
end
|
157
|
-
add_index :roles_secured_models, :secured_model_id
|
158
|
-
add_index :roles_secured_models, :role_id
|
159
|
-
end
|
160
|
-
|
161
|
-
unless table_exists?(:file_assets)
|
162
|
-
create_table :file_assets do |t|
|
163
|
-
t.references :file_asset_holder, :polymorphic => true
|
164
|
-
t.string :type
|
165
|
-
t.string :name
|
166
|
-
t.string :directory
|
167
|
-
t.string :data_file_name
|
168
|
-
t.string :data_content_type
|
169
|
-
t.integer :data_file_size
|
170
|
-
t.datetime :data_updated_at
|
171
|
-
t.string :width
|
172
|
-
t.string :height
|
173
|
-
|
174
|
-
t.timestamps
|
175
|
-
end
|
176
|
-
add_index :file_assets, :type
|
177
|
-
add_index :file_assets, [:file_asset_holder_id, :file_asset_holder_type], :name => 'file_asset_holder_idx'
|
178
|
-
add_index :file_assets, :name
|
179
|
-
add_index :file_assets, :directory
|
180
|
-
end
|
181
|
-
|
182
|
-
unless table_exists?(:delayed_jobs)
|
183
|
-
create_table :delayed_jobs, :force => true do |table|
|
184
|
-
table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue
|
185
|
-
table.integer :attempts, :default => 0 # Provides for retries, but still fail eventually.
|
186
|
-
table.text :handler # YAML-encoded string of the object that will do work
|
187
|
-
table.text :last_error # reason for last failure (See Note below)
|
188
|
-
table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future.
|
189
|
-
table.datetime :locked_at # Set when a client is working on this object
|
190
|
-
table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead)
|
191
|
-
table.string :locked_by # Who is working on this object (if locked)
|
192
|
-
table.string :queue
|
193
|
-
table.timestamps
|
194
|
-
end
|
195
|
-
add_index :delayed_jobs, [:priority, :run_at], :name => 'delayed_jobs_priority'
|
196
|
-
end
|
197
|
-
|
198
|
-
unless table_exists?(:capable_models)
|
199
|
-
# create the roles table
|
200
|
-
create_table :capable_models do |t|
|
201
|
-
t.references :capable_model_record, :polymorphic => true
|
202
|
-
|
203
|
-
t.timestamps
|
204
|
-
end
|
205
|
-
|
206
|
-
add_index :capable_models, [:capable_model_record_id, :capable_model_record_type], :name => 'capable_model_record_idx'
|
207
|
-
end
|
208
|
-
|
209
|
-
unless table_exists?(:capability_types)
|
210
|
-
# create the roles table
|
211
|
-
create_table :capability_types do |t|
|
212
|
-
t.string :internal_identifier
|
213
|
-
t.string :description
|
214
|
-
t.timestamps
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
unless table_exists?(:capabilities)
|
219
|
-
# create the roles table
|
220
|
-
create_table :capabilities do |t|
|
221
|
-
t.string :resource
|
222
|
-
t.references :capability_type
|
223
|
-
t.timestamps
|
224
|
-
end
|
225
|
-
|
226
|
-
add_index :capabilities, :capability_type_id
|
227
|
-
end
|
228
|
-
|
229
|
-
unless table_exists?(:capabilities_capable_models)
|
230
|
-
# create the roles table
|
231
|
-
create_table :capabilities_capable_models, :id => false do |t|
|
232
|
-
t.references :capable_model
|
233
|
-
t.references :capability
|
234
|
-
end
|
235
|
-
|
236
|
-
add_index :capabilities_capable_models, :capable_model_id
|
237
|
-
add_index :capabilities_capable_models, :capability_id
|
238
|
-
end
|
239
|
-
|
240
|
-
end
|
241
|
-
|
242
|
-
def self.down
|
243
|
-
# check that each table exists before trying to delete it.
|
244
|
-
[
|
245
|
-
:audit_logs, :sessions, :simple_captcha_data,
|
246
|
-
:capable_models, :capability_types, :capabilities,:capabilities_capable_models,
|
247
|
-
:roles_users, :roles, :audit_log_items, :audit_log_item_types,
|
248
|
-
:users, :secured_models, :roles_secured_models, :file_assets, :delayed_jobs
|
249
|
-
].each do |tbl|
|
250
|
-
if table_exists?(tbl)
|
251
|
-
drop_table tbl
|
252
|
-
end
|
253
|
-
end
|
254
|
-
end
|
255
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# This migration comes from erp_tech_svcs (originally 20111117183144)
|
2
|
-
class CreateHasAttributeTables < ActiveRecord::Migration
|
3
|
-
def up
|
4
|
-
unless table_exists?(:attribute_types)
|
5
|
-
create_table :attribute_types do |t|
|
6
|
-
t.string :internal_identifier
|
7
|
-
t.string :description
|
8
|
-
t.string :data_type
|
9
|
-
|
10
|
-
t.timestamps
|
11
|
-
end
|
12
|
-
|
13
|
-
add_index :attribute_types, :internal_identifier, :name => ':attribute_types_iid_idx'
|
14
|
-
end
|
15
|
-
unless table_exists?(:attribute_values)
|
16
|
-
create_table :attribute_values do |t|
|
17
|
-
t.integer :attributed_record_id
|
18
|
-
t.string :attributed_record_type
|
19
|
-
t.references :attribute_type
|
20
|
-
t.string :value
|
21
|
-
|
22
|
-
t.timestamps
|
23
|
-
end
|
24
|
-
|
25
|
-
add_index :attribute_values, [:attributed_record_id, :attributed_record_type], :name => 'attribute_values_attributed_record_idx'
|
26
|
-
add_index :attribute_values, :attribute_type_id, :name => 'attribute_values_attributed_type_idx'
|
27
|
-
add_index :attribute_values, :value, :name => 'attribute_values_value_idx'
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def down
|
32
|
-
if table_exists?(:attribute_types)
|
33
|
-
drop_table :attribute_types
|
34
|
-
end
|
35
|
-
if table_exists?(:attribute_values)
|
36
|
-
drop_table :attribute_values
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
@@ -1,364 +0,0 @@
|
|
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
|