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 macaddr, inet, and cidr types to PostgreSQL adapter #6192
Add support for macaddr, inet, and cidr types to PostgreSQL adapter #6192
Conversation
@@ -24,4 +24,5 @@ Gem::Specification.new do |s| | |||
s.add_dependency('arel', '~> 3.0.2') | |||
|
|||
s.add_dependency('active_record_deprecated_finders', '0.0.1') | |||
s.add_dependency('netaddr', '~> 1.5.0') |
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.
I think that we should not add netaddr
gem as Active Record dependency because we will only use it with PostgreSQL.
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.
This is the one issue I thought the pull request would definitely have. I was unsure of how to make netaddr a PostgreSQL only dependency
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.
I am going to update this so that it will try to use NetAddr if the user has included it, if not, it will fall back to IPAddr.
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.
I'll fix it. We should just do a gem netaddr
in the pg adapter code.
I have updated my implementation to remove NetAddr completely, after discovering how to extract the subnet mask from IPAddr |
ping @tenderlove |
The tests all pass. I'm not familiar with the adapters, but am wondering if there is a way to push the Gemfile requirements onto the Postgres adapter gem (I'm assuming there's such a thing as Postgres adapter gem). @tenderlove can you review? |
@danmcclain looks great now. @jeremyf the only way to push requirements to the PostgreSQL adapter is adding as requirement of the |
this looks pretty good, 👍 on merge |
…ostgresql_adapter Add support for macaddr, inet, and cidr types to PostgreSQL adapter
Adds migration and schema dump support for macaddr, inet and cidr column types in the PostgreSQL adapter.
Converst inet and cidr types to NetAddr::CIDR objects, instead of using IPAddr, since NetAddr::CIDR handles subnets better.