Use actual enum in Postgres Plateform instead of varchar with checks #886
Labels
enhancement
A feature that exists, works as intended but needs to be improved
feature request
A feature that does not yet exist but will be a good addition to the library
Describe the feature as you'd like to see it
Actually, when creating an enum column in a table using a postres connector, a varchar with checks is created. For example:
returns
Postgres doesn't have an ENUM type, but there is way to create ENUM types as can been seen here
Manipulating these enum require their own separate ddl query, and, as the
PostgresPlatform
is only responsible for sql translation and doesn't have any way to look over the actual table, it requires (without significal changes):{table}_{column}_enum
that allows the enums to be retrived without being kept in memoryKeep in mind that this solution is a proposal, and can of couse be implemented in other ways, but in any case, it's a complex addition that requires a good understanding of both masonite-orm and PostgreSQL.
What do we currently have to do now?
Varchar with checks.
Additional context
Here's a quick idea of what the solution I proposed could look like. I don't have neither the time or the experience to work on a clean PR, so I'm leaving this here:
Please note that i'm only using the colmun name to generate the enum names in this example, because the
columnize
method doesn't have a reference to the table (so it'll probably need to be changed too as it could lead to duplicate names).Also, here's a link about a discussion on this issue that occured in the Discord Server.
The text was updated successfully, but these errors were encountered: