Ecto subqueries with virtual fields?

How do you persist your schema in the database? I can’t find it in the sample project.

P.S.: I might be wrong and I hope someone more knowledgeable will clarify this but I think the :virtual option on the field is not meant to work like this. It is just a field in the struct that you assign to it but it is not persisted in the database. This means you can’t use it as a filter. Again… maybe I am wrong and really would like some on else’s opinion on this.

Maybe your situation is similar to this post

You can do a lot of things with the calculated index without using fragments. But do read the whole thread. There were some objections against that method.