Commit ecca21aa authored by Stan Hu's avatar Stan Hu

Disable touching individual DB migration files in production

We shouldn't be migrating the individual DB files in production
mode. These files should be already created in development/test mode,
and the user may not have permission to update these files during a
`db:schema:dump` Rake task.
parent a55abcbd
...@@ -7,7 +7,7 @@ module Gitlab ...@@ -7,7 +7,7 @@ module Gitlab
extend ActiveSupport::Concern extend ActiveSupport::Concern
def dump_schema_information # :nodoc: def dump_schema_information # :nodoc:
Gitlab::Database::SchemaMigrations.touch_all(self) Gitlab::Database::SchemaMigrations.touch_all(self) if Gitlab.dev_or_test_env?
nil nil
end end
......
...@@ -26,4 +26,12 @@ RSpec.describe Gitlab::Database::PostgresqlAdapter::DumpSchemaVersionsMixin do ...@@ -26,4 +26,12 @@ RSpec.describe Gitlab::Database::PostgresqlAdapter::DumpSchemaVersionsMixin do
instance.dump_schema_information instance.dump_schema_information
end end
it 'does not call touch_all in production' do
allow(Rails).to receive(:env).and_return(ActiveSupport::StringInquirer.new('production'))
expect(Gitlab::Database::SchemaMigrations).not_to receive(:touch_all)
instance.dump_schema_information
end
end end
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