Skip to content
Snippets Groups Projects
Commit 5204911f authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg
Browse files

Don't fail on an empty database

parent e683eecd
No related branches found
No related tags found
No related merge requests found
Loading
@@ -7,11 +7,16 @@ class DropGitoriousFieldFromApplicationSettings < ActiveRecord::Migration
Loading
@@ -7,11 +7,16 @@ class DropGitoriousFieldFromApplicationSettings < ActiveRecord::Migration
def up def up
require 'yaml' require 'yaml'
   
yaml = if Gitlab::Database.postgresql? import_sources = connection.execute('SELECT import_sources FROM application_settings;')
connection.execute('SELECT import_sources FROM application_settings;').values[0][0]
else yaml = if Gitlab::Database.postgresql?
connection.execute('SELECT import_sources FROM application_settings;').first[0] import_sources.values[0][0]
end else
return unless import_sources.first
import_sources.first[0]
end
yaml = YAML.safe_load(yaml) yaml = YAML.safe_load(yaml)
yaml.delete 'gitorious' yaml.delete 'gitorious'
   
Loading
Loading
Loading
@@ -11,7 +11,7 @@
Loading
@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # 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 # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment