Scope
Use this skill when introducing or modifying persisted data.
Checklist
- •Generate migrations via
mix ecto.gen.migrationand updatepriv/repo/migrations/*. - •Define schemas in
lib/app/modelwithuse App, :model, explicitfieldtypes, andtimestamps. - •Validate with
App.Validatehelpers andApp.Fieldtypes (e.g.Field.TrimmedString). - •Avoid casting programmatically-set fields; set them explicitly on the struct when creating records.
- •Use
Ecto.Changeset.get_field/2to read changeset values (no access syntax). - •Preload associations before rendering in templates.
- •Add or update fixtures in
test/support/fixtureswhen tests need new data.