You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently it is not possible in migrations to add a USING clause to changing the column type that have no direct available cast, without the use of writing SQL queries myself. The example that I happened to come across myself is changing the type of a column from bigint to bigint[] (array).
The postgres query to achieve this is as follows:
ALTERTABLE table_name ALTER column_name TYPE bigint[] USING array[column_name];
Motivation
Currently it is not possible in migrations to add a USING clause to changing the column type that have no direct available cast, without the use of writing SQL queries myself. The example that I happened to come across myself is changing the type of a column from bigint to bigint[] (array).
The postgres query to achieve this is as follows:
Proposed Solutions
Something like:
Additional Information
I was requested to open this issue in a Discord thread titled "(PG) Change type of column to array of the previous type."
The text was updated successfully, but these errors were encountered: