Below are the latest tutorial on the topic of Ecto and PostgreSQL
Published 03 Feb - 2020
Something I do in EVERY project is to setup some sort of relation between resources. And even though Phoenix comes with generators for migrations and CRUD opeartions, you still need to modify the code to suite for the relations you want.
In this short tutorial, I will go through my usual steps regarding setting up a basic has_many / belongs_to - relation.
Published 10 Feb - 2020
PostgreSQL has native support for objects stored as JSON as actually binary JSON (or JSONB). With JSONB format, you can add index do the column for faster and more efficient reads.
Even though the format supports both storing arrays of maps and nested maps, I suggest making it simple and just use an unnested single map.
The use case I am going for is have some sort of userentered product attributes that I later can search and filter on.
Published 11 Feb - 2020
I want to add tags to products. And as usual there are a situation where a product can have many tags and a tag can belong to many products.
However, in my opnion, the best option is to use a 'has_many :through' relationship. So for this, I need a table called tags and a join table called taggings.
In this tutorial, I will go through how would do this.
Published 15 Feb - 2020
Unless you already didn't know, when a LieView component is mounted on a page, it runs the mount/2 function twice. One when the page is rendered from the initial request, and one one when the socket is connected. So if you have data that is slow or resource heavy to load, you should consider to wait until the socket is connected so the intial load is not in vein.
A popular approach is to use ghost cards. A ghost gard is a loading placeholder that looks similar to the content that you try to load in but without actual data.
In this tutorial I will show you how
Published 31 Aug - 2020
Fuzzy find is both a simple and a complex thing. Even though though it's simple to implement, its hard to get right from a UX perspective. Luckily, I can help you get going with the technological implementation.
Published 02 Sep - 2020
A very common or even mandatory feature in e-commerce stores is the ability to sort a list of products by attributes. This is easy enough and a good fit for Phoenix LiveView. In this tutorial, I will build on an existing page that displays a list of products and implement sorting on product name and prices.
Published 01 Jun
In this tutorial, I want to show you how you can setup form that stores the data in partly the columns in a database but also some of the fields in JSONB with an embedded schema.
The reason you might want to do this instead of saving all entries in separate columns is that you can add more fields without changing the database.