Dynamically defining schema in function with schema macro

Nope, now it doesn’t make sense because I misunderstood at the start.

Seems like you’ll have to use the schemaless Ecto API. Have you checked it out?