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
Add support for MySQL unsigned integer and float columns #375
Conversation
…ported type under MySQL, with tests
Thanks Jason, would you mind looking at the test failures against 2.3 and 3.0 ? If not I will but it will take a while ... |
Part of the problem is almost certainly that the TableDefinition isn't being found in the 2.3/3.0 case. I struggled with that part even in the 4.0 case before I tried to parrot what I saw in |
I'm more than fine with disabling the tests on <=3.0 just use the TestCase helper and only run it if ar_version('3.1') ... |
... and if the unsigned types are only in AR 4.0 native types should only be updated for that AR version (see postgres) |
3.0 and 2.3 don't seem to acknowledge the TableDefinition; adjust test expectations accordingly, omitting tests that are not applicable based on ar_version
@kares This now run cleans for me locally on 2.3 through 4.0 |
Thanks Jason, consider this merged than - might take a bit cause I'm currently stack locally with some code ... |
Thank you, @kares - I appreciate your quick responses and assistance in getting this ready for acceptance |
Travis seems stuck. It has had 1 pending test for 23 hours.... |
How does one restart a test that has been stuck in 'pending' for a day? |
I'm not really sure, anyways it somehow ended green :) I just realized this is smt not supported by Rails, or am I wrong (I really thought they do) ? |
If you dump an existing schema that contains an unsigned integer column, pattern matching for /integer/ will result in the schema.rb expressing the column as a normal, signed integer, so subsequent recreations of the schema (like db:test:load) will make an signed integer column. If you generated schema.rb with this patch included, but then tried to load that schema.rb under MRI, yes, I think it would break, unless I were to go make a parallel patch for them as well. How likely is that use case? What I would have loved to do would be to add support for a new hash key |
I see, that |
I can see how I could modify type_to_sql easily enough to do the right thing when I'm open to any thoughts you have on how to make this behavior conditional for those that want it. |
I see, thanks for looking into it and explaining Jason ... will sure look at it - if we can't do it easily as you mentioned than your approach is probably for the best, I'll just add some helper code to turn it on while being off by default above it. |
Anything I can do to restart the momentum to get this accepted, @kares? |
I'm sorry Jason, I was stuck with other mostly 'native' compatibility issues - somehow this is lower priority since it's some "new" feature ... I'll try to squeeze some time (I really wanted to look into related AR internals) but I'm not yet sure when. |
It really is an "option" of INT/FLOAT numeric type to be unsigned ... thus acting as a "new" type is not really ideal. |
Yeah I need a solution that works on 3.2.x. If you want to see a patch of SchemaDumper#table to support a new option I'm willing to provide it, but I as I said before, it doesn't seem DRY enough for serious consideration. |
Here's how I'm thinking: In my opinion this really seems like a discussion for (core) AR - I do not mind adding it here but since it requires quite a lot of hacks it's probably best to be avoided or added directly where the code to be "hacked" is from a.k.a. Rails master :) If you still feel that you want it in AR-JDBC adding this as an optional feature - since it will require quite some monkey-patching e.g. in a separate unit arjdbc/mysql/unsigned_types.rb should be considered ... Hope my concerns are understandable, I really appreciate your attempt to contribute but I'm not sure it's the right place, now that I have look at this a bit more. |
I'm closing this PR for now there's a more general feature #423 to add (optional) column options. |
Intended to resolve #373