OptimumCredo.Check.Warning.SeedInsertWithoutOnConflict (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
Seed inserts should be idempotent.
Bad
Repo.insert!(%Role{name: "admin"})Good
Repo.insert!(%Role{name: "admin"}, on_conflict: :nothing, conflict_target: :name)Check-Specific Parameters
Use the following parameters to configure this check:
:seed_paths
Seed file path suffixes, or directories ending in /.
This parameter defaults to ["priv/repo/seeds.exs", "priv/repo/seeds/"].
General Parameters
Like with all checks, general params can be applied.
Parameters can be configured via the .credo.exs config file.