Skip to content

Commit

Permalink
Merge pull request cloudfoundry#3758 from sap-contributions/fix-backw…
Browse files Browse the repository at this point in the history
…ards-compatibiltity-gha

Fix backwards compatibility github actions
  • Loading branch information
svkrieger authored Apr 17, 2024
2 parents 8157370 + fd01a7a commit ac514a2
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/tasks/db.rake
Original file line number Diff line number Diff line change
Expand Up @@ -242,26 +242,32 @@ namespace :db do
end

def migrate
logging_output
db_logger = Steno.logger('cc.db.migrations')
# The following block, which loads the test DB config is only needed for running migrations in parallel (only in tests)
# It sets the `DB_CONNECTION_STRING` env variable from `POSTGRES|MYSQL_CONNECTION_PREFIX` + test_database number
begin
require_relative '../../spec/support/bootstrap/db_config'
DbConfig.new
rescue LoadError
# Only needed when running tests
# In production the test DB config is not available nor needed, so we ignore this error.
end

logging_output
db_logger = Steno.logger('cc.db.migrations')
DBMigrator.from_config(RakeConfig.config, db_logger).apply_migrations
end

def rollback(number_to_rollback)
logging_output
db_logger = Steno.logger('cc.db.migrations')
# The following block, which loads the test DB config is only needed for running migrations in parallel (only in tests)
# It sets the `DB_CONNECTION_STRING` env variable from `POSTGRES|MYSQL_CONNECTION_PREFIX` + test_database number
begin
require_relative '../../spec/support/bootstrap/db_config'
DbConfig.new
rescue LoadError
# Only needed when running tests
# In production the test DB config is not available nor needed, so we ignore this error.
end

logging_output
db_logger = Steno.logger('cc.db.migrations')
DBMigrator.from_config(RakeConfig.config, db_logger).rollback(number_to_rollback)
end

Expand Down

0 comments on commit ac514a2

Please sign in to comment.