erp_app 3.1.12 → 3.1.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/app/models/configuration_item.rb +1 -2
  2. data/lib/erp_app/engine.rb +1 -1
  3. data/lib/erp_app/version.rb +1 -1
  4. metadata +5 -86
  5. data/spec/dummy/db/data_migrations/20130422163128_add_usd_currency.erp_base_erp_svcs.rb +0 -12
  6. data/spec/dummy/db/data_migrations/20130422163129_add_iso_codes.erp_base_erp_svcs.rb +0 -19
  7. data/spec/dummy/db/data_migrations/20130422163130_setup_compass_ae_instance.erp_base_erp_svcs.rb +0 -21
  8. data/spec/dummy/db/data_migrations/20130422163131_upgrade_compass_ae_instances_data.erp_base_erp_svcs.rb +0 -19
  9. data/spec/dummy/db/data_migrations/20130422163132_add_guid_to_instances.erp_base_erp_svcs.rb +0 -10
  10. data/spec/dummy/db/data_migrations/20130422163133_create_capability_scope_types.erp_tech_svcs.rb +0 -15
  11. data/spec/dummy/db/data_migrations/20130422163134_schedule_delete_expired_sessions_job.erp_tech_svcs.rb +0 -16
  12. data/spec/dummy/db/data_migrations/20130422163135_setup_audit_log_types.erp_tech_svcs.rb +0 -22
  13. data/spec/dummy/db/data_migrations/20130422163136_create_group_relationship_and_role_types.erp_tech_svcs.rb +0 -20
  14. data/spec/dummy/db/data_migrations/20130422163137_note_capabilities.erp_tech_svcs.rb +0 -24
  15. data/spec/dummy/db/data_migrations/20130422163138_erp_app_setup.erp_app.rb +0 -252
  16. data/spec/dummy/db/data_migrations/20130422163139_update_preferences.erp_app.rb +0 -53
  17. data/spec/dummy/db/data_migrations/20130422163140_create_desktop_app_audit_log_viewer.erp_app.rb +0 -24
  18. data/spec/dummy/db/data_migrations/20130422163141_add_file_manager_application.erp_app.rb +0 -32
  19. data/spec/dummy/db/data_migrations/20130422163142_add_default_capabilities.erp_app.rb +0 -23
  20. data/spec/dummy/db/data_migrations/20130422163143_add_new_contact_widgets.erp_app.rb +0 -42
  21. data/spec/dummy/db/data_migrations/20130422163144_add_userinfo_widget.erp_app.rb +0 -29
  22. data/spec/dummy/db/data_migrations/20130422163145_create_party_and_role_type_for_communication_events.erp_app.rb +0 -11
  23. data/spec/dummy/db/data_migrations/20130422163146_create_user_management_mobile_application.erp_app.rb +0 -17
  24. data/spec/dummy/db/data_migrations/20130422163147_create_configuration_management_desktop_application.erp_app.rb +0 -27
  25. data/spec/dummy/db/data_migrations/20130422163148_create_job_tracker_desktop_application.erp_app.rb +0 -23
  26. data/spec/dummy/db/data_migrations/20130422163149_created_tracked_jobs.erp_app.rb +0 -15
  27. data/spec/dummy/db/data_migrations/20130422163150_upgrade_remove_system_mgmt_app.erp_app.rb +0 -16
  28. data/spec/dummy/db/data_migrations/20130422163151_create_security_management_desktop_application.erp_app.rb +0 -29
  29. data/spec/dummy/db/data_migrations/20130422163152_add_job_tracker_mobile_app.erp_app.rb +0 -17
  30. data/spec/dummy/db/migrate/20130422163121_base_erp_services.erp_base_erp_svcs.rb +0 -486
  31. data/spec/dummy/db/migrate/20130422163122_add_txn_status.erp_base_erp_svcs.rb +0 -37
  32. data/spec/dummy/db/migrate/20130422163123_upgrade_compass_ae_instances.erp_base_erp_svcs.rb +0 -34
  33. data/spec/dummy/db/migrate/20130422163124_add_uuid_compass_ae_instance.erp_base_erp_svcs.rb +0 -17
  34. data/spec/dummy/db/migrate/20130422163125_add_long_lat_to_address.erp_base_erp_svcs.rb +0 -16
  35. data/spec/dummy/db/migrate/20130422163126_base_tech_services.erp_tech_svcs.rb +0 -271
  36. data/spec/dummy/db/migrate/20130422163127_create_has_attribute_tables.erp_tech_svcs.rb +0 -39
  37. data/spec/dummy/db/migrate/20130422163128_create_groups.erp_tech_svcs.rb +0 -19
  38. data/spec/dummy/db/migrate/20130422163129_upgrade_security.erp_tech_svcs.rb +0 -54
  39. data/spec/dummy/db/migrate/20130422163130_upgrade_security2.erp_tech_svcs.rb +0 -275
  40. data/spec/dummy/db/migrate/20130422163131_add_queue_to_delayed_jobs.erp_tech_svcs.rb +0 -14
  41. data/spec/dummy/db/migrate/20130422163132_base_app_framework.erp_app.rb +0 -276
  42. data/spec/dummy/db/migrate/20130422163133_add_job_tracker.erp_app.rb +0 -20
  43. data/spec/dummy/db/migrate/20130422163134_update_mobile_application.erp_app.rb +0 -28
  44. data/spec/dummy/db/schema.rb +0 -883
  45. data/spec/dummy/db/spec.sqlite3 +0 -0
