Skip to content

Commit 338c7f0

Browse files
xandrocSamze
andauthored
Perform stack check by loading models without waiting on migrations (#3925)
* Perform stack check by loading models without waiting on migrations We do this because we want to be able to call the stack checker prior to running migrations. This is so that if the stack checker fails the deployment then new migrations will not have run and we are left a clean state. Co-authored-by: Sam Gunaratne <[email protected]> * Checking the stacks table exists to prevent stack_check error on a clean install Co-authored-by: Sam Gunaratne <[email protected]> --------- Co-authored-by: Sam Gunaratne <[email protected]>
1 parent 1488eb0 commit 338c7f0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/tasks/stack_check.rake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ namespace :stacks do
22
desc 'Check Installed Stacks'
33
task stack_check: :environment do
44
logger = Steno.logger('cc.stack')
5-
VCAP::CloudController::DB.load_models(RakeConfig.config.get(:db), logger)
5+
db = VCAP::CloudController::DB.connect(RakeConfig.config.get(:db), logger)
6+
next unless db.table_exists?(:stacks)
7+
8+
VCAP::CloudController::DB.load_models_without_migrations_check(RakeConfig.config.get(:db), logger)
69
RakeConfig.config.load_db_encryption_key
710
require 'models/runtime/buildpack_lifecycle_data_model'
811
require 'models/runtime/stack'

0 commit comments

Comments
 (0)