erp_base_erp_svcs 3.0.7 → 3.1.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.
- data/app/models/category.rb +2 -1
- data/app/models/category_classification.rb +2 -0
- data/app/models/compass_ae_instance.rb +1 -1
- data/app/models/contact.rb +34 -32
- data/app/models/contact_purpose.rb +6 -4
- data/app/models/contact_type.rb +3 -1
- data/app/models/currency.rb +6 -4
- data/app/models/descriptive_asset.rb +2 -0
- data/app/models/email_address.rb +2 -0
- data/app/models/geo_country.rb +2 -0
- data/app/models/geo_zone.rb +2 -0
- data/app/models/individual.rb +2 -0
- data/app/models/iso_country_code.rb +0 -1
- data/app/models/money.rb +1 -0
- data/app/models/note.rb +2 -0
- data/app/models/note_type.rb +2 -0
- data/app/models/organization.rb +2 -0
- data/app/models/party.rb +4 -3
- data/app/models/party_relationship.rb +6 -5
- data/app/models/party_role.rb +7 -5
- data/app/models/phone_number.rb +2 -0
- data/app/models/postal_address.rb +2 -0
- data/app/models/relationship_type.rb +7 -5
- data/app/models/role_type.rb +2 -0
- data/app/models/valid_note_type.rb +2 -0
- data/app/models/view_type.rb +2 -0
- data/db/data_migrations/20110913145838_setup_compass_ae_instance.rb +1 -1
- data/db/migrate/20080805000020_base_erp_services.rb +222 -222
- data/lib/erp_base_erp_svcs/engine.rb +2 -0
- data/lib/erp_base_erp_svcs/extensions/active_record/migration.rb +39 -0
- data/lib/erp_base_erp_svcs/extensions.rb +1 -2
- data/lib/erp_base_erp_svcs/version.rb +2 -2
- data/lib/erp_base_erp_svcs.rb +15 -15
- data/lib/tasks/erp_base_erp_svcs_tasks.rake +58 -23
- data/spec/dummy/config/application.rb +6 -0
- data/spec/dummy/config/environments/spec.rb +3 -0
- data/spec/dummy/db/data_migrations/20110525001935_add_usd_currency.erp_base_erp_svcs.rb +12 -0
- data/spec/dummy/db/data_migrations/20110609150135_add_iso_codes.erp_base_erp_svcs.rb +19 -0
- data/spec/dummy/db/data_migrations/20110913145838_setup_compass_ae_instance.erp_base_erp_svcs.rb +12 -0
- data/spec/dummy/db/migrate/20130107214414_base_erp_services.erp_base_erp_svcs.rb +461 -0
- data/spec/dummy/db/schema.rb +383 -0
- data/spec/dummy/db/spec.sqlite3 +0 -0
- data/spec/dummy/log/spec.log +17576 -0
- data/spec/models/email_address_spec.rb +1 -1
- data/spec/models/party_spec.rb +19 -19
- data/spec/spec_helper.rb +14 -5
- metadata +70 -149
- data/db/migrate/20110913145329_create_compass_ae_instance.rb +0 -15
- data/db/migrate/upgrade/20110907171257_add_notes.rb +0 -63
- data/lib/erp_base_erp_svcs/extensions/active_record/data_migrator.rb +0 -46
- data/lib/erp_base_erp_svcs/extensions/active_record/migrator.rb +0 -76
@@ -1,284 +1,284 @@
|
|
1
1
|
class BaseErpServices < ActiveRecord::Migration
|
2
2
|
def self.up
|
3
|
-
|
3
|
+
|
4
4
|
unless table_exists?(:compass_ae_instances)
|
5
5
|
create_table :compass_ae_instances do |t|
|
6
|
-
t.decimal :version
|
6
|
+
t.decimal :version, :precision => 8, :scale => 3
|
7
7
|
|
8
8
|
t.timestamps
|
9
9
|
end
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
# Create parties table
|
13
13
|
unless table_exists?(:parties)
|
14
14
|
create_table :parties do |t|
|
15
|
-
t.column
|
16
|
-
t.column
|
17
|
-
t.column
|
18
|
-
t.column
|
19
|
-
|
15
|
+
t.column :description, :string
|
16
|
+
t.column :business_party_id, :integer
|
17
|
+
t.column :business_party_type, :string
|
18
|
+
t.column :list_view_image_id, :integer
|
19
|
+
|
20
20
|
#This field is here to provide a direct way to map CompassERP
|
21
21
|
#business parties to unified idenfiers in organizations if they
|
22
22
|
#have been implemented in an enterprise.
|
23
|
-
t.column
|
23
|
+
t.column :enterprise_identifier, :string
|
24
24
|
t.timestamps
|
25
25
|
end
|
26
26
|
add_index :parties, [:business_party_id, :business_party_type], :name => "besi_1"
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
# Create party_roles table
|
30
30
|
unless table_exists?(:party_roles)
|
31
31
|
create_table :party_roles do |t|
|
32
32
|
#this column holds the class name of the
|
33
33
|
#subtype of party-to-role_type relatsionship
|
34
|
-
t.column
|
34
|
+
t.column :type, :string
|
35
35
|
#xref between party and role_type
|
36
|
-
t.column
|
37
|
-
|
38
|
-
|
36
|
+
t.column :party_id, :integer
|
37
|
+
t.column :role_type_id, :integer
|
38
|
+
t.timestamps
|
39
39
|
end
|
40
|
-
|
41
|
-
|
40
|
+
add_index :party_roles, :party_id
|
41
|
+
add_index :party_roles, :role_type_id
|
42
42
|
end
|
43
|
-
|
44
|
-
|
43
|
+
|
44
|
+
|
45
45
|
# Create role_types table
|
46
46
|
unless table_exists?(:role_types)
|
47
47
|
create_table :role_types do |t|
|
48
48
|
#these columns are required to support the behavior of the plugin 'awesome_nested_set'
|
49
|
-
t.column
|
50
|
-
t.column
|
51
|
-
t.column
|
49
|
+
t.column :parent_id, :integer
|
50
|
+
t.column :lft, :integer
|
51
|
+
t.column :rgt, :integer
|
52
52
|
|
53
53
|
#custom columns go here
|
54
|
-
t.column
|
55
|
-
t.column
|
56
|
-
|
57
|
-
|
58
|
-
|
54
|
+
t.column :description, :string
|
55
|
+
t.column :comments, :string
|
56
|
+
t.column :internal_identifier, :string
|
57
|
+
t.column :external_identifier, :string
|
58
|
+
t.column :external_id_source, :string
|
59
59
|
t.timestamps
|
60
60
|
end
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
# Create relationship_types table
|
64
64
|
unless table_exists?(:relationship_types)
|
65
65
|
create_table :relationship_types do |t|
|
66
|
-
t.column
|
67
|
-
t.column
|
68
|
-
t.column
|
66
|
+
t.column :parent_id, :integer
|
67
|
+
t.column :lft, :integer
|
68
|
+
t.column :rgt, :integer
|
69
69
|
|
70
70
|
#custom columns go here
|
71
|
-
t.column
|
72
|
-
t.column
|
73
|
-
t.column
|
74
|
-
t.column
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
71
|
+
t.column :valid_from_role_type_id, :integer
|
72
|
+
t.column :valid_to_role_type_id, :integer
|
73
|
+
t.column :name, :string
|
74
|
+
t.column :description, :string
|
75
|
+
|
76
|
+
t.column :internal_identifier, :string
|
77
|
+
t.column :external_identifier, :string
|
78
|
+
t.column :external_id_source, :string
|
79
79
|
t.timestamps
|
80
80
|
end
|
81
|
-
|
82
|
-
|
81
|
+
add_index :relationship_types, :valid_from_role_type_id
|
82
|
+
add_index :relationship_types, :valid_to_role_type_id
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
85
|
# Create party_relationships table
|
86
86
|
unless table_exists?(:party_relationships)
|
87
87
|
create_table :party_relationships do |t|
|
88
|
-
t.column
|
89
|
-
t.column
|
90
|
-
t.column
|
91
|
-
t.column
|
92
|
-
t.column
|
93
|
-
t.column
|
94
|
-
t.column
|
95
|
-
t.column
|
96
|
-
t.column
|
97
|
-
t.column
|
98
|
-
|
99
|
-
|
100
|
-
|
88
|
+
t.column :description, :string
|
89
|
+
t.column :party_id_from, :integer
|
90
|
+
t.column :party_id_to, :integer
|
91
|
+
t.column :role_type_id_from, :integer
|
92
|
+
t.column :role_type_id_to, :integer
|
93
|
+
t.column :status_type_id, :integer
|
94
|
+
t.column :priority_type_id, :integer
|
95
|
+
t.column :relationship_type_id, :integer
|
96
|
+
t.column :from_date, :date
|
97
|
+
t.column :thru_date, :date
|
98
|
+
t.column :external_identifier, :string
|
99
|
+
t.column :external_id_source, :string
|
100
|
+
t.timestamps
|
101
101
|
end
|
102
|
-
|
102
|
+
add_index :party_relationships, :status_type_id
|
103
103
|
add_index :party_relationships, :priority_type_id
|
104
104
|
add_index :party_relationships, :relationship_type_id
|
105
105
|
end
|
106
|
-
|
106
|
+
|
107
107
|
# Create organizations table
|
108
108
|
unless table_exists?(:organizations)
|
109
109
|
create_table :organizations do |t|
|
110
|
-
|
111
|
-
|
112
|
-
|
110
|
+
t.column :description, :string
|
111
|
+
t.column :tax_id_number, :string
|
112
|
+
t.timestamps
|
113
113
|
end
|
114
114
|
end
|
115
|
-
|
115
|
+
|
116
116
|
# Create individuals table
|
117
117
|
unless table_exists?(:individuals)
|
118
118
|
create_table :individuals do |t|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
119
|
+
t.column :party_id, :integer
|
120
|
+
t.column :current_last_name, :string
|
121
|
+
t.column :current_first_name, :string
|
122
|
+
t.column :current_middle_name, :string
|
123
|
+
t.column :current_personal_title, :string
|
124
|
+
t.column :current_suffix, :string
|
125
|
+
t.column :current_nickname, :string
|
126
|
+
t.column :gender, :string, :limit => 1
|
127
|
+
t.column :birth_date, :date
|
128
|
+
t.column :height, :decimal, :precision => 5, :scale => 2
|
129
|
+
t.column :weight, :integer
|
130
|
+
t.column :mothers_maiden_name, :string
|
131
|
+
t.column :marital_status, :string, :limit => 1
|
132
|
+
t.column :social_security_number, :string
|
133
|
+
t.column :current_passport_number, :integer
|
134
|
+
|
135
|
+
t.column :current_passport_expire_date, :date
|
136
|
+
t.column :total_years_work_experience, :integer
|
137
|
+
t.column :comments, :string
|
138
|
+
t.column :encrypted_ssn, :string
|
139
|
+
t.column :temp_ssn, :string
|
140
|
+
t.column :salt, :string
|
141
|
+
t.column :ssn_last_four, :string
|
142
|
+
t.timestamps
|
143
143
|
end
|
144
|
-
|
144
|
+
add_index :individuals, :party_id
|
145
145
|
end
|
146
|
-
|
146
|
+
|
147
147
|
# Create contacts table
|
148
148
|
unless table_exists?(:contacts)
|
149
149
|
create_table :contacts do |t|
|
150
|
-
t.column
|
151
|
-
t.column
|
152
|
-
t.column
|
153
|
-
|
154
|
-
t.column
|
155
|
-
t.column
|
150
|
+
t.column :party_id, :integer
|
151
|
+
t.column :contact_mechanism_id, :integer
|
152
|
+
t.column :contact_mechanism_type, :string
|
153
|
+
|
154
|
+
t.column :external_identifier, :string
|
155
|
+
t.column :external_id_source, :string
|
156
156
|
|
157
157
|
t.timestamps
|
158
158
|
end
|
159
|
-
|
160
|
-
|
159
|
+
add_index :contacts, :party_id
|
160
|
+
add_index :contacts, [:contact_mechanism_id, :contact_mechanism_type], :name => "besi_2"
|
161
161
|
end
|
162
|
-
|
162
|
+
|
163
163
|
# Create contact_types
|
164
164
|
unless table_exists?(:contact_types)
|
165
165
|
create_table :contact_types do |t|
|
166
|
-
t.column
|
167
|
-
t.column
|
168
|
-
t.column
|
166
|
+
t.column :parent_id, :integer
|
167
|
+
t.column :lft, :integer
|
168
|
+
t.column :rgt, :integer
|
169
169
|
|
170
170
|
#custom columns go here
|
171
171
|
|
172
|
-
t.column
|
173
|
-
t.column
|
172
|
+
t.column :description, :string
|
173
|
+
t.column :comments, :string
|
174
174
|
|
175
|
-
|
176
|
-
|
177
|
-
|
175
|
+
t.column :internal_identifier, :string
|
176
|
+
t.column :external_identifier, :string
|
177
|
+
t.column :external_id_source, :string
|
178
178
|
|
179
179
|
t.timestamps
|
180
180
|
end
|
181
|
-
|
181
|
+
add_index :contact_types, :parent_id
|
182
182
|
end
|
183
|
-
|
183
|
+
|
184
184
|
# Create contact_purposes
|
185
185
|
unless table_exists?(:contact_purposes)
|
186
186
|
create_table :contact_purposes do |t|
|
187
187
|
|
188
|
-
|
189
|
-
|
190
|
-
|
188
|
+
t.column :parent_id, :integer
|
189
|
+
t.column :lft, :integer
|
190
|
+
t.column :rgt, :integer
|
191
191
|
|
192
192
|
#custom columns go here
|
193
193
|
|
194
|
-
|
195
|
-
|
194
|
+
t.column :description, :string
|
195
|
+
t.column :comments, :string
|
196
196
|
|
197
|
-
|
198
|
-
|
199
|
-
|
197
|
+
t.column :internal_identifier, :string
|
198
|
+
t.column :external_identifier, :string
|
199
|
+
t.column :external_id_source, :string
|
200
200
|
|
201
201
|
t.timestamps
|
202
202
|
end
|
203
|
-
|
204
|
-
|
203
|
+
add_index :contact_purposes, :parent_id
|
204
|
+
|
205
205
|
end
|
206
|
-
|
206
|
+
|
207
207
|
unless table_exists?(:contact_purposes_contacts)
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
208
|
+
create_table :contact_purposes_contacts, {:id => false} do |t|
|
209
|
+
t.column :contact_id, :integer
|
210
|
+
t.column :contact_purpose_id, :integer
|
211
|
+
end
|
212
|
+
add_index :contact_purposes_contacts, [:contact_id, :contact_purpose_id], :name => "contact_purposes_contacts_index"
|
213
213
|
end
|
214
|
-
|
214
|
+
|
215
215
|
# Create postal_addresses (a contact_mechanism)
|
216
216
|
unless table_exists?(:postal_addresses)
|
217
217
|
create_table :postal_addresses do |t|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
218
|
+
t.column :address_line_1, :string
|
219
|
+
t.column :address_line_2, :string
|
220
|
+
t.column :city, :string
|
221
|
+
t.column :state, :string
|
222
|
+
t.column :zip, :string
|
223
|
+
t.column :country, :string
|
224
|
+
t.column :description, :string
|
225
|
+
t.column :geo_country_id, :integer
|
226
|
+
t.column :geo_zone_id, :integer
|
227
|
+
t.timestamps
|
228
228
|
end
|
229
|
-
|
230
|
-
|
229
|
+
add_index :postal_addresses, :geo_country_id
|
230
|
+
add_index :postal_addresses, :geo_zone_id
|
231
231
|
end
|
232
|
-
|
232
|
+
|
233
233
|
# Create email_addresses (a contact_mechanism)
|
234
234
|
unless table_exists?(:email_addresses)
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
235
|
+
create_table :email_addresses do |t|
|
236
|
+
t.column :email_address, :string
|
237
|
+
t.column :description, :string
|
238
|
+
|
239
|
+
t.timestamps
|
240
|
+
end
|
241
241
|
end
|
242
|
-
|
242
|
+
|
243
243
|
# Create phone_numbers table (A contact_mechanism)
|
244
244
|
unless table_exists?(:phone_numbers)
|
245
245
|
create_table :phone_numbers do |t|
|
246
|
-
|
247
|
-
|
246
|
+
t.column :phone_number, :string
|
247
|
+
t.column :description, :string
|
248
248
|
|
249
249
|
t.timestamps
|
250
250
|
end
|
251
251
|
end
|
252
|
-
|
252
|
+
|
253
253
|
unless table_exists?(:party_search_facts)
|
254
254
|
create_table :party_search_facts do |t|
|
255
|
-
t.column :party_id,
|
256
|
-
t.column :eid,
|
257
|
-
t.column :type,
|
258
|
-
t.column :roles,
|
259
|
-
t.column :party_description,
|
260
|
-
t.column :party_business_party_type,
|
261
|
-
t.column :user_login,
|
262
|
-
t.column :individual_current_last_name,
|
263
|
-
t.column :individual_current_first_name,
|
255
|
+
t.column :party_id, :integer
|
256
|
+
t.column :eid, :string
|
257
|
+
t.column :type, :string
|
258
|
+
t.column :roles, :text
|
259
|
+
t.column :party_description, :string
|
260
|
+
t.column :party_business_party_type, :string
|
261
|
+
t.column :user_login, :string
|
262
|
+
t.column :individual_current_last_name, :string
|
263
|
+
t.column :individual_current_first_name, :string
|
264
264
|
t.column :individual_current_middle_name, :string
|
265
|
-
t.column :individual_birth_date,
|
266
|
-
t.column :individual_ssn,
|
267
|
-
t.column :party_phone_number,
|
268
|
-
t.column :party_email_address,
|
269
|
-
t.column :party_address_1,
|
270
|
-
t.column :party_address_2,
|
271
|
-
t.column :party_primary_address_city,
|
272
|
-
t.column :party_primary_address_state,
|
273
|
-
t.column :party_primary_address_zip,
|
274
|
-
t.column :party_primary_address_country,
|
275
|
-
t.column :user_enabled,
|
276
|
-
t.column :user_type,
|
277
|
-
t.column :reindex,
|
265
|
+
t.column :individual_birth_date, :string
|
266
|
+
t.column :individual_ssn, :string
|
267
|
+
t.column :party_phone_number, :string
|
268
|
+
t.column :party_email_address, :string
|
269
|
+
t.column :party_address_1, :string
|
270
|
+
t.column :party_address_2, :string
|
271
|
+
t.column :party_primary_address_city, :string
|
272
|
+
t.column :party_primary_address_state, :string
|
273
|
+
t.column :party_primary_address_zip, :string
|
274
|
+
t.column :party_primary_address_country, :string
|
275
|
+
t.column :user_enabled, :boolean
|
276
|
+
t.column :user_type, :string
|
277
|
+
t.column :reindex, :boolean
|
278
278
|
t.timestamps
|
279
279
|
end
|
280
280
|
end
|
281
|
-
|
281
|
+
|
282
282
|
unless table_exists?(:money)
|
283
283
|
create_table :money do |t|
|
284
284
|
t.string :description
|
@@ -286,24 +286,24 @@ class BaseErpServices < ActiveRecord::Migration
|
|
286
286
|
t.references :currency
|
287
287
|
t.timestamps
|
288
288
|
end
|
289
|
-
|
289
|
+
add_index :money, :currency_id
|
290
290
|
end
|
291
291
|
|
292
292
|
unless table_exists?(:currencies)
|
293
293
|
create_table :currencies do |t|
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
294
|
+
t.string :name
|
295
|
+
t.string :definition
|
296
|
+
t.string :internal_identifier # aka alphabetic_code
|
297
|
+
t.string :numeric_code
|
298
|
+
t.string :major_unit_symbol
|
299
|
+
t.string :minor_unit_symbol
|
300
|
+
t.string :ratio_of_minor_unit_to_major_unit
|
301
|
+
t.string :postfix_label
|
302
|
+
t.datetime :introduction_date
|
303
|
+
t.datetime :expiration_date
|
304
304
|
t.timestamps
|
305
305
|
end
|
306
|
-
|
306
|
+
add_index :currencies, :internal_identifier
|
307
307
|
end
|
308
308
|
|
309
309
|
## categories
|
@@ -317,7 +317,7 @@ class BaseErpServices < ActiveRecord::Migration
|
|
317
317
|
|
318
318
|
# polymorphic assns
|
319
319
|
t.integer :category_record_id
|
320
|
-
t.string
|
320
|
+
t.string :category_record_type
|
321
321
|
|
322
322
|
# nested set cols
|
323
323
|
t.integer :parent_id
|
@@ -326,31 +326,31 @@ class BaseErpServices < ActiveRecord::Migration
|
|
326
326
|
|
327
327
|
t.timestamps
|
328
328
|
end
|
329
|
-
|
329
|
+
add_index :categories, [:category_record_id, :category_record_type], :name => "category_polymorphic"
|
330
330
|
end
|
331
331
|
|
332
332
|
## category_classifications
|
333
333
|
unless table_exists?(:category_classifications)
|
334
334
|
create_table :category_classifications do |t|
|
335
|
-
t.integer
|
336
|
-
t.string
|
337
|
-
t.integer
|
335
|
+
t.integer :category_id
|
336
|
+
t.string :classification_type
|
337
|
+
t.integer :classification_id
|
338
338
|
t.datetime :from_date
|
339
339
|
t.datetime :to_date
|
340
340
|
|
341
341
|
t.timestamps
|
342
342
|
end
|
343
|
-
|
343
|
+
add_index :category_classifications, [:classification_id, :classification_type], :name => "classification_polymorphic"
|
344
344
|
end
|
345
345
|
|
346
346
|
## descriptive_assets
|
347
347
|
unless table_exists?(:descriptive_assets)
|
348
348
|
create_table :descriptive_assets do |t|
|
349
349
|
t.references :view_type
|
350
|
-
t.string
|
351
|
-
t.text
|
352
|
-
t.string
|
353
|
-
t.string
|
350
|
+
t.string :internal_identifier
|
351
|
+
t.text :description
|
352
|
+
t.string :external_identifier
|
353
|
+
t.string :external_id_source
|
354
354
|
t.references :described_record, :polymorphic => true
|
355
355
|
|
356
356
|
t.timestamps
|
@@ -362,8 +362,8 @@ class BaseErpServices < ActiveRecord::Migration
|
|
362
362
|
|
363
363
|
unless table_exists?(:view_types)
|
364
364
|
create_table :view_types do |t|
|
365
|
-
t.string
|
366
|
-
t.string
|
365
|
+
t.string :internal_identifier
|
366
|
+
t.string :description
|
367
367
|
|
368
368
|
t.timestamps
|
369
369
|
end
|
@@ -371,33 +371,33 @@ class BaseErpServices < ActiveRecord::Migration
|
|
371
371
|
|
372
372
|
unless table_exists?(:geo_countries)
|
373
373
|
create_table :geo_countries do |t|
|
374
|
-
t.column :name,
|
375
|
-
t.column :iso_code_2,
|
376
|
-
t.column :iso_code_3,
|
377
|
-
t.column :display,
|
378
|
-
t.column :external_id,
|
379
|
-
t.column :created_at,
|
374
|
+
t.column :name, :string
|
375
|
+
t.column :iso_code_2, :string, :length => 2
|
376
|
+
t.column :iso_code_3, :string, :length => 3
|
377
|
+
t.column :display, :boolean, :default => true
|
378
|
+
t.column :external_id, :integer
|
379
|
+
t.column :created_at, :datetime
|
380
380
|
end
|
381
|
-
|
381
|
+
add_index :geo_countries, :name
|
382
382
|
add_index :geo_countries, :iso_code_2
|
383
383
|
end
|
384
384
|
|
385
385
|
unless table_exists?(:geo_zones)
|
386
386
|
create_table :geo_zones do |t|
|
387
387
|
t.column :geo_country_id, :integer
|
388
|
-
t.column :zone_code,
|
389
|
-
t.column :zone_name,
|
390
|
-
t.column :created_at,
|
388
|
+
t.column :zone_code, :string, :default => 2
|
389
|
+
t.column :zone_name, :string
|
390
|
+
t.column :created_at, :datetime
|
391
391
|
end
|
392
|
-
|
392
|
+
add_index :geo_zones, :geo_country_id
|
393
393
|
add_index :geo_zones, :zone_name
|
394
394
|
add_index :geo_zones, :zone_code
|
395
395
|
end
|
396
396
|
|
397
397
|
unless table_exists?(:notes)
|
398
|
-
create_table
|
399
|
-
t.integer
|
400
|
-
t.text
|
398
|
+
create_table :notes do |t|
|
399
|
+
t.integer :created_by_id
|
400
|
+
t.text :content
|
401
401
|
t.references :noted_record, :polymorphic => true
|
402
402
|
t.references :note_type
|
403
403
|
|
@@ -412,13 +412,13 @@ class BaseErpServices < ActiveRecord::Migration
|
|
412
412
|
unless table_exists?(:note_types)
|
413
413
|
create_table :note_types do |t|
|
414
414
|
#these columns are required to support the behavior of the plugin 'awesome_nested_set'
|
415
|
-
t.integer
|
416
|
-
t.integer
|
417
|
-
t.integer
|
415
|
+
t.integer :parent_id
|
416
|
+
t.integer :lft
|
417
|
+
t.integer :rgt
|
418
418
|
|
419
|
-
t.string
|
420
|
-
t.string
|
421
|
-
t.string
|
419
|
+
t.string :description
|
420
|
+
t.string :internal_identifier
|
421
|
+
t.string :external_identifier
|
422
422
|
t.references :note_type_record, :polymorphic => true
|
423
423
|
|
424
424
|
t.timestamps
|
@@ -426,12 +426,12 @@ class BaseErpServices < ActiveRecord::Migration
|
|
426
426
|
|
427
427
|
add_index :note_types, [:note_type_record_id, :note_type_record_type], :name => "note_type_record_idx"
|
428
428
|
end
|
429
|
-
|
429
|
+
|
430
430
|
unless table_exists?(:valid_note_types)
|
431
|
-
create_table
|
431
|
+
create_table :valid_note_types do |t|
|
432
432
|
t.references :valid_note_type_record, :polymorphic => true
|
433
433
|
t.references :note_type
|
434
|
-
|
434
|
+
|
435
435
|
t.timestamps
|
436
436
|
end
|
437
437
|
|
@@ -443,13 +443,13 @@ class BaseErpServices < ActiveRecord::Migration
|
|
443
443
|
|
444
444
|
def self.down
|
445
445
|
[
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
446
|
+
:currencies, :money,
|
447
|
+
:party_search_facts, :phone_numbers, :email_addresses,
|
448
|
+
:postal_addresses, :contact_purposes, :contact_types,
|
449
|
+
:contacts, :individuals, :organizations,
|
450
|
+
:party_relationships, :relationship_types, :role_types,
|
451
|
+
:party_roles, :parties, :categories, :category_classifications,
|
452
|
+
:descriptive_assets, :view_types, :notes, :note_types, :valid_note_types, :compass_ae_instances
|
453
453
|
].each do |tbl|
|
454
454
|
if table_exists?(tbl)
|
455
455
|
drop_table tbl
|