Postgres database adapter entrypoint.
This adapter validates one Postgres repo per call:
Bylaw.Db.Adapters.Postgres.validate(
MyApp.Repo,
[
Bylaw.Db.Adapters.Postgres.Checks.MissingForeignKeyIndexes
]
)Pass :dynamic_repo when the call should run against one dynamic repo.
Validate multiple repos by calling validate/2 or validate/3 once per repo.
The repo argument expects an Ecto SQL repo at runtime. Bylaw keeps Ecto SQL as
an optional integration; callers must have ecto_sql and a Postgres driver in
their application when they use repo-backed targets.
Rules DSL
Every built-in Postgres check can be scoped with rules:. Scope is shared
across checks; each check defines any additional rule options it needs. Checks
with default behavior can be passed as bare modules to run globally. Use
{Check, rules: [...]} when a check needs required rule options or should run
only for matching database objects.
Shared scope keys are where: and except:. where: applies a rule when any
matcher matches, and except: suppresses a rule that would otherwise match.
Matchers use plural keys with non-empty list values, such as schemas:,
tables:, columns:, constraints:, types:, referenced_tables:, and
referenced_columns: where supported by the check.
Top-level validate: false disables the whole check. Checks with no
check-specific rule options accept only shared scope keys inside rules.
Checks with required rule options document those options in their module docs
with copyable rule examples.
Examples
Bylaw.Db.Adapters.Postgres.validate(
MyApp.Repo,
[
Bylaw.Db.Adapters.Postgres.Checks.MissingForeignKeyIndexes
]
)
Summary
Functions
Runs checks against one Postgres repo.
Runs checks against one Postgres repo with options.
Types
Option accepted by validate/3.
@type validate_opts() :: [validate_opt()]
Options accepted by validate/3.
Functions
@spec validate(repo :: module(), checks :: [Bylaw.Db.check_spec()]) :: Bylaw.Db.Check.result()
Runs checks against one Postgres repo.
Pass the repo and checks. Use :dynamic_repo when validating a specific
dynamic repo with validate/3. To validate multiple repos, call this function
once per repo.
@spec validate( repo :: module(), checks :: [Bylaw.Db.check_spec()], opts :: validate_opts() ) :: Bylaw.Db.Check.result()
Runs checks against one Postgres repo with options.
The only supported option is :dynamic_repo.