So far my Phoenix application has worked fine. The last time I reseted my db was about 2-3 weeks ago.
Now after I’ve reseted it, my custom psql function has started throwing an exception related “integer vs bigint for ID/primary key column”.
DETAIL: Returned type bigint does not match expected type integer in column 1.
But it’s always been integer in my app with no problem.
The thing is that I’ve not changed anything in the migrations related to ID columns.
Has there been any breaking changes in Ecto or Postgresql related to ID/primary key datatypes?.
P.S.
In all my old phoenix applications all ID columns are now integers – it’s how they were generated by Ecto or Phoenix. I’ve not reseted a db in these apps. However, in this app they’re now generated bigint. Why? Where can I read about this?
You could also migrate all the affected tables to the new datatype. PostgreSQL supports this with the following syntax:
ALTER TABLE <tablename> ALTER COLUMN id TYPE bigint;
Similar would need to be done on foreign keys in other tables. Due to foreign keys, you may need to drop relations first (not sure off-hand, would have to try it out to see what breaks and I’m away from anything with a usable database on it at this particular moment…).
So would be a bit of a pain, but a one time thing, and probably at least somewhat automatable given a list of tables with ids that need updating and a list of foreign key relationships that depend on them?