Using a primary key not named id with Ecto and Mysql


You would like to use a legacy or a database you don’t have control over, with Phoenix, but the primary key of the table it is not named ‘id’.

** (Mariaex.Error) (1054): Unknown column '' in 'field list'


You can define the primary key using the @primary_key as in:

 @primary_key {:id_other_name, :integer, []}
  schema "db_table" do
    field :description, :string

Taken from here