-
Notifications
You must be signed in to change notification settings - Fork 224
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
overload type_to_sql #377
overload type_to_sql #377
Conversation
Hey @Tristramg thanks for submitting this PR. I think it looks good, but we should add a test to make sure. I think we may need to add more types to that array as well in case people make columns as Here's a sample test that we can add to test/ddl_test.rb def test_generated_geometry_column
klass.connection.create_table(:spatial_models, force: true) do |t|
t.st_point :coordinates, limit: { srid: 4326 }
t.virtual :generated_buffer, type: :st_polygon, limit: { srid: 4326 }, as: 'ST_Buffer(coordinates, 10)', stored: true
end
klass.reset_column_information
col = klass.columns.last
assert_equal(:geometry, col.type)
assert(col.virtual?)
end |
Looking into this more, I think we need to modify Looks like adding this col_type = if type.to_sym == :virtual
options[:type]
else
type
end at the beginning of |
Thank you a lot. You basically wrote the whole commit ! Much better in |
Hey @Tristramg thanks for adding that. Can you merge |
This fixes when using generated geometry column from schema.rb The limit parameter was not correctly tranformed from Hash to String ref rgeo#369
Thank you for the reminder. I’ve rebased my fork
…On Wed, 26 Apr 2023 at 16:20, Keith Doggett ***@***.***> wrote:
Hey @Tristramg <https://github.com/Tristramg> thanks for adding that. Can
you merge master into this branch so we can add the changes from this PR
#376 <#376>?
That should fix the failing tests.
—
Reply to this email directly, view it on GitHub
<#377 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAC7S3575LQ7RYT46IR2RLXDEVMTANCNFSM6AAAAAAXG5ABPY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Looks like it's failing with older versions of postgres since it is probably not supported before v12. We can add a skip "Virtual Columns are not supported in this version of PostGIS" unless SpatialModel.connection.supports_virtual_columns? |
Let’s see if this time is the right one. Thank you for you patience and walking me through all this :) |
No problem! Thanks for the contribution! I can get a release out in the next day or 2 with this change. |
This fixes when using generated geometry column from schema.rb
ref #369
type_to_sql
had been removed in https://github.com/rgeo/activerecord-postgis-adapter/pull/360/files#diff-eeeb5e84f6023e4b440660467863dbed44712213c7c65db4e6fe401a3c219b1cL37-L57 as the adapter knows how to handle limits as strings. But in this situation, it is as a hash