fix(db) ensure C* waits for schema consensus while bootstrapping
fix(db) ensure C* waits for schema consensus while bootstrapping

When bootstrapping, both `up` and `teardown` phases of each migration
execute subsequently. If the `teardown` step executed DML statements,
such statements can span all peers (due to replication factors). If the
replica peers have not yet reached consensus for their schema, they will
provoke errors and make the bootstrapping fail.

This change ensures that we wait for schema consensus when:

* before running `teardown` if `up` was just ran
* after running `teardown` if `up` was _not_ just ran (see comment as
  for why)
* after running all migrations that were to be run, if executing
  `run_up` only

From another perspective:

* `run_up == true`: wait for consensus at the very end (after executing
  all up steps)
* `run_teardown == true`: wait for consensus after each teardown step
* `run_up == true and run_teardown == true`: wait for consensus before
  each `teardown` step, and once at the very end (after all up and
  teardown steps)

Fix #4229

Kong/kong,Kong/kong,Mashape/kong,Kong/kong