summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRubén Dávila Santos <ruben@gitlab.com>2016-09-05 23:25:53 +0000
committerRubén Dávila Santos <ruben@gitlab.com>2016-09-05 23:25:53 +0000
commitad599eb65c8ce483a7faaffe226ec7ce53da0f55 (patch)
tree86fc47224b5e4497d6c4cdc7de39b22311973f16
parent7d2bd6b91bdfa0afd6b0032ddf23c24a28c61056 (diff)
parent5204911f610c4062ce7d831e8182b0e959eda17c (diff)
downloadgitlab-ce-ad599eb65c8ce483a7faaffe226ec7ce53da0f55.tar.gz
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
-rw-r--r--CHANGELOG1
-rw-r--r--db/migrate/20160902122721_drop_gitorious_field_from_application_settings.rb40
2 files changed, 41 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 3f52fab74d7..f54a17e1ea2 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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
diff --git a/db/migrate/20160902122721_drop_gitorious_field_from_application_settings.rb b/db/migrate/20160902122721_drop_gitorious_field_from_application_settings.rb
new file mode 100644
index 00000000000..b7b6e9b3484
--- /dev/null
+++ b/db/migrate/20160902122721_drop_gitorious_field_from_application_settings.rb
@@ -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