in elixir there are no classes so i’m not sure exactly what you mean. If you make a schema you have defined a struct already.
In elixir with ecto database tables aren’t a one to one mapping to the tables that back them. You can have schemas that aren’t backed by tables at all, so i’m not sure it would be desirable
Don’t let your old habits stop you from enjoying a new tech.
As others said, not all Ecto.Schema-derived modules in your project are mandated to be backed by a database. There are embeds, there are structs just [ab-]using Ecto for validation, etc.
But you can probably tag your structs that are DB-backed. Something like @persistent true at the top?
@RDP1974 As a “former” dotnet developer that is now really enjoying the Elixir ecosystem, I can’t stress enough how @dimitarvp’s advice is important. The best way to cope with those differences is just letting your mental model adapt to the new environment.
I’ll go ahead and say that in 8 years doing almost exclusive dotnet stuff, I haven’t experienced a lot of cases that could benefit that much from using a “database first” approach. This mainly has to do with how you should be caring about your domain modeling.
Of course there are cases that this approach can be useful, but in my experience, I’ve only seen this on rare occasions, for example: legacy systems with extremely-simple modeled domains.
Depending on what you’re doing, it’s also possible to not have any entity mapping at all. It takes very few lines of code to transform an arbitrary Postgrex result into a list of maps.