Datatype serial

Hi all
When I look on the documentation on ecto migration the function references, they mentioned option type default is serial:

What is serial for a datatype?


It is an auto-incrementing :integer, so just a number that auto-increments. On PostgreSQL it literally just maps to :integer as the auto-incrementing is useless for reference fields.

EDIT: For note, if the referenced table uses the normal :integer id field then the default is fine, if you use a different primary key then adjust it as appropriate. I do not think that Ecto supports composite primary key references so you’d have to encode those manually.


Thanks so much.