Sha256: d102465ca7ed5df3c17f6f37564e3761968d424b923e4f9a14c47f19e314915c

Contents?: true

Size: 546 Bytes

Versions: 10

Compression:

Stored size: 546 Bytes

Contents

class RenameRedirectTo < ActiveRecord::Migration
  def self.up
    # The original version of the redirects table used 'to' as a column name
    # Postgres is okay with that, but not mysql.
    # You need test if rename needed, because with migration transaction, all
    # failed if rename failed
    if Redirect.columns_hash.has_key? 'to'
      rename_column :redirects, :to, :to_path
    end
  end

  def self.down
    # don't rename column back to broken name.
    # there's little chance this column will be used before now anyway.
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
typo-5.5 db/migrate/028_rename_redirect_to.rb
typo-5.4.4 db/migrate/028_rename_redirect_to.rb
typo-5.4.3 db/migrate/028_rename_redirect_to.rb
typo-5.4.2 db/migrate/028_rename_redirect_to.rb
typo-5.4.1 db/migrate/028_rename_redirect_to.rb
typo-5.4 db/migrate/028_rename_redirect_to.rb
typo-5.1.98 db/migrate/028_rename_redirect_to.rb
typo-5.2 db/migrate/028_rename_redirect_to.rb
typo-5.2.98 db/migrate/028_rename_redirect_to.rb
typo-5.3 db/migrate/028_rename_redirect_to.rb