OptimumCredo.Check.Warning.ExplicitIndexName (OptimumCredo v0.5.0)
View SourceBasics
This check is disabled by default.
Learn how to enable it via .credo.exs.
This check has a base priority of low and works with any version of Elixir.
Explanation
Let Ecto infer index names for single-column indexes.
Bad
create unique_index(:users, [:email], name: :users_email_unique)Good
create unique_index(:users, [:email])Multi-column indexes and expression indexes may need an explicit name.
Check-Specific Parameters
Use the following parameters to configure this check:
:allow_multi_column
Accept explicit names for indexes over several columns.
This parameter defaults to true.
:allow_partial_indexes
Accept explicit names for indexes with a where: clause.
This parameter defaults to true.
:ignore_files
Path suffixes or regexes for migrations to skip.
This parameter defaults to [].
General Parameters
Like with all checks, general params can be applied.
Parameters can be configured via the .credo.exs config file.