Commit 89e82697 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'upgrade-ce-ee-migration-error-fix' into 'master'

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 solves it. 

@dblessing @DouweM 

BTW; should be included in the current release and the previous.

Fixes #406 

See merge request !290
parents a2669e85 c9bb130b
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