BigW Consortium Gitlab

Commit 1a7326ba by DJ Mountney

Switch the gitlab:db:configure task to use tables.any? instead of looking…

Switch the gitlab:db:configure task to use tables.any? instead of looking specifically for the schema_migrations table
parent 40d4d8a4
......@@ -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
......
......@@ -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
......
......@@ -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)
......
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