您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

20180501132547_add_author_id_to_time_entries.rb 323B

1234567891011
  1. class AddAuthorIdToTimeEntries < ActiveRecord::Migration[5.1]
  2. def up
  3. add_column :time_entries, :author_id, :integer, :default => nil, :after => :project_id
  4. # Copy existing user_id to author_id
  5. TimeEntry.update_all('author_id = user_id')
  6. end
  7. def down
  8. remove_column :time_entries, :author_id
  9. end
  10. end