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

Update for Rails 5 #44

Merged
merged 5 commits into from
Nov 16, 2016
Merged

Update for Rails 5 #44

merged 5 commits into from
Nov 16, 2016

Conversation

plicjo
Copy link
Contributor

@plicjo plicjo commented Nov 13, 2016

This PR has all of the schema_validations tests passing for Rails 5 and Rails 4.2.

Cheers!

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.005%) to 99.259% when pulling edb5a63 on plicjo:postgres_upgrade_to_rails_5 into b3e8be2 on SchemaPlus:master.

@plicjo plicjo mentioned this pull request Nov 13, 2016
@coveralls
Copy link

Coverage Status

Coverage increased (+0.7%) to 100.0% when pulling 3925aa9 on plicjo:postgres_upgrade_to_rails_5 into b3e8be2 on SchemaPlus:master.

@plicjo plicjo changed the title Update for Rails 5 on postgresql Update for Rails 5 on postgresql and sqlite3 Nov 13, 2016
@coveralls
Copy link

Coverage Status

Coverage increased (+0.7%) to 100.0% when pulling 283cc7c on plicjo:postgres_upgrade_to_rails_5 into b3e8be2 on SchemaPlus:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.7%) to 100.0% when pulling 283cc7c on plicjo:postgres_upgrade_to_rails_5 into b3e8be2 on SchemaPlus:master.

@coveralls
Copy link

coveralls commented Nov 13, 2016

Coverage Status

Coverage increased (+0.7%) to 100.0% when pulling b615555 on plicjo:postgres_upgrade_to_rails_5 into b3e8be2 on SchemaPlus:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.7%) to 100.0% when pulling b615555 on plicjo:postgres_upgrade_to_rails_5 into b3e8be2 on SchemaPlus:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.7%) to 100.0% when pulling b615555 on plicjo:postgres_upgrade_to_rails_5 into b3e8be2 on SchemaPlus:master.

@plicjo plicjo changed the title Update for Rails 5 on postgresql and sqlite3 Update for Rails 5 Nov 13, 2016
@coveralls
Copy link

coveralls commented Nov 13, 2016

Coverage Status

Coverage increased (+0.7%) to 100.0% when pulling 8537632 on plicjo:postgres_upgrade_to_rails_5 into b3e8be2 on SchemaPlus:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.7%) to 100.0% when pulling 8537632 on plicjo:postgres_upgrade_to_rails_5 into b3e8be2 on SchemaPlus:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.7%) to 100.0% when pulling 8537632 on plicjo:postgres_upgrade_to_rails_5 into b3e8be2 on SchemaPlus:master.

@boazy
Copy link
Member

boazy commented Nov 13, 2016

@plicjo Great job with the pull request. I've also started working on adapting schema_validations, but you obviously beat me to it. :)

I'm now reviewing it, but as far as tests and coverage go it looks ready.
Besides that, the main issue I see right now, is that the detected types don't necessarily match the ActiveModel types mapped to the database. Changes in Rails 5 mean we cannot call #number? on types, and we don't get the casted type directly so we could call #number? or #range? on.

In the second case, I haven't seen any example of rails using anything besides an integer range, so that might be just fine.
With numeric types things are more complicated, since Postgres has the Money type, for instance, and it looks like it won't be detected as numeric. Then again, the old code might have been wrong too, since it detected Money as numeric, but not as decimal.

I have a workaround ready from my own attempts that allows us to check for #numeric? in a compatible way, but I'm not sure if it actually solves the issue. Perhaps we should just add explicit mappings for types like :money instead.

@ronen Thoughts?

@plicjo
Copy link
Contributor Author

plicjo commented Nov 15, 2016

@boazy Thank you! If you give me a list of the missing, unsupported types, I can take care of it.

I took a look at the Rails source code, and I also came to the conclusion that the #range check appears to only be concerned with integers.

@boazy
Copy link
Member

boazy commented Nov 16, 2016

With the current version of Rails it seems that the only missing type is :money from PostgreSQL which should be mapped to Decimal. I'm more concerned about future types but this particular part of Rails seems prone to breaking changes no matter which implementation we choose.

@ronen
Copy link
Member

ronen commented Nov 16, 2016

Thanks @plicjo for taking this on! And thanks @boazy for looking into it.

I'd say if the tests pass, we're OK to release. Support for other types and whatnot can always be added in future releases. Do you agree?

@boazy
Copy link
Member

boazy commented Nov 16, 2016

I agree, if we convert money to decimal of course. That alone is a regression, although the currwnt behavior ia not fully correct either. This is jus one line.

@ronen
Copy link
Member

ronen commented Nov 16, 2016

Yeah, certainly may as well fix that. Since the current behavior for money is broken, instead of considering it a regression, should we consider it to be a bug fix? And so this would be a patch release rather than major?

@boazy
Copy link
Member

boazy commented Nov 16, 2016

Let's merge and then apply the bugfix then.

@plicjo
Copy link
Contributor Author

plicjo commented Nov 16, 2016

I opened an issue for adding support for the Postgres :money column type. #45

@boazy boazy merged commit a8215d9 into SchemaPlus:master Nov 16, 2016
@boazy
Copy link
Member

boazy commented Nov 16, 2016

Thanks @plicjo. I've merged your pull request and I'll try to fix that issue today.

@boazy
Copy link
Member

boazy commented Nov 16, 2016

@ronen Can you please release a new version?

@ronen
Copy link
Member

ronen commented Nov 25, 2016

Sorry, I got confused and thought I was waiting for another fix from you. Just realized now it's all set (when #47 came in).

Released 2.2.0

@boazy
Copy link
Member

boazy commented Nov 27, 2016

Thanks @ronen! I'll test the new schema_validations today in a live project ;)
Doy we have any major modules left without Rails 5 support now besides schema_plus_views?

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

Successfully merging this pull request may close these issues.

4 participants