diff options
author | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-09-05 19:29:49 +0200 |
---|---|---|
committer | Z.J. van de Weg <zegerjan@gitlab.com> | 2016-09-05 19:53:38 +0200 |
commit | 5204911f610c4062ce7d831e8182b0e959eda17c (patch) | |
tree | 5cccba94445028427bbfdab02ab577a809eff4d0 /db/migrate | |
parent | e683eecdd99748f4b08359e2e979f94bf8ab5792 (diff) | |
download | gitlab-ce-5204911f610c4062ce7d831e8182b0e959eda17c.tar.gz |
Don't fail on an empty databasezj-drop-gitorious-field
Diffstat (limited to 'db/migrate')
-rw-r--r-- | db/migrate/20160902122721_drop_gitorious_field_from_application_settings.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/db/migrate/20160902122721_drop_gitorious_field_from_application_settings.rb b/db/migrate/20160902122721_drop_gitorious_field_from_application_settings.rb index 3342744ba93..b7b6e9b3484 100644 --- a/db/migrate/20160902122721_drop_gitorious_field_from_application_settings.rb +++ b/db/migrate/20160902122721_drop_gitorious_field_from_application_settings.rb @@ -7,11 +7,16 @@ class DropGitoriousFieldFromApplicationSettings < ActiveRecord::Migration def up require 'yaml' - yaml = if Gitlab::Database.postgresql? - connection.execute('SELECT import_sources FROM application_settings;').values[0][0] - else - connection.execute('SELECT import_sources FROM application_settings;').first[0] - end + 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' |