phinx
phinx copied to clipboard
Support enums in postgres
Hi there, basically just checking to see if this something you all would consider adding. Postgres supports enums on columns but it's a two-step process where you make an enum type and then you set that type on the create like this:
CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy');
CREATE TABLE person (
name text,
current_mood mood
);
More information at https://www.postgresql.org/docs/current/datatype-enum.html
So far CakePHP has never used enums as such, as they have a lot of disadvantages. Instead tinyint(2) and a PHP internal mapping has been used to better handle this kind of use case.
But that said a PR for such a feature is welcome. Folks outside of CakePHP or in general interested in using this feature despite the disadvantages sure could find it useful.
The problem with PostgreSQL enums is the fact, that (only in PostgreSQL) they are sort of a custom column type instead of a generic enum column type (like in MySQL 8) which has additional data inside it.
Right yeah, I showed that in my example. It's definitely more annoying to deal with so I understand if lower down the list. Figured I'd check what you all were thinking though.
Like I said: it would have to be a community PR As seen from other tickets: there is no big incentive for those topics to be addressed from maintainer side. Best to do it yourself if u are interested in this feature
Got it. Thanks