
Master Ecto fundamentals by building a simple mix project, learning change sets, validation, and database operations from insert to update, with uuid, has many, embedded schemas, and transactions.
Set up a minimal mix project to explore Ecto basics, including data management, casting, and validations, then define a person schema with Ecto and run mix deps get.
Learn how casting works in a change set by using types, params, and allowed keys to shape data like name and age into a map ready for database use.
Demonstrate dynamic casting in a changeset by conditionally casting the favorite alcohol field when age is 18 or older, using pattern matching on age and params.
Understand how data represents the current struct and how changes capture modifications, then apply changes to merge new values into the old data to update it.
Master Ecto changeset validations by enforcing required fields like name and age, validating a dog or cat as a favorite animal, casting data, and surfacing errors in Phoenix app views.
Learn to build a custom changeset validation in Ecto, using a function to restrict a favorite drink (beer) and allow cola, highlighting practical validation patterns.
Set up a dockerized Postgres database and a Phoenix app using Ecto and Live View, create the database, configure development settings, and run the server on port 4000.
Learn how changesets validate required fields like name, age, and height before inserting into the database. Compare struct-based inserts versus change set driven validation to ensure data integrity.
Add a unique constraint to the schema, so creating a person returns an error instead of crashing the application, which you can display to the user.
Add an index migration to the people table by creating a unique index on the uid column. Migrate and learn how to implement an index for people in Ecto.
Explore embedding a favorite book per person using Ecto's embedded schemas and embeds_one, defining a book embed with a title, and wiring change sets and cast_embed for seamless data casting.
Set up teams and assign people using Ecto has_many associations; create migrations, reference teams, and preload to illustrate a person belongs to a team and a team has many people.
The lecture explains has_many through in Ecto by showing how teams have many people who have many favorite books, and how to fetch all team favorite books via through associations.
Explore how to model has many associations with UUID as foreign keys in Ecto, creating books tied to people, using references, changesets, and preload for favorite books.
Learn to insert and update data in an Ecto repository using changesets, handle success or error tuples, and validate updates with changeset validations.
Learn to construct a conditional Ecto query with the from macro and where clause to fetch records, filtering by team ID equals five.
Create and insert records in a context by building a change set for themes, people, and books, validating params, and using repo.insert with pattern matching.
Update records by converting the existing create functions into update ones within a context module, applying changesets to team, person, and book, and validating the updated IDs after recompiling.
Learn to seed a rich data set with 100 teams, 5,000 people, and 50,000 books using the Ecto Repo inserts, while managing foreign key constraints and seed order.
Explore advanced Ecto queries with where, select, group_by, order_by, offset, and limit. Learn to alias entities, preload associations, and count grouped results by age.
Explore how ecto.multi coordinates inserts and updates in a single transaction, using changesets and function mappings to create a team, a person, and a book with relationships.
Test changesets in a Phoenix app by creating test data, validating required fields such as title, checking casting, and verifying change set behavior in the test environment.
Create a test in a nested context to verify that listing all teams returns the expected count, using sandboxing, repo inserts, and aliases in Ecto.
Test the get_team function in Ecto by setting up a team in the repo, inserting it with required name and timestamps, then retrieving by id and asserting the name.
Test create, update, and delete operations in a context by setting up test data, using pattern matching, and asserting repo state.
Let me guide you through what is a Changeset: how to cast, put changes, validate, know the differences between `data` and `changes` fields.
Learn about the difference between structs and Changesets.
Let us get into the bridge between Changeset and your database using Phoenix.
Learn about Phoenix generators and let's discuss what do they do.
Learn about migrations, add indices and contstraints, change integer IDs to UUIDs.
Ecto.Schema. Set fields, let's see what are Embedded Schemas by creating embed_one and embeds_many built-in-a-record relations. Associations of all kind (has_one, has_many, has_many through and has_many with UUID as a foreign key),
Learn about the Ecto.Repo. How to insert, update, read from and delete records.
Lean about Ecto.Query. How to compose a query to get the records you want.
Put it all together to a Context module.
Seed the initial data for your application. Set up a script to automatically insert over 50.000 fresh database records.
Learn about bulk operations. Repo.insert_all/update_all and their limitations.
See the power of the Ecto.Multi, database transactions, ensuring data consistency.
Test it all: Changesets, all of the Context.
The course may be followed along, i don't change the code off the camera. Though the suggested way to do the course is to just watch me talk to you very slowly and showing you around what's possible in Ecto. (: