Sha256: e42d72554d2bb78ddd3653f0d3d1cdd6fd28a9bc3ea1e38c6cac1fa440f9d546

Contents?: true

Size: 668 Bytes

Versions: 33

Compression:

Stored size: 668 Bytes

Contents

class VersionStatusChange < ActiveRecord::Migration
  STATUS_CHANGES = {
    30 => 70,
    35 => 65,
    40 => 60,
  }
  def self.up
    change_column :versions, :status, :integer, :default => 70, :null => false
    remove_column :nodes, :max_status

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

  def self.down
    change_column :versions, :status, :integer, :default => 30, :null => false
    create_column :nodes, :max_status, :integer, :default => 30

    STATUS_CHANGES.each do |from, to|
      execute "UPDATE versions 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/20090928143754_version_status_change.rb
zena-1.2.7 db/fix/old_migrations/20090928143754_version_status_change.rb
zena-1.2.6 db/fix/old_migrations/20090928143754_version_status_change.rb
zena-1.2.5 db/fix/old_migrations/20090928143754_version_status_change.rb
zena-1.2.4 db/fix/old_migrations/20090928143754_version_status_change.rb
zena-1.2.3 db/fix/old_migrations/20090928143754_version_status_change.rb
zena-1.2.2 db/fix/old_migrations/20090928143754_version_status_change.rb
zena-1.2.1 db/fix/old_migrations/20090928143754_version_status_change.rb
zena-1.2.0 db/fix/old_migrations/20090928143754_version_status_change.rb
zena-1.1.3 db/fix/old_migrations/20090928143754_version_status_change.rb
zena-1.1.2 db/fix/old_migrations/20090928143754_version_status_change.rb
zena-1.1.1 db/fix/old_migrations/20090928143754_version_status_change.rb
zena-1.1.0 db/fix/old_migrations/20090928143754_version_status_change.rb
zena-1.0.0 db/fix/old_migrations/20090928143754_version_status_change.rb
zena-1.0.0.rc3 db/fix/old_migrations/20090928143754_version_status_change.rb
zena-1.0.0.rc2 db/fix/old_migrations/20090928143754_version_status_change.rb
zena-1.0.0.rc1 db/fix/old_migrations/20090928143754_version_status_change.rb
zena-0.16.9 db/migrate/20090928143754_version_status_change.rb
zena-1.0.0.beta3 db/migrate/20090928143754_version_status_change.rb
zena-0.16.8 db/migrate/20090928143754_version_status_change.rb