From 083c0e28f70dcf41b15fee20f7d3305f21f737ae Mon Sep 17 00:00:00 2001
From: "Z.J. van de Weg" <zegerjan@gitlab.com>
Date: Tue, 6 Sep 2016 12:13:35 +0200
Subject: [PATCH] Support empty PG database too

First check if there is a result on the migration, else there is
nothing to do
---
 ...902122721_drop_gitorious_field_from_application_settings.rb | 3 +--
 1 file changed, 1 insertion(+), 2 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 b7b6e9b3484..a80a57254dd 100644
--- a/db/migrate/20160902122721_drop_gitorious_field_from_application_settings.rb
+++ b/db/migrate/20160902122721_drop_gitorious_field_from_application_settings.rb
@@ -8,12 +8,11 @@ class DropGitoriousFieldFromApplicationSettings < ActiveRecord::Migration
     require 'yaml'
 
     import_sources = connection.execute('SELECT import_sources FROM application_settings;')
+    return unless import_sources.first # support empty databases
 
     yaml = if Gitlab::Database.postgresql?
              import_sources.values[0][0]
            else
-             return unless import_sources.first
-
              import_sources.first[0]
            end
 
-- 
GitLab