@@ -1,53 +0,0 @@
1
- # This migration comes from erp_app (originally 20110728201733)
2
- class UpdatePreferences
3
-
4
- def self.up
5
-
6
- truenorth_logo_po = PreferenceOption.where(:internal_identifier => 'truenorth_logo_background').first
7
- if(truenorth_logo_po.value == 'truenorth.png')
8
- #update background
9
- truenorth_logo_po.value = 'truenorth_tech.png'
10
- truenorth_logo_po.save
11
-
12
- #remove backgrounds
13
- %w{grey_gradient_desktop_background purple_desktop_background planet_desktop_background portablemind_desktop_background}.each do |background_iid|
14
- pref_opt = PreferenceOption.find_by_internal_identifier(background_iid)
15
- pref_opt.destroy unless pref_opt.nil?
16
- end
17
-
18
- #update themes
19
- pref_opt = PreferenceOption.find_by_internal_identifier('access_extjs_theme')
20
- pref_opt.value = 'extjs:ext-all-access'
21
- pref_opt.save
22
-
23
- pref_opt = PreferenceOption.find_by_internal_identifier('gray_extjs_theme')
24
- pref_opt.value = 'extjs:ext-all-gray'
25
- pref_opt.save
26
-
27
- pref_opt = PreferenceOption.find_by_internal_identifier('blue_extjs_theme')
28
- pref_opt.value = 'extjs:ext-all'
29
- pref_opt.save
30
-
31
- #add new themes
32
- clifton_extjs_theme_po = PreferenceOption.create(:description => 'Clifton Default', :internal_identifier => 'clifton_extjs_theme', :value => 'clifton:clifton')
33
- clifton_extjs_theme_green_po = PreferenceOption.create(:description => 'Clifton Green', :internal_identifier => 'clifton_extjs_theme', :value => 'clifton:clifton-green')
34
- clifton_extjs_theme_yellow_po = PreferenceOption.create(:description => 'Clifton Yellow', :internal_identifier => 'clifton_extjs_theme', :value => 'clifton:clifton-yellow')
35
- clifton_extjs_theme_pink_po = PreferenceOption.create(:description => 'Clifton Pink', :internal_identifier => 'clifton_extjs_theme', :value => 'clifton:clifton-pink')
36
- clifton_extjs_theme_blue_po = PreferenceOption.create(:description => 'Clifton Blue', :internal_identifier => 'clifton_extjs_theme', :value => 'clifton:clifton-blue')
37
-
38
- extjs_theme_pt = PreferenceType.find_by_internal_identifier('extjs_theme')
39
- extjs_theme_pt.preference_options << clifton_extjs_theme_po
40
- extjs_theme_pt.preference_options << clifton_extjs_theme_green_po
41
- extjs_theme_pt.preference_options << clifton_extjs_theme_yellow_po
42
- extjs_theme_pt.preference_options << clifton_extjs_theme_pink_po
43
- extjs_theme_pt.preference_options << clifton_extjs_theme_blue_po
44
- extjs_theme_pt.save
45
- end
46
-
47
- end
48
-
49
- def self.down
50
- #remove data here
51
- end
52
-
53
- end
@@ -1,24 +0,0 @@
1
- # This migration comes from erp_app (originally 20110816161238)
2
- class CreateDesktopAppAuditLogViewer
3
- def self.up
4
- app = DesktopApplication.create(
5
- :description => 'Audit Log Viewer',
6
- :icon => 'icon-history',
7
- :javascript_class_name => 'Compass.ErpApp.Desktop.Applications.AuditLogViewer',
8
- :internal_identifier => 'audit_log_viewer',
9
- :shortcut_id => 'audit_log_viewer-win'
10
- )
11
-
12
- app.preference_types << PreferenceType.iid('desktop_shortcut')
13
- app.preference_types << PreferenceType.iid('autoload_application')
14
- app.save
15
-
16
- admin_user = User.find_by_username('admin')
17
- admin_user.desktop.applications << app
18
- admin_user.desktop.save
19
- end
20
-
21
- def self.down
22
- DesktopApplication.destroy_all(['internal_identifier = ?','audit_log_viewer'])
23
- end
24
- end
@@ -1,32 +0,0 @@
1
- # This migration comes from erp_app (originally 20110817160743)
2
- class AddFileManagerApplication
3
-
4
- def self.up
5
- if DesktopApplication.find_by_internal_identifier('file_manager').nil?
6
- file_manager_app = DesktopApplication.create(
7
- :description => 'File Manager',
8
- :icon => 'icon-folders',
9
- :javascript_class_name => 'Compass.ErpApp.Desktop.Applications.FileManager',
10
- :internal_identifier => 'file_manager',
11
- :shortcut_id => 'file_manager-win'
12
- )
13
-
14
- file_manager_app.preference_types << PreferenceType.iid('desktop_shortcut')
15
- file_manager_app.preference_types << PreferenceType.iid('autoload_application')
16
- file_manager_app.save
17
-
18
- admin_user = User.find_by_username('admin')
19
- admin_user.desktop.applications << file_manager_app
20
- admin_user.save
21
-
22
- truenorth_user = User.find_by_username('truenorth')
23
- truenorth_user.desktop.applications << file_manager_app
24
- truenorth_user.save
25
- end
26
- end
27
-
28
- def self.down
29
- DesktopApplication.find_by_internal_identifier('file_manager').destroy
30
- end
31
-
32
- end
@@ -1,23 +0,0 @@
1
- # This migration comes from erp_app (originally 20111108183739)
2
- class AddDefaultCapabilities
3
-
4
- def self.up
5
- admin = SecurityRole.find_by_internal_identifier('admin')
6
- employee = SecurityRole.find_by_internal_identifier('employee')
7
-
8
- admin.add_capability('create', 'User')
9
- admin.add_capability('delete', 'User')
10
-
11
- admin.add_capability('create', 'Note')
12
- employee.add_capability('create', 'Note')
13
-
14
- admin.add_capability('view', 'Note')
15
- employee.add_capability('view', 'Note')
16
-
17
- admin.add_capability('delete', 'Note')
18
- end
19
-
20
- def self.down
21
- end
22
-
23
- end
@@ -1,42 +0,0 @@
1
- # This migration comes from erp_app (originally 20111108183740)
2
- class AddNewContactWidgets
3
-
4
- def self.up
5
- crm_app = OrganizerApplication.find_by_internal_identifier('crm')
6
-
7
- unless crm_app.nil?
8
- Widget.find_by_internal_identifier('party_contact_management').destroy
9
-
10
- phone_number_managementt_widget = ::Widget.create(
11
- :description => 'Phone Number Management',
12
- :icon => 'icon-grid',
13
- :xtype => 'phonenumbergrid',
14
- :internal_identifier => 'phone_number_management'
15
- )
16
-
17
- email_address_management_widget = ::Widget.create(
18
- :description => 'Email Address Management',
19
- :icon => 'icon-grid',
20
- :xtype => 'emailaddressgrid',
21
- :internal_identifier => 'email_address_management'
22
- )
23
-
24
- postal_address_management_widget = ::Widget.create(
25
- :description => 'Postal Address Management',
26
- :icon => 'icon-grid',
27
- :xtype => 'postaladdressgrid',
28
- :internal_identifier => 'postal_address_management'
29
- )
30
-
31
- crm_app.widgets << phone_number_managementt_widget
32
- crm_app.widgets << email_address_management_widget
33
- crm_app.widgets << postal_address_management_widget
34
- crm_app.save
35
-
36
- end
37
- end
38
-
39
- def self.down
40
- end
41
-
42
- end
@@ -1,29 +0,0 @@
1
- # This migration comes from erp_app (originally 20120229160222)
2
- class AddUserinfoWidget
3
-
4
- def self.up
5
- #insert data here
6
- if Widget.find_by_internal_identifier('userinfo').nil?
7
- app = Application.find_by_internal_identifier('crm')
8
-
9
- user = Widget.create(
10
- :description => 'User Info',
11
- :internal_identifier => 'userinfo',
12
- :icon => 'icon-user',
13
- :xtype => 'userinfo'
14
- )
15
-
16
- unless app.nil?
17
- app.widgets << user
18
- app.save
19
- end
20
-
21
- end
22
- end
23
-
24
- def self.down
25
- #remove data here
26
- Widget.find_by_internal_identifier('userinfo').destroy
27
- end
28
-
29
- end
@@ -1,11 +0,0 @@
1
- # This migration comes from erp_app (originally 20120405193721)
2
- class CreatePartyAndRoleTypeForCommunicationEvents < ActiveRecord::Migration
3
- def up
4
- role_type = RoleType.find_or_create_by_description_and_internal_identifier('Application', 'application')
5
- party = Party.find_or_create_by_description('Compass AE')
6
- party.role_type << role_type
7
- end
8
-
9
- def down
10
- end
11
- end
@@ -1,17 +0,0 @@
1
- # This migration comes from erp_app (originally 20120411180756)
2
- class CreateUserManagementMobileApplication
3
-
4
- def self.up
5
- MobileApplication.create(
6
- :description => 'User Management',
7
- :icon => 'icon-user',
8
- :internal_identifier => 'user_management',
9
- :xtype => 'compass-erpapp-mobile-usermanagement-application'
10
- )
11
- end
12
-
13
- def self.down
14
- MobileApplication.destroy_all("internal_identifier = 'user_management'")
15
- end
16
-
17
- end
@@ -1,27 +0,0 @@
1
- # This migration comes from erp_app (originally 20120418164215)
2
- class CreateConfigurationManagementDesktopApplication
3
- def self.up
4
- app = DesktopApplication.create(
5
- :description => 'Configuration Management',
6
- :icon => 'icon-grid',
7
- :javascript_class_name => 'Compass.ErpApp.Desktop.Applications.ConfigurationManagement',
8
- :internal_identifier => 'configuration_management',
9
- :shortcut_id => 'configuration_management-win'
10
- )
11
- pt1 = PreferenceType.iid('desktop_shortcut')
12
- pt1.preferenced_records << app
13
- pt1.save
14
-
15
- pt2 = PreferenceType.iid('autoload_application')
16
- pt2.preferenced_records << app
17
- pt2.save
18
-
19
- admin_user = User.find_by_username('admin')
20
- admin_user.desktop.applications << app
21
- admin_user.desktop.save
22
- end
23
-
24
- def self.down
25
- DesktopApplication.destroy_all(['internal_identifier = ?','configuration_management'])
26
- end
27
- end
@@ -1,23 +0,0 @@
1
- # This migration comes from erp_app (originally 20121018143910)
2
- class CreateJobTrackerDesktopApplication
3
- def self.up
4
- app = DesktopApplication.create(
5
- :description => 'Job Tracker',
6
- :icon => 'icon-calendar',
7
- :javascript_class_name => 'Compass.ErpApp.Desktop.Applications.JobTracker',
8
- :internal_identifier => 'job_tracker',
9
- :shortcut_id => 'job_tracker-win'
10
- )
11
- pt1 = PreferenceType.iid('desktop_shortcut')
12
- pt1.preferenced_records << app
13
- pt1.save
14
-
15
- pt2 = PreferenceType.iid('autoload_application')
16
- pt2.preferenced_records << app
17
- pt2.save
18
- end
19
-
20
- def self.down
21
- DesktopApplication.destroy_all(['internal_identifier = ?','job_tracker'])
22
- end
23
- end
@@ -1,15 +0,0 @@
1
- # This migration comes from erp_app (originally 20121018172347)
2
- class CreatedTrackedJobs
3
-
4
- def self.up
5
- JobTracker.create(
6
- :job_name => 'Delete Expired Sessions',
7
- :job_klass => 'ErpTechSvcs::Sessions::DeleteExpiredSessionsJob'
8
- )
9
- end
10
-
11
- def self.down
12
- #remove data here
13
- end
14
-
15
- end
@@ -1,16 +0,0 @@
1
- # This migration comes from erp_app (originally 20121130201859)
2
- class UpgradeRemoveSystemMgmtApp
3
-
4
- def self.up
5
- #insert data here
6
- widget = Widget.find_by_xtype('systemmanagement_applicationrolemanagment')
7
- widget.destroy unless widget.nil?
8
- app = Application.find_by_internal_identifier('system_management')
9
- app.destroy unless app.nil?
10
- end
11
-
12
- def self.down
13
- #remove data here
14
- end
15
-
16
- end
@@ -1,29 +0,0 @@
1
- # This migration comes from erp_app (originally 20121218175028)
2
- class CreateSecurityManagementDesktopApplication
3
- def self.up
4
- app = DesktopApplication.create(
5
- :description => 'Security Management',
6
- :icon => 'icon-key',
7
- :javascript_class_name => 'Compass.ErpApp.Desktop.Applications.SecurityManagement',
8
- :internal_identifier => 'security_management',
9
- :shortcut_id => 'security_management-win'
10
- )
11
- pt1 = PreferenceType.iid('desktop_shortcut')
12
- pt1.preferenced_records << app
13
- pt1.save
14
-
15
- pt2 = PreferenceType.iid('autoload_application')
16
- pt2.preferenced_records << app
17
- pt2.save
18
-
19
- admin_user = User.find_by_username('admin')
20
- if admin_user
21
- admin_user.desktop.applications << app
22
- admin_user.desktop.save
23
- end
24
- end
25
-
26
- def self.down
27
- DesktopApplication.destroy_all(['internal_identifier = ?','security_management'])
28
- end
29
- end
@@ -1,17 +0,0 @@
1
- # This migration comes from erp_app (originally 20130411200351)
2
- class AddJobTrackerMobileApp
3
-
4
- def self.up
5
- MobileApplication.create(
6
- :description => 'Jobs',
7
- :icon => 'icon-tasks',
8
- :internal_identifier => 'job_tracker',
9
- :xtype => 'compass-erpapp-mobile-jobtracker-application'
10
- )
11
- end
12
-
13
- def self.down
14
- MobileApplication.destroy_all("internal_identifier = 'job_tracker'")
15
- end
16
-
17
- end
@@ -1,486 +0,0 @@
1
- # This migration comes from erp_base_erp_svcs (originally 20080805000020)
2
- class BaseErpServices < ActiveRecord::Migration
3
- def self.up
4
-
5
- unless table_exists?(:compass_ae_instances)
6
- create_table :compass_ae_instances do |t|
7
- t.string :description
8
- t.string :internal_identifier
9
- t.decimal :version, :precision => 8, :scale => 3
10
- t.string :type
11
- t.string :schema, :default => 'public'
12
- t.integer :parent_id
13
-
14
- t.timestamps
15
- end
16
-
17
- add_index :compass_ae_instances, :internal_identifier, :name => "iid_idx"
18
- add_index :compass_ae_instances, :schema, :name => "schema_idx"
19
- add_index :compass_ae_instances, :type, :name => "type_idx"
20
- add_index :compass_ae_instances, :parent_id, :name => "parent_id_idx"
21
- end
22
-
23
- unless table_exists?(:compass_ae_instance_party_roles)
24
- create_table :compass_ae_instance_party_roles do |t|
25
- t.string :description
26
- t.integer :compass_ae_instance_id
27
- t.integer :party_id
28
- t.integer :role_type_id
29
-
30
- t.timestamps
31
- end
32
-
33
- add_index :compass_ae_instance_party_roles, :compass_ae_instance_id, :name => "compass_ae_instance_id_idx"
34
- add_index :compass_ae_instance_party_roles, :party_id, :name => "party_id_idx"
35
- add_index :compass_ae_instance_party_roles, :role_type_id, :name => "role_type_id_idx"
36
- end
37
-
38
- # Create parties table
39
- unless table_exists?(:parties)
40
- create_table :parties do |t|
41
- t.column :description, :string
42
- t.column :business_party_id, :integer
43
- t.column :business_party_type, :string
44
- t.column :list_view_image_id, :integer
45
-
46
- #This field is here to provide a direct way to map CompassAE
47
- #business parties to unified idenfiers in organizations if they
48
- #have been implemented in an enterprise.
49
- t.column :enterprise_identifier, :string
50
- t.timestamps
51
- end
52
- add_index :parties, [:business_party_id, :business_party_type], :name => "besi_1"
53
- end
54
-
55
- # Create party_roles table
56
- unless table_exists?(:party_roles)
57
- create_table :party_roles do |t|
58
- #this column holds the class name of the
59
- #subtype of party-to-role_type relatsionship
60
- t.column :type, :string
61
- #xref between party and role_type
62
- t.column :party_id, :integer
63
- t.column :role_type_id, :integer
64
- t.timestamps
65
- end
66
- add_index :party_roles, :party_id
67
- add_index :party_roles, :role_type_id
68
- end
69
-
70
-
71
- # Create role_types table
72
- unless table_exists?(:role_types)
73
- create_table :role_types do |t|
74
- #these columns are required to support the behavior of the plugin 'awesome_nested_set'
75
- t.column :parent_id, :integer
76
- t.column :lft, :integer
77
- t.column :rgt, :integer
78
-
79
- #custom columns go here
80
- t.column :description, :string
81
- t.column :comments, :string
82
- t.column :internal_identifier, :string
83
- t.column :external_identifier, :string
84
- t.column :external_id_source, :string
85
- t.timestamps
86
- end
87
- end
88
-
89
- # Create relationship_types table
90
- unless table_exists?(:relationship_types)
91
- create_table :relationship_types do |t|
92
- t.column :parent_id, :integer
93
- t.column :lft, :integer
94
- t.column :rgt, :integer
95
-
96
- #custom columns go here
97
- t.column :valid_from_role_type_id, :integer
98
- t.column :valid_to_role_type_id, :integer
99
- t.column :name, :string
100
- t.column :description, :string
101
-
102
- t.column :internal_identifier, :string
103
- t.column :external_identifier, :string
104
- t.column :external_id_source, :string
105
- t.timestamps
106
- end
107
- add_index :relationship_types, :valid_from_role_type_id
108
- add_index :relationship_types, :valid_to_role_type_id
109
- end
110
-
111
- # Create party_relationships table
112
- unless table_exists?(:party_relationships)
113
- create_table :party_relationships do |t|
114
- t.column :description, :string
115
- t.column :party_id_from, :integer
116
- t.column :party_id_to, :integer
117
- t.column :role_type_id_from, :integer
118
- t.column :role_type_id_to, :integer
119
- t.column :status_type_id, :integer
120
- t.column :priority_type_id, :integer
121
- t.column :relationship_type_id, :integer
122
- t.column :from_date, :date
123
- t.column :thru_date, :date
124
- t.column :external_identifier, :string
125
- t.column :external_id_source, :string
126
- t.timestamps
127
- end
128
- add_index :party_relationships, :status_type_id
129
- add_index :party_relationships, :priority_type_id
130
- add_index :party_relationships, :relationship_type_id
131
- end
132
-
133
- # Create organizations table
134
- unless table_exists?(:organizations)
135
- create_table :organizations do |t|
136
- t.column :description, :string
137
- t.column :tax_id_number, :string
138
- t.timestamps
139
- end
140
- end
141
-
142
- # Create individuals table
143
- unless table_exists?(:individuals)
144
- create_table :individuals do |t|
145
- t.column :party_id, :integer
146
- t.column :current_last_name, :string
147
- t.column :current_first_name, :string
148
- t.column :current_middle_name, :string
149
- t.column :current_personal_title, :string
150
- t.column :current_suffix, :string
151
- t.column :current_nickname, :string
152
- t.column :gender, :string, :limit => 1
153
- t.column :birth_date, :date
154
- t.column :height, :decimal, :precision => 5, :scale => 2
155
- t.column :weight, :integer
156
- t.column :mothers_maiden_name, :string
157
- t.column :marital_status, :string, :limit => 1
158
- t.column :social_security_number, :string
159
- t.column :current_passport_number, :integer
160
-
161
- t.column :current_passport_expire_date, :date
162
- t.column :total_years_work_experience, :integer
163
- t.column :comments, :string
164
- t.column :encrypted_ssn, :string
165
- t.column :temp_ssn, :string
166
- t.column :salt, :string
167
- t.column :ssn_last_four, :string
168
- t.timestamps
169
- end
170
- add_index :individuals, :party_id
171
- end
172
-
173
- # Create contacts table
174
- unless table_exists?(:contacts)
175
- create_table :contacts do |t|
176
- t.column :party_id, :integer
177
- t.column :contact_mechanism_id, :integer
178
- t.column :contact_mechanism_type, :string
179
-
180
- t.column :external_identifier, :string
181
- t.column :external_id_source, :string
182
-
183
- t.timestamps
184
- end
185
- add_index :contacts, :party_id
186
- add_index :contacts, [:contact_mechanism_id, :contact_mechanism_type], :name => "besi_2"
187
- end
188
-
189
- # Create contact_types
190
- unless table_exists?(:contact_types)
191
- create_table :contact_types do |t|
192
- t.column :parent_id, :integer
193
- t.column :lft, :integer
194
- t.column :rgt, :integer
195
-
196
- #custom columns go here
197
-
198
- t.column :description, :string
199
- t.column :comments, :string
200
-
201
- t.column :internal_identifier, :string
202
- t.column :external_identifier, :string
203
- t.column :external_id_source, :string
204
-
205
- t.timestamps
206
- end
207
- add_index :contact_types, :parent_id
208
- end
209
-
210
- # Create contact_purposes
211
- unless table_exists?(:contact_purposes)
212
- create_table :contact_purposes do |t|
213
-
214
- t.column :parent_id, :integer
215
- t.column :lft, :integer
216
- t.column :rgt, :integer
217
-
218
- #custom columns go here
219
-
220
- t.column :description, :string
221
- t.column :comments, :string
222
-
223
- t.column :internal_identifier, :string
224
- t.column :external_identifier, :string
225
- t.column :external_id_source, :string
226
-
227
- t.timestamps
228
- end
229
- add_index :contact_purposes, :parent_id
230
-
231
- end
232
-
233
- unless table_exists?(:contact_purposes_contacts)
234
- create_table :contact_purposes_contacts, {:id => false} do |t|
235
- t.column :contact_id, :integer
236
- t.column :contact_purpose_id, :integer
237
- end
238
- add_index :contact_purposes_contacts, [:contact_id, :contact_purpose_id], :name => "contact_purposes_contacts_index"
239
- end
240
-
241
- # Create postal_addresses (a contact_mechanism)
242
- unless table_exists?(:postal_addresses)
243
- create_table :postal_addresses do |t|
244
- t.column :address_line_1, :string
245
- t.column :address_line_2, :string
246
- t.column :city, :string
247
- t.column :state, :string
248
- t.column :zip, :string
249
- t.column :country, :string
250
- t.column :description, :string
251
- t.column :geo_country_id, :integer
252
- t.column :geo_zone_id, :integer
253
- t.timestamps
254
- end
255
- add_index :postal_addresses, :geo_country_id
256
- add_index :postal_addresses, :geo_zone_id
257
- end
258
-
259
- # Create email_addresses (a contact_mechanism)
260
- unless table_exists?(:email_addresses)
261
- create_table :email_addresses do |t|
262
- t.column :email_address, :string
263
- t.column :description, :string
264
-
265
- t.timestamps
266
- end
267
- end
268
-
269
- # Create phone_numbers table (A contact_mechanism)
270
- unless table_exists?(:phone_numbers)
271
- create_table :phone_numbers do |t|
272
- t.column :phone_number, :string
273
- t.column :description, :string
274
-
275
- t.timestamps
276
- end
277
- end
278
-
279
- unless table_exists?(:party_search_facts)
280
- create_table :party_search_facts do |t|
281
- t.column :party_id, :integer
282
- t.column :eid, :string
283
- t.column :type, :string
284
- t.column :roles, :text
285
- t.column :party_description, :string
286
- t.column :party_business_party_type, :string
287
- t.column :user_login, :string
288
- t.column :individual_current_last_name, :string
289
- t.column :individual_current_first_name, :string
290
- t.column :individual_current_middle_name, :string
291
- t.column :individual_birth_date, :string
292
- t.column :individual_ssn, :string
293
- t.column :party_phone_number, :string
294
- t.column :party_email_address, :string
295
- t.column :party_address_1, :string
296
- t.column :party_address_2, :string
297
- t.column :party_primary_address_city, :string
298
- t.column :party_primary_address_state, :string
299
- t.column :party_primary_address_zip, :string
300
- t.column :party_primary_address_country, :string
301
- t.column :user_enabled, :boolean
302
- t.column :user_type, :string
303
- t.column :reindex, :boolean
304
- t.timestamps
305
- end
306
- end
307
-
308
- unless table_exists?(:money)
309
- create_table :money do |t|
310
- t.string :description
311
- t.decimal :amount, :precision => 8, :scale => 2
312
- t.references :currency
313
- t.timestamps
314
- end
315
- add_index :money, :currency_id
316
- end
317
-
318
- unless table_exists?(:currencies)
319
- create_table :currencies do |t|
320
- t.string :name
321
- t.string :definition
322
- t.string :internal_identifier # aka alphabetic_code
323
- t.string :numeric_code
324
- t.string :major_unit_symbol
325
- t.string :minor_unit_symbol
326
- t.string :ratio_of_minor_unit_to_major_unit
327
- t.string :postfix_label
328
- t.datetime :introduction_date
329
- t.datetime :expiration_date
330
- t.timestamps
331
- end
332
- add_index :currencies, :internal_identifier
333
- end
334
-
335
- ## categories
336
- unless table_exists?(:categories)
337
- create_table :categories do |t|
338
- t.string :description
339
- t.string :external_identifier
340
- t.datetime :from_date
341
- t.datetime :to_date
342
- t.string :internal_identifier
343
-
344
- # polymorphic assns
345
- t.integer :category_record_id
346
- t.string :category_record_type
347
-
348
- # nested set cols
349
- t.integer :parent_id
350
- t.integer :lft
351
- t.integer :rgt
352
-
353
- t.timestamps
354
- end
355
- add_index :categories, [:category_record_id, :category_record_type], :name => "category_polymorphic"
356
- end
357
-
358
- ## category_classifications
359
- unless table_exists?(:category_classifications)
360
- create_table :category_classifications do |t|
361
- t.integer :category_id
362
- t.string :classification_type
363
- t.integer :classification_id
364
- t.datetime :from_date
365
- t.datetime :to_date
366
-
367
- t.timestamps
368
- end
369
- add_index :category_classifications, [:classification_id, :classification_type], :name => "classification_polymorphic"
370
- end
371
-
372
- ## descriptive_assets
373
- unless table_exists?(:descriptive_assets)
374
- create_table :descriptive_assets do |t|
375
- t.references :view_type
376
- t.string :internal_identifier
377
- t.text :description
378
- t.string :external_identifier
379
- t.string :external_id_source
380
- t.references :described_record, :polymorphic => true
381
-
382
- t.timestamps
383
- end
384
-
385
- add_index :descriptive_assets, :view_type_id
386
- add_index :descriptive_assets, [:described_record_id, :described_record_type], :name => 'described_record_idx'
387
- end
388
-
389
- unless table_exists?(:view_types)
390
- create_table :view_types do |t|
391
- t.string :internal_identifier
392
- t.string :description
393
-
394
- t.timestamps
395
- end
396
- end
397
-
398
- unless table_exists?(:geo_countries)
399
- create_table :geo_countries do |t|
400
- t.column :name, :string
401
- t.column :iso_code_2, :string, :length => 2
402
- t.column :iso_code_3, :string, :length => 3
403
- t.column :display, :boolean, :default => true
404
- t.column :external_id, :integer
405
- t.column :created_at, :datetime
406
- end
407
- add_index :geo_countries, :name
408
- add_index :geo_countries, :iso_code_2
409
- end
410
-
411
- unless table_exists?(:geo_zones)
412
- create_table :geo_zones do |t|
413
- t.column :geo_country_id, :integer
414
- t.column :zone_code, :string, :default => 2
415
- t.column :zone_name, :string
416
- t.column :created_at, :datetime
417
- end
418
- add_index :geo_zones, :geo_country_id
419
- add_index :geo_zones, :zone_name
420
- add_index :geo_zones, :zone_code
421
- end
422
-
423
- unless table_exists?(:notes)
424
- create_table :notes do |t|
425
- t.integer :created_by_id
426
- t.text :content
427
- t.references :noted_record, :polymorphic => true
428
- t.references :note_type
429
-
430
- t.timestamps
431
- end
432
-
433
- add_index :notes, [:noted_record_id, :noted_record_type]
434
- add_index :notes, :note_type_id
435
- add_index :notes, :created_by_id
436
- end
437
-
438
- unless table_exists?(:note_types)
439
- create_table :note_types do |t|
440
- #these columns are required to support the behavior of the plugin 'awesome_nested_set'
441
- t.integer :parent_id
442
- t.integer :lft
443
- t.integer :rgt
444
-
445
- t.string :description
446
- t.string :internal_identifier
447
- t.string :external_identifier
448
- t.references :note_type_record, :polymorphic => true
449
-
450
- t.timestamps
451
- end
452
-
453
- add_index :note_types, [:note_type_record_id, :note_type_record_type], :name => "note_type_record_idx"
454
- end
455
-
456
- unless table_exists?(:valid_note_types)
457
- create_table :valid_note_types do |t|
458
- t.references :valid_note_type_record, :polymorphic => true
459
- t.references :note_type
460
-
461
- t.timestamps
462
- end
463
-
464
- add_index :valid_note_types, [:valid_note_type_record_id, :valid_note_type_record_type], :name => "valid_note_type_record_idx"
465
- add_index :valid_note_types, :note_type_id
466
- end
467
-
468
- end
469
-
470
- def self.down
471
- [
472
- :currencies, :money, :compass_ae_instance_party_roles,
473
- :party_search_facts, :phone_numbers, :email_addresses,
474
- :postal_addresses, :contact_purposes, :contact_types,
475
- :contacts, :individuals, :organizations,
476
- :party_relationships, :relationship_types, :role_types,
477
- :party_roles, :parties, :categories, :category_classifications,
478
- :descriptive_assets, :view_types, :notes, :note_types, :valid_note_types, :compass_ae_instances
479
- ].each do |tbl|
480
- if table_exists?(tbl)
481
- drop_table tbl
482
- end
483
- end
484
-
485
- end
486
- end