Problem
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’.
1 |
** (Mariaex.Error) (1054): Unknown column 'p0.id' in 'field list' |
Solution
You can define the primary key using the @primary_key as in:
1 2 3 4 5 |
@primary_key {:id_other_name, :integer, []} schema "db_table" do field :description, :string ... end |
Taken from here