diff options
author | DJ Mountney <david@twkie.net> | 2016-05-15 07:59:49 -0700 |
---|---|---|
committer | DJ Mountney <david@twkie.net> | 2016-05-25 10:47:09 -0700 |
commit | 1a7326ba9ae4c7db0d03df0c114b84a22ab83ced (patch) | |
tree | 7f2802b194f5db25135d0916b164477fc3218203 | |
parent | 40d4d8a4e7d3934731448a76c6d65db7943852c2 (diff) | |
download | gitlab-ce-1a7326ba9ae4c7db0d03df0c114b84a22ab83ced.tar.gz |
Switch the gitlab:db:configure task to use tables.any? instead of looking specifically for the schema_migrations table
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | lib/tasks/gitlab/db.rake | 2 | ||||
-rw-r--r-- | spec/tasks/gitlab/db_rake_spec.rb | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG index 56e6ea1686c..7aa12018bb3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date. v 8.9.0 (unreleased) - Redesign navigation for project pages - Use gitlab-shell v3.0.0 + - Add rake task 'gitlab:db:configure' for conditionally seeding or migrating the database - Changed the Slack build message to use the singular duration if necessary (Aran Koning) - Fix issues filter when ordering by milestone - Todos will display target state if issuable target is 'Closed' or 'Merged' @@ -46,7 +47,6 @@ v 8.8.0 - Sanitize repo paths in new project error message - Bump mail_room to 0.7.0 to fix stuck IDLE connections - Remove future dates from contribution calendar graph. - - Add rake task 'gitlab:db:configure' for conditionally seeding or migrating the database - Support e-mail notifications for comments on project snippets - Fix API leak of notes of unauthorized issues, snippets and merge requests - Use ActionDispatch Remote IP for Akismet checking diff --git a/lib/tasks/gitlab/db.rake b/lib/tasks/gitlab/db.rake index 5ae47c15d7d..86f5d65f128 100644 --- a/lib/tasks/gitlab/db.rake +++ b/lib/tasks/gitlab/db.rake @@ -39,7 +39,7 @@ namespace :gitlab do desc 'Configures the database by running migrate, or by loading the schema and seeding if needed' task configure: :environment do - if ActiveRecord::Base.connection.table_exists? 'schema_migrations' + if ActiveRecord::Base.connection.tables.any? Rake::Task['db:migrate'].invoke else Rake::Task['db:schema:load'].invoke diff --git a/spec/tasks/gitlab/db_rake_spec.rb b/spec/tasks/gitlab/db_rake_spec.rb index fe70d5bcbf4..36d03a224e4 100644 --- a/spec/tasks/gitlab/db_rake_spec.rb +++ b/spec/tasks/gitlab/db_rake_spec.rb @@ -20,7 +20,7 @@ describe 'gitlab:db namespace rake task' do describe 'configure' do it 'should invoke db:migrate when schema has already been loaded' do - allow(ActiveRecord::Base.connection).to receive(:table_exists?).and_return(true) + allow(ActiveRecord::Base.connection).to receive(:tables).and_return(['default']) expect(Rake::Task['db:migrate']).to receive(:invoke) expect(Rake::Task['db:schema:load']).not_to receive(:invoke) expect(Rake::Task['db:seed_fu']).not_to receive(:invoke) @@ -28,7 +28,7 @@ describe 'gitlab:db namespace rake task' do end it 'should invoke db:shema:load and db:seed_fu when schema is not loaded' do - allow(ActiveRecord::Base.connection).to receive(:table_exists?).and_return(false) + allow(ActiveRecord::Base.connection).to receive(:tables).and_return([]) expect(Rake::Task['db:schema:load']).to receive(:invoke) expect(Rake::Task['db:seed_fu']).to receive(:invoke) expect(Rake::Task['db:migrate']).not_to receive(:invoke) @@ -46,7 +46,7 @@ describe 'gitlab:db namespace rake task' do end it 'should not invoke seed after a failed schema_load' do - allow(ActiveRecord::Base.connection).to receive(:table_exists?).and_return(false) + allow(ActiveRecord::Base.connection).to receive(:tables).and_return([]) allow(Rake::Task['db:schema:load']).to receive(:invoke).and_raise(RuntimeError, 'error') expect(Rake::Task['db:schema:load']).to receive(:invoke) expect(Rake::Task['db:seed_fu']).not_to receive(:invoke) |