Sha256: edb8099e8e4583d9540fb75c94f8800681915818e8a2df0f19fb2e72ebd10ab1

Contents?: true

Size: 448 Bytes

Versions: 2

Compression:

Stored size: 448 Bytes

Contents

class MoveEditorAsString < ActiveRecord::Migration
  def self.up
    remove_column :users, :editor
    add_column :users, :editor, :string, :default => 'simple'
    
    unless $schema_generator
      users = User.find(:all)
      users.each do |user|
        user.editor = 'simple'
        user.save!
      end
    end
    
  end

  def self.down
    remove_column :users, :editor
    add_column :users, :editor, :integer, :default => 0
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
typo-5.2.98 db/migrate/079_move_editor_as_string.rb
typo-5.3 db/migrate/079_move_editor_as_string.rb