Basic setup

This walks you through setting up an Elixir/Ecto project to streamline the onboarding process for new developers. It covers configuring a PostgreSQL instance using Docker, updating the project’s configuration files, and managing tasks with a Makefile. The post ensures that your development environment is easy to set up and maintain, enabling new team members to get started quickly with minimal friction.

Basic schemas and changesets

This guide covers the basics of setting up and working with Ecto in an Elixir project. It walks you through defining schemas that map to database tables, creating and validating changesets for data manipulation, and managing database migrations. The post also highlights best practices for handling database interactions, such as using custom validators, ensuring migrations are reversible and decoupled from application code, and addressing concurrency issues when updating records. Through detailed examples, the guide provides a foundational understanding of how to effectively use Ecto in your Elixir applications.

Testing behaviors

This guide walks you through establishing a testing environment for Elixir applications using Ecto. It covers setting up a test database with Docker, configuring your environment for isolated tests, and integrating tools like ExMachina and Faker to simplify test data generation. The post demonstrates how to write effective tests for database operations, ensuring that your application’s core behaviors are thoroughly validated.

A DSL for testing schemas and changesets

Learn how to create a domain-specific language (DSL) for testing Ecto schemas and changesets in Elixir using ExUnit’s CaseTemplate. This post details the process of setting up a ModelCase to streamline test setup and reduce boilerplate, along with creating helper functions for validating schema fields, generating test data, and ensuring that changesets handle both valid and invalid data as expected. The approach allows for more efficient and maintainable test cases.