Can't create a multi_polygon column type it's always polygon

#425 · closed · 2 comments

View on GitHub ↗

nbarrera

Tried several migrations and I am also trying to avoid raw sql after running the migration I always got a `geometry(Polygon)` at the rails console: ``` $> rails c > Parcel.columns_hash['boundary'].sql_type => "geometry(Polygon)" ``` The column ddl is `boundary geometry(Polygon)` My code only works if I manually alter the column using sql to be `geometry(MultiPolygon)` I 'm using: * rails 8 * ActiveRecord::Migration[8.0] * activerecord-postgis-adapter 11 * rgeo 3.0.1 Here are some of the migrations iI 've tried: ```ruby t.geometry :boundary, limit: {srid: 4326, type: :multi_polygon} ``` ```ruby t.geometry_collection :boundary, limit: {srid: 4326, type: :multi_polygon} ``` ```ruby t.geometry :boundary, limit: {srid: 4326, type: :multi_polygon} ``` ```ruby add_column :parcels, :elboundary, limit: {srid: 4326, type: "multi_polygon"} ``` ```ruby add_column :parcels, :boundary, :geometry, spatial_type: :multi_polygon, srid: 4326, has_z: false, geographic: true ``` thanks for reading!

Comments

BuonOmo

Hey @nbarrera Thank you for opening that issue. Could you generate a full script that reproduces the error, using one of rails templates https://github.com/rails/rails/tree/main/guides/bug_report_templates (either active_record.rb or active_record_migration.rb)? That would help us a lot!

nbarrera

Hey @BuonOmo while trying to use the script to reproduce I realized that it was some problem on my side regarding my migrations not being rerun when I was testing. I 'm really sorry for wasting your time, thanks for your help 🙇 closing this issue