Permalink
Browse files

Fixes a failing legacy migration.

  • Loading branch information...
matiaskorhonen committed Jul 14, 2012
1 parent 54f4c2a commit 380e05ac3551bd8ff68e93b851e9573a3afae689
Showing with 16 additions and 4 deletions.
  1. +16 −4 db/migrate/20110405084456_alter_user_password_salt.rb
@@ -1,11 +1,23 @@
class AlterUserPasswordSalt < ActiveRecord::Migration
+ # This is a legacy migration and it doesn't look like it's needed any more.
+ # The column existance checks are here to make sure that wedon't break
+ # anyone's migrations.
+
def self.up
- change_column :users, :password_salt, :string, :null => true
- change_column :admins, :password_salt, :string, :null => true
+ if column_exists? :users, :password_salt
+ change_column :users, :password_salt, :string, :null => true
+ end
+ if column_exists? :admins, :password_salt
+ change_column :admins, :password_salt, :string, :null => true
+ end
end
def self.down
- change_column :users, :password_salt, :string, :null => false
- change_column :admins, :password_salt, :string, :null => false
+ if column_exists? :users, :password_salt
+ change_column :users, :password_salt, :string, :null => false
+ end
+ if column_exists? :admins, :password_salt
+ change_column :admins, :password_salt, :string, :null => false
+ end
end
end

0 comments on commit 380e05a

Please sign in to comment.