Ecto Schema should have the same name of the table?

Hello, I have a schema like this

use Ecto.Schema

schema "goodname" do

the name of the schema need to be the same than the table in DB ?

That’s not the name of the schema, but source. And yes, goodname must be a table in the DB.

1 Like

Ok ! thank you :slight_smile:

That’s not correct. It can be anything, but if it’s not a valid table name the schema needs to be combined with a valid db table at runtime to be useful.

For examples of that see e.g. Ecto.Schema — Ecto v3.10.3