Stephan Yustephanyu.hashnode.dev·Mar 13, 2024Ecto vs ActiveRecordIn this post, I am going to take a look at Ecto, a data mapping and database query library designed to provide seamless integration between Elixir code and database operations and compare it to Ruby on Rail's ActiveRecord. Ecto and ActiveRecord are b...DiscussElixir
Pau Riosapaugramming.com·Feb 19, 2024Things I Learned using Ecto.Schema in 2024 (Part 1)The problem I have two schemas, coffees and orders wherein I want to get the recent completed order from each coffees First solution defmodule Schemas.Coffee do # ... more code has_many :completed_orders, Schemas.Order @spec coffee_query...Discuss·40 readsElixir
Maqboolwww.maqbool.net·Sep 9, 2023Create a sorted Index in Ectodefmodule MyApp.Repo.Migrations.AddMessagesInsertedAtIndex do use Ecto.Migration @disable_ddl_transaction true @disable_migration_lock true def change do create index("messages", ["inserted_at DESC"], concurrently: true) end end if y...Discuss·68 readsToday I learned ecto
Meraj Mollameraj-gearhead.ca·Aug 12, 2023Building Self-referential Associations in Elixir/PhoenixSelf-referential association is used to associate a model with itself. It's pretty common to have this kind of association to build relationships in today's social media applications - Twitter, Mastodon, Facebook, etc. However, the association model ...Meraj Molla and 1 other are discussing this2 people are discussing thisDiscuss·1.3K readsElixir
John WilgerProjohnwilger.com·Feb 16, 2020Complex Unique Constraints with PostgreSQL Triggers in EctoEcto makes it easy to work with typical uniqueness constraints in your database; you just define your table like this: defmodule MyApp.Repo.Migrations.CreateFoos do use Ecto.Migration def change do create table(:foos) do add :name, :te...Discussecto