Commit c9bb130b authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg

Only rename the column if its not there yet

The problem can only arise when upgrading from a CE version to an
 EE version after last months release as in that release the table
appearances was created. But when it was created we already took
care of this rename. Thus on an upgrade the migration will fail as
the column `light_logo` is not in the table, and `header_logo` already
is.

Thus this check solve this.
parent a2669e85
class RenameHeaderFieldOnAppearrance < ActiveRecord::Migration
def change
rename_column :appearances, :light_logo, :header_logo
def up
unless column_exists?(:appearances, :header_logo)
rename_column :appearances, :light_logo, :header_logo
end
remove_column :appearances, :dark_logo
if column_exists?(:appearances, :dark_logo)
remove_column :appearances, :dark_logo
end
end
def down
rename_column(:appearances, :header_logo, :light_logo)
add_column(:appearances, :dark_logo, :string)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment