Skip to content

Commit

Permalink
Fix migrate failures on vms with missing spec folder
Browse files Browse the repository at this point in the history
  • Loading branch information
FloThinksPi authored and johha committed Jan 2, 2024
1 parent 596ded9 commit b7f3277
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/tasks/db.rake
Original file line number Diff line number Diff line change
Expand Up @@ -244,16 +244,24 @@ namespace :db do
def migrate
Steno.init(Steno::Config.new(sinks: [Steno::Sink::IO.new($stdout)]))
db_logger = Steno.logger('cc.db.migrations')
require_relative '../../spec/support/bootstrap/db_config'
DbConfig.new
begin
require_relative '../../spec/support/bootstrap/db_config'
DbConfig.new
rescue LoadError
# Only needed when running tests
end
DBMigrator.from_config(RakeConfig.config, db_logger).apply_migrations
end

def rollback(number_to_rollback)
Steno.init(Steno::Config.new(sinks: [Steno::Sink::IO.new($stdout)]))
db_logger = Steno.logger('cc.db.migrations')
require_relative '../../spec/support/bootstrap/db_config'
DbConfig.new
begin
require_relative '../../spec/support/bootstrap/db_config'
DbConfig.new
rescue LoadError
# Only needed when running tests
end
DBMigrator.from_config(RakeConfig.config, db_logger).rollback(number_to_rollback)
end

Expand Down

0 comments on commit b7f3277

Please sign in to comment.