Lone Badger Tech

Project layout

Files bsm reads, and what each is for.

db/
  bsm.yaml                   provider, environments, variables, preprocessor settings
  bsm.plan                   ordered list of changes and tags
  .gitattributes                bsm.plan merge=union, *.sql text eol=lf
  changes/
    <change-name>/
      deploy.sql                required
      revert.sql                required unless the change is !irreversible
      verify.sql                optional
  repeatable/                   re-applied when their hash changes (any folder depth)
    views/vActiveCustomer.sql
    procedures/usp_FindCustomer.sql
  environments/
    <environment>/              repeatable scripts for one environment only
      seed.sql

Pass the project folder with -C / --project (default: the current folder).

Rules bsm checks

  • Every change in the plan has a folder with deploy.sql, and every folder in changes/ is in the plan.
  • Change names use letters, digits, -, _ and ., starting with a letter or digit. Names are case-sensitive.
  • A missing revert.sql is an error unless the plan marks the change !irreversible.
  • Scripts are read as UTF-8. A byte-order mark and Windows line endings are ignored for hashing.

bsm plan check reports all of these without a database. Put it in a pre-commit hook and in CI.