Commit a9fcf968 authored by DJ Mountney's avatar DJ Mountney

Fixes an issue where migrations instead of schema loading were run

If you called rake gitlab:db:drop_tables before running gitlab-ctl
reconfigure (or rake gitlab:db:configure)
parent 5c13af58
---
title: Fixes an issue where migrations instead of schema loading were run
merge_request: 20227
author:
type: changed
...@@ -46,7 +46,9 @@ namespace :gitlab do ...@@ -46,7 +46,9 @@ namespace :gitlab do
desc 'Configures the database by running migrate, or by loading the schema and seeding if needed' desc 'Configures the database by running migrate, or by loading the schema and seeding if needed'
task configure: :environment do task configure: :environment do
if ActiveRecord::Base.connection.tables.any? # Check if we have existing db tables
# The schema_migrations table will still exist if drop_tables was called
if ActiveRecord::Base.connection.tables.count > 1
Rake::Task['db:migrate'].invoke Rake::Task['db:migrate'].invoke
else else
Rake::Task['db:schema:load'].invoke Rake::Task['db:schema:load'].invoke
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment