Skip to content
  • Dylan Griffith's avatar
    Automatically extract BBM spec schema from finalized_by · f55e3a26
    Dylan Griffith authored
    Since the `ensure_batched_background_migration_is_finished` call should
    correspond to the latest version of the schema we need to support for a
    given batched background migration we can assume that we can lock the
    spec to only run against that schema.
    
    Now that we have introduced a `finalized_by` key in our
    `db/docs/batched_background_migrations/*.yml' files we can use this to
    automatically work out what schema to use running tests for a batched
    background migration.
    
    This work is also to support an effort to automatically finalize a
    lot of batched background migrations which ultimately is holding up
    #429165. Saving us the
    effort of setting `schema` in the spec will simplify this work.
    
    This merge request also updates a specific spec
    migrate_human_user_type_spec just so that we have an example to
    demonstrate this works. This migration is already finalized in
    `db/post_migrate/20230523101514_finalize_user_type_migration.rb` so we
    add that version number to the `db/docs` file for this migration job.
    Without locking the version in this spec it fails due to new required
    columns not being set. This demonstrates the new functionality to
    automatically select the schema version works.
    
    This MR also moves some logic out of `spec_helper` and into
    `spec/support/helpers/migrations_helpers` because it makes more sense
    there.
    f55e3a26