Ecto for Beginners

Get up to speed and productive fast with Ecto through code examples and tests.

  1. Introducing Ecto
    Introduction to the Ecto guide. Covers why I wrote the guide and what to expect from the guide.
  2. Creating our Phoenix app
    Creating our Phoenix application so that we can learn more about using Ecto
  3. Creating a table
    Creating our Posts table with a migration.
  4. Adding and Removing a column
    Add and Remove a column from our Posts table.
  5. Drop a table
    Creating a table and then dropping a table with migrations.
  6. Setup our Post Model
    Now with our Posts table created, we will setup our Post Ecto model.
  7. Inserting a record
    Now with our Post model created, we can insert our records into our database.
  8. Get all records
    Return all the Post records.
  9. Find by id
    Find Posts by their id.
  10. Where by field
    Find all the records based on a where query.
  11. Where with ranges of values
    We query posts depending on their votes value.
  12. Query with date ranges
    Query posts on their posted on date.
  13. Update a record
    Updating a post record.
  14. Delete a record
    Delete a post
  15. Has Many Relationship
    Create a has-many relationship between Posts and Comments.
  16. Insert child in a one to many relationship
    We add a comment to our post.
  17. Many to Many relationship
    We create tags for posts.
  18. Reading Many to Many
    We create a tag and then add a tag to a post.
  19. Count
    Finding the count of a query.
  20. Update all
    Using a query to update all the records that match our criteria.
  21. Paging
    Page through results.
  22. Generic Paging Function
    Making a paging function that will work on any Ecto model.