Remove gitorious from import_sources on ApplicationSetting model

This commit is contained in:
Z.J. van de Weg 2016-09-02 15:24:19 +02:00
parent 553180e1c8
commit 2246218cc0
3 changed files with 33 additions and 1 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,31 @@
class DropGitoriousFieldFromApplicationSettings < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
# After the deploy the caches will be cold anyway
DOWNTIME = false
def up
require 'yaml'
yaml = connection.execute('SELECT import_sources FROM application_settings;').values[0][0]
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

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160901141443) do
ActiveRecord::Schema.define(version: 20160902122721) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"