phinx
phinx copied to clipboard
Fix setting identity for fetching column information for postgres 9.x
The postgres adapter when fetching all columns from a table uses this logic to construct the column:
https://github.com/cakephp/phinx/blob/4df3304e11bc0c6e9de4df2eedf733eb9b15cd75/src/Phinx/Db/Adapter/PostgresAdapter.php#L430-L436
The problem here is that $columnInfo['is_identity'] is probably always no for postgres 9.x per its documentation:
is_identity yes_or_no Applies to a feature not available in PostgreSQL
It looks like this feature was added in 10.x. For 9.x, we can probably introduce an alternative scheme where it checks the default and minimally determines that if it is something like nextval('tablename_colname_seq'::regclass), then it is an identity column.