summaryrefslogtreecommitdiffstats
path: root/db/migrate/20180501132547_add_author_id_to_time_entries.rb
blob: 3d79bf210467fbfa864c24247d8de61bbebc3e44 (plain)
1
2
3
4
5
6
7
8
9
10
11
class AddAuthorIdToTimeEntries < ActiveRecord::Migration[5.1]
  def up
    add_column :time_entries, :author_id, :integer, :default => nil, :after => :project_id
    # Copy existing user_id to author_id
    TimeEntry.update_all('author_id = user_id')
  end

  def down
    remove_column :time_entries, :author_id
  end
end