Sha256: 9ed7cdbf5c6c6e71fbf4374d7a44e13096701ca5311b92273e9072c42a089f08
Contents?: true
Size: 531 Bytes
Versions: 18
Compression:
Stored size: 531 Bytes
Contents
class FixProfiles < ActiveRecord::Migration # We got this migration wrong before. Easiest fix is to undo it, then reapply # correctly class User < ActiveRecord::Base include BareMigration end def self.up remove_column :users, :profile_id add_column :users, :profile_id, :integer admin_id = Profile.find_by_label('admin').id User.update_all("profile_id = #{admin_id}") end def self.down remove_column :users, :profile_id add_column :users, :profile_id, :integer, :default => 1 end end
Version data entries
18 entries across 18 versions & 1 rubygems