Skip to content

Instantly share code, notes, and snippets.

khalsah / migrate.rb
Created May 11, 2011 — forked from zacclark/migrate.rb
VHGDB - Migrating statuses to actions
View migrate.rb
class MoveStatusDataToStatusChangeActions < ActiveRecord::Migration
def self.up
execute <<-EOQ
INSERT INTO actions(status_code, attendance_id, type, occurred_at, created_at, updated_at, archived_title, archived_company_id)
statuses.status, statuses.attendance_id, 'StatusChangeAction', statuses.created_at, statuses.created_at, statuses.updated_at, titles.title,
FROM statuses
JOIN attendances ON = statuses.attendance_id
JOIN people ON = attendances.person_id
JOIN employments ON = people.current_employment_id