GitLab ist wegen Wartungsarbeiten am Montag, den 10. Mai, zwischen 17:00 und 19:00 Uhr nicht erreichbar.

Commit bb365473 authored by jplang's avatar jplang

Check if index exists before removing it (#12713).

git-svn-id: https://svn.redmine.org/redmine/trunk@11137 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 27cdecb0
class ChangeChangesetsRevisionToString < ActiveRecord::Migration
def self.up
remove_index :changesets, :name => :changesets_repos_rev
# Some backends (eg. SQLServer 2012) do not support changing the type
# of an indexed column so the index needs to be dropped first
# BUT this index is renamed with some backends (at least SQLite3) for
# some (unknown) reasons, thus we check for the other name as well
# so we don't end up with 2 identical indexes
if index_exists? :changesets, [:repository_id, :revision], :name => :changesets_repos_rev
remove_index :changesets, :name => :changesets_repos_rev
end
if index_exists? :changesets, [:repository_id, :revision], :name => :altered_changesets_repos_rev
remove_index :changesets, :name => :altered_changesets_repos_rev
end
change_column :changesets, :revision, :string, :null => false
add_index :changesets, [:repository_id, :revision], :unique => true, :name => :changesets_repos_rev
end
def self.down
remove_index :changesets, :name => :changesets_repos_rev
if index_exists? :changesets, :changesets_repos_rev
remove_index :changesets, :name => :changesets_repos_rev
end
if index_exists? :changesets, [:repository_id, :revision], :name => :altered_changesets_repos_rev
remove_index :changesets, :name => :altered_changesets_repos_rev
end
change_column :changesets, :revision, :integer, :null => false
add_index :changesets, [:repository_id, :revision], :unique => true, :name => :changesets_repos_rev
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