Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support enums in postgres #2258

Open
rbalik opened this issue Jan 21, 2024 · 5 comments
Open

Support enums in postgres #2258

rbalik opened this issue Jan 21, 2024 · 5 comments
Labels

Comments

@rbalik
Copy link

rbalik commented Jan 21, 2024

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

@dereuromark
Copy link
Member

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.

@LordSimal
Copy link
Contributor

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.

@rbalik
Copy link
Author

rbalik commented Jan 21, 2024

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.

@dereuromark
Copy link
Member

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

@rbalik
Copy link
Author

rbalik commented Jan 21, 2024

Got it. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants