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
adding TYPE_ENUM to Phalcon\Db\Column #11368
Conversation
Hi @mattvb91 In my opinion this PR this is not completed. We have to support that type virtually for the other database engines supported. |
@sergeyklay do you mean just defaulting it to something like varchar for all the other adapters? |
As I said above we have to support that type for the other database. For example we can transparent convert from Myslq's enum to Postgres' varchar. I'm not saying what you need to do exactly. I only express my opinion. Perhaps you'll propose a better idea |
@sergeyklay all the adapters default to either varchar or text if a column type isn't supported which in this case would still be ok as the result would still allow insertion of the data into the column. |
And back? |
Im not sure if im missing something in your question but if porting data back INTO mysql from a data source not supporting enum it would also default the column to varchar. |
Please consider merging this pull request to 2.x. We're waiting for enums since 2014 |
@mattvb91 Could you please rebase? |
if preg_match(sizePattern, columnType, matches) { | ||
|
||
if definition["type"] == Column::TYPE_ENUM { | ||
let definition["size"] = substr(columnType, 5, -1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mattvb91 Could you please explain this a bit more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sergeyklay this is where we were trying to use a regex but its easier to simply get the contents out of enum(CONTENTS) by doing a substr select.
So essentially if you have ENUM('val1', 'val2', 'val3') then definition["size"] = "'val1', 'val2', 'val3'"
Does that make more sense?
Any news regarding this topic? |
@dcosta-ptc Will be part of 3.1.x |
I need to find some time to configure zephir and learn how to test/contribute. Looks like I'll need to speed up needed features development myself because waiting more than half a year to get a simple feature or fix is a bit too long. |
@Dublerq sounds fine! |
4d3c73f
to
6ef079c
Compare
And what now with ENUM ? I use Phalcon 3.1.2 and have problems with ENUM migrations. |
@sergeyklay @dcosta-ptc @Dublerq sorry guys im not sure why im only now receiving notifications about this... I've rebased the branch and repushed. Looks like your builds are failing? Surprised this hadn't been merged 2 years ago as its a pretty minor change from code side. |
@mattvb91 I'll take a look a bit later. Thank you for contributing. |
3.2.1 and problems too. Any plan when it could be? |
4.0.0 according to Sergey... Not usable without ENUM type for me... sadly... Migrations are pretty rough atm... |
Hoping that this and some other types like TIME will get in at 4.0 |
@mattvb91 Could you be so kind as to resolve the conflict with the changelog and have a look at the tests? It appears there is a syntax error somewhere. After that I can merge this. I will need to add more tests on this one |
Thank you! |
PR to devtools will follow