Sha256: 7790b8c8b03ecf945ce55f6d0fcd7d5fccb1fb6a7bd7072483ec987fbfcf776b

Contents?: true

Size: 406 Bytes

Versions: 4

Compression:

Stored size: 406 Bytes

Contents

class MoveEditorToUser < ActiveRecord::Migration
  def self.up
    add_column :users, :editor, :integer, :default => 2
    
    unless $schema_generator
      blog = Blog.default
      editor = blog.editor
      users = User.find(:all)
      users.each do |user|
        user.editor = editor.to_i
        user.save!
      end
    end
    
  end

  def self.down
    remove_column :users, :editor
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
typo-5.1.98 db/migrate/075_move_editor_to_user.rb
typo-5.2 db/migrate/075_move_editor_to_user.rb
typo-5.2.98 db/migrate/075_move_editor_to_user.rb
typo-5.3 db/migrate/075_move_editor_to_user.rb