Sha256: 71f5b8353a8e01f00c5e93b801ce6d8fbf14b3f593bdd51e8b6588daf03fdec0

Contents?: true

Size: 544 Bytes

Versions: 33

Compression:

Stored size: 544 Bytes

Contents

class ChangeStatusValuesForComments < ActiveRecord::Migration
  STATUS_CHANGES = {
    30 => 70,
    35 => 65,
    40 => 60,
  }
  def self.up
    change_column :comments, :status, :integer, :default => 70, :null => false

    STATUS_CHANGES.each do |from, to|
      execute "UPDATE comments SET status = #{to} WHERE status = #{from}"
    end
  end

  def self.down
    change_column :versions, :status, :integer

    STATUS_CHANGES.each do |from, to|
      execute "UPDATE comments SET status = #{from} WHERE status = #{to}"
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
zena-1.2.8 db/fix/old_migrations/20091001084025_change_status_values_for_comments.rb
zena-1.2.7 db/fix/old_migrations/20091001084025_change_status_values_for_comments.rb
zena-1.2.6 db/fix/old_migrations/20091001084025_change_status_values_for_comments.rb
zena-1.2.5 db/fix/old_migrations/20091001084025_change_status_values_for_comments.rb
zena-1.2.4 db/fix/old_migrations/20091001084025_change_status_values_for_comments.rb
zena-1.2.3 db/fix/old_migrations/20091001084025_change_status_values_for_comments.rb
zena-1.2.2 db/fix/old_migrations/20091001084025_change_status_values_for_comments.rb
zena-1.2.1 db/fix/old_migrations/20091001084025_change_status_values_for_comments.rb
zena-1.2.0 db/fix/old_migrations/20091001084025_change_status_values_for_comments.rb
zena-1.1.3 db/fix/old_migrations/20091001084025_change_status_values_for_comments.rb
zena-1.1.2 db/fix/old_migrations/20091001084025_change_status_values_for_comments.rb
zena-1.1.1 db/fix/old_migrations/20091001084025_change_status_values_for_comments.rb
zena-1.1.0 db/fix/old_migrations/20091001084025_change_status_values_for_comments.rb
zena-1.0.0 db/fix/old_migrations/20091001084025_change_status_values_for_comments.rb
zena-1.0.0.rc3 db/fix/old_migrations/20091001084025_change_status_values_for_comments.rb
zena-1.0.0.rc2 db/fix/old_migrations/20091001084025_change_status_values_for_comments.rb
zena-1.0.0.rc1 db/fix/old_migrations/20091001084025_change_status_values_for_comments.rb
zena-0.16.9 db/migrate/20091001084025_change_status_values_for_comments.rb
zena-1.0.0.beta3 db/migrate/20091001084025_change_status_values_for_comments.rb
zena-0.16.8 db/migrate/20091001084025_change_status_values_for_comments.rb