erp_work_effort 4.0.0 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/api/v1/projects_controller.rb +25 -0
- data/app/controllers/api/v1/time_entries_controller.rb +313 -0
- data/app/controllers/api/v1/transportation_routes_controller.rb +9 -0
- data/app/controllers/api/v1/work_effort_associations_controller.rb +102 -0
- data/app/controllers/api/v1/work_effort_party_assignments_controller.rb +136 -0
- data/app/controllers/api/v1/work_effort_types_controller.rb +120 -0
- data/app/controllers/api/v1/work_efforts_controller.rb +284 -0
- data/app/models/associated_transportation_route.rb +8 -5
- data/app/models/cal_evt_party_role.rb +9 -0
- data/app/models/calendar_event.rb +46 -0
- data/app/models/calendar_invite.rb +10 -0
- data/app/models/candidate_submission.rb +37 -0
- data/app/models/experience.rb +11 -0
- data/app/models/extensions/biz_txn_events.rb +35 -0
- data/app/models/extensions/finacial_txns.rb +27 -0
- data/app/models/extensions/order_line_item.rb +12 -0
- data/app/models/extensions/party.rb +204 -0
- data/app/models/party_skill.rb +2 -0
- data/app/models/pay_period.rb +59 -0
- data/app/models/position.rb +8 -0
- data/app/models/position_fulfillment.rb +8 -0
- data/app/models/position_type.rb +12 -0
- data/app/models/project.rb +59 -0
- data/app/models/requirement.rb +2 -0
- data/app/models/resume.rb +11 -0
- data/app/models/shift.rb +22 -0
- data/app/models/skill_type.rb +8 -0
- data/app/models/staffing_position.rb +9 -0
- data/app/models/time_entry.rb +260 -0
- data/app/models/timesheet.rb +194 -0
- data/app/models/timesheet_party_role.rb +21 -0
- data/app/models/transportation_route.rb +103 -18
- data/app/models/transportation_route_segment.rb +44 -0
- data/app/models/transportation_route_stop.rb +19 -0
- data/app/models/wc_code.rb +7 -0
- data/app/models/work_effort.rb +512 -30
- data/app/models/work_effort_association.rb +7 -0
- data/app/models/work_effort_association_type.rb +5 -0
- data/app/models/work_effort_biz_txn_event.rb +22 -0
- data/app/models/work_effort_party_assignment.rb +140 -3
- data/app/models/work_effort_type.rb +5 -0
- data/config/routes.rb +54 -11
- data/db/data_migrations/20150709053041_add_skill_types.rb +27 -0
- data/db/data_migrations/20150709055922_add_position_types.rb +27 -0
- data/db/data_migrations/20150711220000_add_task_tracked_statuses.rb +25 -0
- data/db/data_migrations/20150712081804_add_work_effort_types.rb +23 -0
- data/db/data_migrations/20150718052204_add_project_tracked_statuses.rb +24 -0
- data/db/data_migrations/20150718054404_add_project_party_role_types.rb +14 -0
- data/db/data_migrations/20150812150320_add_work_effort_dependency_types.rb +35 -0
- data/db/migrate/20100220000000_base_work_efforts.rb +310 -89
- data/db/migrate/20150227174108_create_staffing_positions.rb +11 -0
- data/db/migrate/20150305194158_create_wc_codes.rb +24 -0
- data/db/migrate/20150313134411_create_shifts.rb +28 -0
- data/db/migrate/20150325195749_create_candidate_submissions.rb +22 -0
- data/db/migrate/20150327115910_resumes.rb +15 -0
- data/db/migrate/20150401060938_add_resume_parser_statuses.rb +14 -0
- data/db/migrate/20150607181734_create_calendar_events.rb +24 -0
- data/db/migrate/20150616174228_create_cal_evt_party_roles.rb +19 -0
- data/db/migrate/20150707164520_create_calendar_invites.rb +21 -0
- data/db/migrate/20150718052404_create_projects.rb +20 -0
- data/db/migrate/20150812191812_update_work_efforts.rb +59 -0
- data/db/migrate/20150824152639_add_sequence_to_work_effort.rb +9 -0
- data/db/migrate/20150830133951_add_work_effort_biz_txn_events.rb +21 -0
- data/db/migrate/20150908200612_update_time_entries.rb +70 -0
- data/db/migrate/20151115180427_add_defaults_for_work_effort.rb +36 -0
- data/db/migrate/20151218195330_update_transportation_routes.rb +72 -0
- data/db/migrate/20160310163052_add_created_by_updated_by_to_erp_work_effort.rb +63 -0
- data/db/migrate/20160418115227_add_created_by_updated_by_to_skill_type.rb +34 -0
- data/lib/erp_work_effort.rb +3 -0
- data/lib/erp_work_effort/config.rb +33 -0
- data/lib/erp_work_effort/engine.rb +0 -4
- data/lib/erp_work_effort/services/unit_converter.rb +284 -0
- data/lib/erp_work_effort/version.rb +1 -1
- data/lib/tasks/populate_model_data.rake +19 -0
- data/lib/tasks/resume_parser.rake +18 -0
- metadata +80 -16
- data/app/controllers/erp_work_effort/erp_app/organizer/tasks/base_controller.rb +0 -13
- data/app/controllers/erp_work_effort/erp_app/organizer/tasks/work_efforts_controller.rb +0 -128
- data/db/data_migrations/20131213151309_create_tasks_organizer_application.rb +0 -14
- data/db/migrate/20130829153419_base_routes.rb +0 -93
- data/db/migrate/20131213140617_add_work_effort_role_assignments.rb +0 -16
- data/db/migrate/20131213144223_add_work_item_to_work_effort.rb +0 -8
- data/db/migrate/20140106184615_update_work_effort_item_id_to_int.rb +0 -27
@@ -0,0 +1,24 @@
|
|
1
|
+
class CreateWcCodes < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
|
4
|
+
unless table_exists?(:wc_codes)
|
5
|
+
create_table :wc_codes do |t|
|
6
|
+
|
7
|
+
t.integer :party_id
|
8
|
+
t.string :wc_code
|
9
|
+
t.string :description
|
10
|
+
t.string :internal_identifier
|
11
|
+
t.text :custom_fields
|
12
|
+
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.down
|
20
|
+
if table_exists?(:wc_codes)
|
21
|
+
drop_table :wc_codes
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class CreateShifts < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
|
5
|
+
unless table_exists?(:shifts)
|
6
|
+
create_table :shifts do |t|
|
7
|
+
|
8
|
+
t.integer :party_id
|
9
|
+
t.string :description
|
10
|
+
t.string :internal_identifier
|
11
|
+
t.text :custom_fields
|
12
|
+
t.timestamp :shift_start
|
13
|
+
t.timestamp :shift_end
|
14
|
+
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.down
|
22
|
+
if table_exists?(:shifts)
|
23
|
+
drop_table :shifts
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreateCandidateSubmissions < ActiveRecord::Migration
|
2
|
+
|
3
|
+
|
4
|
+
def self.up
|
5
|
+
unless table_exists?(:candidate_submissions)
|
6
|
+
create_table :candidate_submissions do |t|
|
7
|
+
t.integer :order_line_item_id
|
8
|
+
t.string :description
|
9
|
+
t.string :internal_identifier
|
10
|
+
t.text :custom_fields
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.down
|
17
|
+
if table_exists?(:candidate_submissions)
|
18
|
+
drop_table :candidate_submissions
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# This migration comes from erp_work_effort (originally 20150327115704)
|
2
|
+
class Resumes < ActiveRecord::Migration
|
3
|
+
def up
|
4
|
+
create_table :resumes do |t|
|
5
|
+
t.references :party
|
6
|
+
t.column :file_content ,:text
|
7
|
+
t.column :xml_resume_data ,:text
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def down
|
12
|
+
drop_table :resumes
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class AddResumeParserStatuses < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
resume_parser = TrackedStatusType.create(description: 'Resume Parser', internal_identifier: 'resume_parser')
|
4
|
+
|
5
|
+
['Pending', 'Complete', 'Error'].each do |status|
|
6
|
+
_status = TrackedStatusType.create(description: status, internal_identifier: status.underscore)
|
7
|
+
_status.move_to_child_of(resume_parser)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.down
|
12
|
+
TrackedStatusType.iid('resume_parser').destroy
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class CreateCalendarEvents < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :calendar_events do |t|
|
4
|
+
|
5
|
+
t.string :title
|
6
|
+
t.datetime :starttime, :endtime
|
7
|
+
t.boolean :all_day, :default => false
|
8
|
+
t.boolean :is_public, :default => true
|
9
|
+
t.text :description
|
10
|
+
t.string :list_view_image_url
|
11
|
+
t.string :status
|
12
|
+
|
13
|
+
t.text :custom_fields
|
14
|
+
|
15
|
+
t.timestamps
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
add_index :calendar_events, :id, :name => "cal_evt_id_idx"
|
20
|
+
add_index :calendar_events, :starttime, :name => "cal_evt_starttime_idx"
|
21
|
+
add_index :calendar_events, :endtime, :name => "cal_evt_endtime_idx"
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class CreateCalEvtPartyRoles < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :cal_evt_party_roles do |t|
|
4
|
+
|
5
|
+
t.references :party
|
6
|
+
t.references :role_type
|
7
|
+
t.references :calendar_event
|
8
|
+
t.text :description
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
|
13
|
+
add_index :cal_evt_party_roles, :id, :name => "cepr_id_idx"
|
14
|
+
add_index :cal_evt_party_roles, :party_id, :name => "cepr_party_id_idx"
|
15
|
+
add_index :cal_evt_party_roles, :calendar_event_id, :name => "cepr__evtid_idx"
|
16
|
+
add_index :cal_evt_party_roles, :role_type_id, :name => "cepr_rt_id_idx"
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class CreateCalendarInvites < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
create_table :calendar_invites do |t|
|
4
|
+
|
5
|
+
t.string :title
|
6
|
+
t.text :invite_text
|
7
|
+
t.references :calendar_event
|
8
|
+
t.integer :inviter_id
|
9
|
+
t.integer :invitee_id
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
add_index :calendar_invites, :id, :name => "calendar_invite_id_idx"
|
16
|
+
add_index :calendar_invites, :calendar_event_id, :name => "ci_evt_id_idx"
|
17
|
+
add_index :calendar_invites, :inviter_id, :name => "ci_inviter_id_idx"
|
18
|
+
add_index :calendar_invites, :invitee_id, :name => "ci_invitee_id_idx"
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class CreateProjects < ActiveRecord::Migration
|
2
|
+
|
3
|
+
def self.up
|
4
|
+
unless table_exists?(:projects)
|
5
|
+
create_table :projects do |t|
|
6
|
+
t.string :description
|
7
|
+
t.column :project_record_id, :integer
|
8
|
+
t.column :project_record_type, :string
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.down
|
15
|
+
if table_exists?(:projects)
|
16
|
+
drop_table :projects
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
class UpdateWorkEfforts < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
|
4
|
+
# WorkEffort
|
5
|
+
add_column :work_efforts, :comments, :text unless column_exists? :work_efforts, :comments
|
6
|
+
add_column :work_efforts, :percent_done, :integer unless column_exists? :work_efforts, :percent_done
|
7
|
+
add_column :work_efforts, :duration, :integer unless column_exists? :work_efforts, :duration
|
8
|
+
add_column :work_efforts, :duration_unit, :string unless column_exists? :work_efforts, :duration_unit
|
9
|
+
add_column :work_efforts, :effort, :integer unless column_exists? :work_efforts, :effort
|
10
|
+
add_column :work_efforts, :effort_unit, :string unless column_exists? :work_efforts, :effort_unit
|
11
|
+
add_column :work_efforts, :base_line_start_at, :datetime unless column_exists? :work_efforts, :base_line_start_at
|
12
|
+
add_column :work_efforts, :base_line_end_at, :datetime unless column_exists? :work_efforts, :base_line_end_at
|
13
|
+
add_column :work_efforts, :base_line_percent_done, :integer unless column_exists? :work_efforts, :base_line_percent_done
|
14
|
+
add_column :work_efforts, :project_id, :integer unless column_exists? :work_efforts, :project_id
|
15
|
+
|
16
|
+
add_index :work_efforts, :project_id, name: 'work_effort_project_idx' unless index_exists? :work_efforts, name: 'work_effort_project_idx'
|
17
|
+
|
18
|
+
rename_column :work_efforts, :started_at, :start_at unless column_exists? :work_efforts, :start_at
|
19
|
+
rename_column :work_efforts, :finished_at, :end_at unless column_exists? :work_efforts, :end_at
|
20
|
+
|
21
|
+
remove_column :work_efforts, :projected_completion_time if column_exists? :work_efforts, :projected_completion_time
|
22
|
+
remove_column :work_efforts, :actual_completion_time if column_exists? :work_efforts, :actual_completion_time
|
23
|
+
|
24
|
+
# WorkEffortAssignment
|
25
|
+
add_column :work_effort_associations, :lag, :integer unless column_exists? :work_effort_associations, :lag
|
26
|
+
add_column :work_effort_associations, :lag_unit, :string unless column_exists? :work_effort_associations, :lag_unit
|
27
|
+
|
28
|
+
# WorkEffortPartyAssignment
|
29
|
+
add_column :work_effort_party_assignments, :resource_allocation, :integer unless column_exists? :work_effort_party_assignments, :resource_allocation
|
30
|
+
end
|
31
|
+
|
32
|
+
def down
|
33
|
+
|
34
|
+
# WorkEffort
|
35
|
+
remove_column :work_efforts, :comments if column_exists? :work_efforts, :comments
|
36
|
+
remove_column :work_efforts, :percent_done if column_exists? :work_efforts, :percent_done
|
37
|
+
remove_column :work_efforts, :duration if column_exists? :work_efforts, :duration
|
38
|
+
remove_column :work_efforts, :duration_unit if column_exists? :work_efforts, :duration_unit
|
39
|
+
remove_column :work_efforts, :effort if column_exists? :work_efforts, :effort
|
40
|
+
remove_column :work_efforts, :effort_unit if column_exists? :work_efforts, :effort_unit
|
41
|
+
remove_column :work_efforts, :base_line_start_at if column_exists? :work_efforts, :base_line_start_at
|
42
|
+
remove_column :work_efforts, :base_line_end_at if column_exists? :work_efforts, :base_line_end_at
|
43
|
+
remove_column :work_efforts, :base_line_percent_done if column_exists? :work_efforts, :base_line_percent_done
|
44
|
+
remove_column :work_efforts, :project_id if column_exists? :work_efforts, :project_id
|
45
|
+
|
46
|
+
rename_column :work_efforts, :start_at, :started_at unless column_exists? :work_efforts, :started_at
|
47
|
+
rename_column :work_efforts, :end_at, :finished_at unless column_exists? :work_efforts, :finished_at
|
48
|
+
|
49
|
+
add_column :work_efforts, :projected_completion_time, :datetime unless column_exists? :work_efforts, :projected_completion_time
|
50
|
+
add_column :work_efforts, :actual_completion_time, :datetime unless column_exists? :work_efforts, :actual_completion_time
|
51
|
+
|
52
|
+
# WorkEffortAssignment
|
53
|
+
remove_column :work_effort_associations, :lag if column_exists? :work_effort_associations, :lag
|
54
|
+
remove_column :work_effort_associations, :lag_unit if column_exists? :work_effort_associations, :lag_unit
|
55
|
+
|
56
|
+
# WorkEffortPartyAssignment
|
57
|
+
remove_column :work_effort_party_assignments, :resource_allocation if column_exists? :work_effort_party_assignments, :resource_allocation
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class AddSequenceToWorkEffort < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
add_column :work_efforts, :sequence, :integer, default: 0 unless column_exists? :work_efforts, :sequence
|
4
|
+
end
|
5
|
+
|
6
|
+
def down
|
7
|
+
remove_column :work_efforts, :sequence, :integer, default: 0 if column_exists? :work_efforts, :sequence
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class AddWorkEffortBizTxnEvents < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
unless table_exists? :work_effort_biz_txn_events
|
4
|
+
create_table :work_effort_biz_txn_events do |t|
|
5
|
+
t.references :work_effort
|
6
|
+
t.references :biz_txn_event
|
7
|
+
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :work_effort_biz_txn_events, :biz_txn_event_id, name: 'bzt_we_biz_txn_event_idx'
|
12
|
+
add_index :work_effort_biz_txn_events, :work_effort_id, name: 'bzt_we_work_effort_idx'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def down
|
17
|
+
if table_exists? :work_effort_biz_txn_events
|
18
|
+
drop_table :work_effort_biz_txn_events
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
class UpdateTimeEntries < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
drop_table :time_sheet_entries if table_exists? :time_sheet_entries
|
4
|
+
drop_table :time_sheet_entry_party_roles if table_exists? :time_sheet_entry_party_roles
|
5
|
+
|
6
|
+
unless table_exists? :pay_periods
|
7
|
+
create_table :pay_periods do |t|
|
8
|
+
t.date :from_date
|
9
|
+
t.date :thru_date
|
10
|
+
t.integer :week_number
|
11
|
+
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
unless table_exists? :timesheets
|
17
|
+
create_table :timesheets do |t|
|
18
|
+
t.text :comment
|
19
|
+
t.references :pay_period
|
20
|
+
t.string :status
|
21
|
+
|
22
|
+
t.timestamps
|
23
|
+
end
|
24
|
+
|
25
|
+
add_index :timesheets, :pay_period_id
|
26
|
+
end
|
27
|
+
|
28
|
+
unless table_exists? :time_entries
|
29
|
+
create_table :time_entries do |t|
|
30
|
+
t.datetime :from_datetime
|
31
|
+
t.datetime :thru_datetime
|
32
|
+
t.integer :regular_hours_in_seconds
|
33
|
+
t.integer :overtime_hours_in_seconds
|
34
|
+
t.text :comment
|
35
|
+
t.references :timesheet
|
36
|
+
t.references :work_effort
|
37
|
+
t.boolean :manual_entry
|
38
|
+
|
39
|
+
t.timestamps
|
40
|
+
end
|
41
|
+
|
42
|
+
add_index :time_entries, :timesheet_id
|
43
|
+
add_index :time_entries, :work_effort_id
|
44
|
+
end
|
45
|
+
|
46
|
+
unless table_exists? :timesheet_party_roles
|
47
|
+
create_table :timesheet_party_roles do |t|
|
48
|
+
t.references :timesheet
|
49
|
+
t.references :party
|
50
|
+
t.references :role_type
|
51
|
+
|
52
|
+
t.timestamps
|
53
|
+
end
|
54
|
+
|
55
|
+
add_index :timesheet_party_roles, :timesheet_id
|
56
|
+
add_index :timesheet_party_roles, :party_id
|
57
|
+
add_index :timesheet_party_roles, :role_type_id
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
def down
|
63
|
+
[:pay_periods, :timesheets, :time_entries, :timesheet_party_roles].each do |table|
|
64
|
+
if table_exists? table
|
65
|
+
drop_table table
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class AddDefaultsForWorkEffort < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
change_column :work_efforts, :percent_done, :integer, default: 0
|
4
|
+
change_column :work_efforts, :duration, :integer, default: 0
|
5
|
+
change_column :work_efforts, :duration_unit, :string, default: 'd'
|
6
|
+
change_column :work_efforts, :effort, :integer, default: 0
|
7
|
+
change_column :work_efforts, :duration_unit, :string, default: 'd'
|
8
|
+
|
9
|
+
WorkEffort.all.each do |work_effort|
|
10
|
+
# clean data
|
11
|
+
if work_effort.percent_done.blank?
|
12
|
+
work_effort.percent_done = 0
|
13
|
+
end
|
14
|
+
|
15
|
+
if work_effort.duration.blank?
|
16
|
+
work_effort.duration = 0
|
17
|
+
work_effort.duration_unit = 'd'
|
18
|
+
end
|
19
|
+
|
20
|
+
if work_effort.effort.blank?
|
21
|
+
work_effort.effort = 0
|
22
|
+
work_effort.effort_unit = 'd'
|
23
|
+
end
|
24
|
+
|
25
|
+
work_effort.save!
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def down
|
30
|
+
change_column :work_efforts, :percent_done, :integer
|
31
|
+
change_column :work_efforts, :duration, :integer
|
32
|
+
change_column :work_efforts, :duration_unit, :string
|
33
|
+
change_column :work_efforts, :effort, :integer
|
34
|
+
change_column :work_efforts, :duration_unit, :string
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
class UpdateTransportationRoutes < ActiveRecord::Migration
|
2
|
+
def up
|
3
|
+
unless index_exists? :transportation_route_stops, 'trans_route_stop_trans_route_idx'
|
4
|
+
add_index :transportation_route_stops, :transportation_route_id, name: 'trans_route_stop_trans_route_idx'
|
5
|
+
end
|
6
|
+
|
7
|
+
unless column_exists? :transportation_routes, :billable
|
8
|
+
add_column :transportation_routes, :billable, :boolean, default: false
|
9
|
+
end
|
10
|
+
|
11
|
+
unless column_exists? :transportation_routes, :manual_entry
|
12
|
+
add_column :transportation_routes, :manual_entry, :boolean, default: false
|
13
|
+
end
|
14
|
+
|
15
|
+
unless index_exists? :transportation_route_segments, 'trans_route_seg_trans_route_id_idx'
|
16
|
+
add_index :transportation_route_segments, :transportation_route_id, name: 'trans_route_seg_trans_route_id_idx'
|
17
|
+
end
|
18
|
+
|
19
|
+
unless index_exists? :transportation_route_segments, 'trans_route_seg_trans_route_id_idx'
|
20
|
+
add_index :transportation_route_segments, :from_transportation_route_stop_id, name: 'trans_route_seg_from_trans_stop_idx'
|
21
|
+
end
|
22
|
+
|
23
|
+
unless index_exists? :transportation_route_segments, 'trans_route_seg_trans_route_id_idx'
|
24
|
+
add_index :transportation_route_segments, :to_transportation_route_stop_id, name: 'trans_route_seg_to_trans_stop_idx'
|
25
|
+
end
|
26
|
+
|
27
|
+
unless column_exists? :transportation_route_segments, :end_mileage
|
28
|
+
rename_column :transportation_route_segments, :end_milage, :end_mileage
|
29
|
+
end
|
30
|
+
|
31
|
+
change_column :transportation_route_segments, :end_mileage, :decimal, :precision => 8, :scale => 1
|
32
|
+
|
33
|
+
change_column :transportation_route_segments, :start_mileage, :decimal, :precision => 8, :scale => 1
|
34
|
+
|
35
|
+
unless column_exists? :transportation_route_segments, :miles_traveled
|
36
|
+
add_column :transportation_route_segments, :miles_traveled, :decimal, :precision => 8, :scale => 1
|
37
|
+
end
|
38
|
+
|
39
|
+
unless column_exists? :transportation_route_segments, :estimated_arrival
|
40
|
+
rename_column :transportation_route_segments, :estmated_arrival, :estimated_arrival
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def down
|
45
|
+
if index_exists? :transportation_route_stops, :transportation_route_id, name: 'trans_route_stop_trans_route_idx'
|
46
|
+
remove_index :transportation_route_stops, name: 'trans_route_stop_trans_route_idx'
|
47
|
+
end
|
48
|
+
|
49
|
+
remove_column :transportation_routes, :billable if column_exists? :transportation_routes, :billable
|
50
|
+
remove_column :transportation_routes, :manual_entry if column_exists? :transportation_routes, :manual_entry
|
51
|
+
|
52
|
+
if index_exists? :transportation_route_segments, :transportation_route_id, name: 'trans_route_seg_trans_route_id_idx'
|
53
|
+
remove_index :transportation_route_segments, name: 'trans_route_seg_trans_route_id_idx'
|
54
|
+
end
|
55
|
+
|
56
|
+
if index_exists? :transportation_route_segments, :from_transportation_route_stop_id, name: 'trans_route_seg_from_trans_stop_idx'
|
57
|
+
remove_index :transportation_route_segments, name: 'trans_route_seg_from_trans_stop_idx'
|
58
|
+
end
|
59
|
+
|
60
|
+
if index_exists? :transportation_route_segments, :transportation_route_id, name: 'trans_route_seg_to_trans_stop_idx'
|
61
|
+
remove_index :transportation_route_segments, name: 'trans_route_seg_to_trans_stop_idx'
|
62
|
+
end
|
63
|
+
|
64
|
+
rename_column :transportation_route_segments, :end_mileage, :end_milage if column_exists? :transportation_route_segments, :end_mileage
|
65
|
+
change_column :transportation_route_segments, :end_milage, :integer if column_exists? :transportation_route_segments, :end_milage
|
66
|
+
|
67
|
+
change_column :transportation_route_segments, :start_mileage, :integer if column_exists? :transportation_route_segments, :start_mileage
|
68
|
+
remove_column :transportation_route_segments, :miles_traveled if column_exists? :transportation_route_segments, :miles_traveled
|
69
|
+
|
70
|
+
rename_column :transportation_route_segments, :estimated_arrival, :estmated_arrival if column_exists? :transportation_route_segments, :estimated_arrival
|
71
|
+
end
|
72
|
+
end
|