Merge branch 'zj-drop-gitorious-field' into 'master'

Remove gitorious from import_sources on ApplicationSetting model

Removes 'gitorious' as import field from the import_sources field on ApplicationSetting

Closes #21804

cc @markglenfletcher

See merge request !6180
This commit is contained in:
Rubén Dávila Santos 2016-09-05 23:25:53 +00:00
commit ad599eb65c
2 changed files with 41 additions and 0 deletions

View file

@ -90,6 +90,7 @@ v 8.11.5 (unreleased)
- Fix member expiration date picker after update
- Fix suggested colors options for new labels in the admin area. !6138
- Fix GitLab import button
- Remove gitorious from import_sources
v 8.11.4
- Fix resolving conflicts on forks. !6082

View file

@ -0,0 +1,40 @@
class DropGitoriousFieldFromApplicationSettings < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
# After the deploy the caches will be cold anyway
DOWNTIME = false
def up
require 'yaml'
import_sources = connection.execute('SELECT import_sources FROM application_settings;')
yaml = if Gitlab::Database.postgresql?
import_sources.values[0][0]
else
return unless import_sources.first
import_sources.first[0]
end
yaml = YAML.safe_load(yaml)
yaml.delete 'gitorious'
# No need for a WHERE clause as there is only one
connection.execute("UPDATE application_settings SET import_sources = #{update_yaml(yaml)}")
end
def down
# noop, gitorious still yields a 404 anyway
end
private
def connection
ActiveRecord::Base.connection
end
def update_yaml(yaml)
connection.quote(YAML.dump(yaml))
end
end