Don't fail on an empty database

This commit is contained in:
Z.J. van de Weg 2016-09-05 19:29:49 +02:00
parent e683eecdd9
commit 5204911f61
2 changed files with 11 additions and 6 deletions

View File

@ -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'

View File

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