From 6b0af9e4e0bf4a5a64fe8d4930a4773d83c6e64f Mon Sep 17 00:00:00 2001 From: Tony Drake Date: Fri, 5 Sep 2025 09:04:06 -0400 Subject: [PATCH 1/6] Compatibility with Rails 8.1.beta1 - Handle `cast_type` being the second parameter for `SpatialColumn.initialize`. - Handle nil case during OID initiation. - Handle case where in `spatial_factory` the object could be frozen for whatever reason. - Update CI to test against 8.1 and supported PG and Rubies. --- .github/workflows/tests.yml | 4 ++-- Gemfile | 2 ++ activerecord-postgis-adapter.gemspec | 6 +++--- .../connection_adapters/postgis/oid/spatial.rb | 14 +++++++++++++- .../postgis/schema_statements.rb | 11 ++++++----- .../connection_adapters/postgis/spatial_column.rb | 4 ++-- 6 files changed, 28 insertions(+), 13 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 054b14f1..8ec4b499 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,14 +39,14 @@ jobs: --health-timeout 5s --health-retries 5 env: - AR_VERSION: 8.0.0.1 + AR_VERSION: 8.1.0.rc1 strategy: fail-fast: false matrix: # https://ruby-lang.org/en/downloads/branches ruby: ["3.4", "3.3", "3.2"] # https://www.postgresql.org/support/versioning/ - pg: [12-master, 13-master, 14-master, 15-master, 16-master] + pg: [13-master, 14-master, 15-master, 16-master, 17-master] steps: - name: Set Up Actions uses: actions/checkout@v4 diff --git a/Gemfile b/Gemfile index 5976f205..337f6737 100644 --- a/Gemfile +++ b/Gemfile @@ -6,6 +6,8 @@ gemspec gem "pg", "~> 1.0", platform: :ruby gem "byebug" if ENV["BYEBUG"] +gem "rgeo-activerecord", git: "https://github.com/rgeo/rgeo-activerecord.git" + def activerecord_version return ENV["AR_VERSION"] if ENV["AR_VERSION"] diff --git a/activerecord-postgis-adapter.gemspec b/activerecord-postgis-adapter.gemspec index 53cf6952..9920c5c3 100644 --- a/activerecord-postgis-adapter.gemspec +++ b/activerecord-postgis-adapter.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |spec| spec.summary = "ActiveRecord adapter for PostGIS, based on RGeo." spec.description = "ActiveRecord connection adapter for PostGIS. It is based on the stock " \ - "PostgreSQL adapter, and adds built-in support for the spatial extensions "\ + "PostgreSQL adapter, and adds built-in support for the spatial extensions " \ "provided by PostGIS. It uses the RGeo library to represent spatial data in Ruby." spec.version = ActiveRecord::ConnectionAdapters::PostGIS::VERSION @@ -20,8 +20,8 @@ Gem::Specification.new do |spec| # ruby-lang.org/en/downloads/branches spec.required_ruby_version = ">= 3.2.0" - spec.add_dependency "activerecord", "~> 8.0.0" - spec.add_dependency "rgeo-activerecord", "~> 8.0.0" + spec.add_dependency "activerecord", "~> 8.1.0.rc1" + spec.add_dependency "rgeo-activerecord" spec.add_development_dependency "rake", "~> 13.0" spec.add_development_dependency "minitest", "~> 5.4" diff --git a/lib/active_record/connection_adapters/postgis/oid/spatial.rb b/lib/active_record/connection_adapters/postgis/oid/spatial.rb index 46ed619f..bd272a50 100644 --- a/lib/active_record/connection_adapters/postgis/oid/spatial.rb +++ b/lib/active_record/connection_adapters/postgis/oid/spatial.rb @@ -10,6 +10,7 @@ module OID # Responsible for parsing sql_types returned from the database and WKT features. class Spatial < Type::Value def initialize(geo_type: "geometry", srid: 0, has_z: false, has_m: false, geographic: false) + super() @geo_type = geo_type @srid = srid @has_z = has_z @@ -25,6 +26,11 @@ def initialize(geo_type: "geometry", srid: 0, has_z: false, has_m: false, geogra # has_z: false # has_m: false def self.parse_sql_type(sql_type) + # Could be nil during type registration + if sql_type.nil? + return [nil, 0, false, false, false] + end + geo_type = nil srid = 0 has_z = false @@ -53,10 +59,16 @@ def self.parse_sql_type(sql_type) end def spatial_factory - @spatial_factory ||= + if frozen? RGeo::ActiveRecord::SpatialFactoryStore.instance.factory( factory_attrs ) + else + @spatial_factory ||= + RGeo::ActiveRecord::SpatialFactoryStore.instance.factory( + factory_attrs + ) + end end def spatial? diff --git a/lib/active_record/connection_adapters/postgis/schema_statements.rb b/lib/active_record/connection_adapters/postgis/schema_statements.rb index 62f3f754..f1e02c58 100644 --- a/lib/active_record/connection_adapters/postgis/schema_statements.rb +++ b/lib/active_record/connection_adapters/postgis/schema_statements.rb @@ -12,11 +12,11 @@ def new_column_from_field(table_name, field, _definitions) type_metadata = fetch_type_metadata(column_name, type, oid.to_i, fmod.to_i) default_value = extract_value_from_default(default) - if attgenerated.present? - default_function = default - else - default_function = extract_default_function(default_value, default) - end + default_function = if attgenerated.present? + default + else + extract_default_function(default_value, default) + end if (match = default_function&.match(/\Anextval\('"?(?.+_(?seq\d*))"?'::regclass\)\z/)) serial = sequence_name_from_parts(table_name, column_name, match[:suffix]) == match[:sequence_name] @@ -27,6 +27,7 @@ def new_column_from_field(table_name, field, _definitions) SpatialColumn.new( column_name, + get_oid_type(oid.to_i, fmod.to_i, column_name, type), default_value, type_metadata, !notnull, diff --git a/lib/active_record/connection_adapters/postgis/spatial_column.rb b/lib/active_record/connection_adapters/postgis/spatial_column.rb index 9457e390..ea50d69b 100644 --- a/lib/active_record/connection_adapters/postgis/spatial_column.rb +++ b/lib/active_record/connection_adapters/postgis/spatial_column.rb @@ -7,7 +7,7 @@ class SpatialColumn < ConnectionAdapters::PostgreSQLColumn # :nodoc: # sql_type examples: # "Geometry(Point,4326)" # "Geography(Point,4326)" - def initialize(name, default, sql_type_metadata = nil, null = true, + def initialize(name, cast_type, default, sql_type_metadata = nil, null = true, default_function = nil, collation: nil, comment: nil, serial: nil, generated: nil, spatial: nil, identity: nil) @sql_type_metadata = sql_type_metadata @@ -30,7 +30,7 @@ def initialize(name, default, sql_type_metadata = nil, null = true, # @geometric_type = geo_type_from_sql_type(sql_type) build_from_sql_type(sql_type_metadata.sql_type) end - super(name, default, sql_type_metadata, null, default_function, + super(name, cast_type, default, sql_type_metadata, null, default_function, collation: collation, comment: comment, serial: serial, generated: generated, identity: identity) if spatial? && @srid @limit = { srid: @srid, type: to_type_name(geometric_type) } From 071088994e7c3b671e9e043390603152c1939b9f Mon Sep 17 00:00:00 2001 From: Tony Drake Date: Sat, 18 Oct 2025 17:16:06 -0400 Subject: [PATCH 2/6] Fix backtrace in deprication tests Borrowed from https://github.com/cockroachdb/activerecord-cockroachdb-adapter/commit/e656a24a28b9089e61a6dd14df9d92a13d8e3f20#diff-ce5c7fbac7d9135b5da3cda2f2a9a00e930ce097624d919ef81100dca118e31d --- .../AssociationDeprecationTest/NotifyModeTest.rb | 2 ++ .../RaiseBacktraceModeTest.rb | 2 ++ .../AssociationDeprecationTest/RaiseModeTest.rb | 2 ++ .../WarnBacktraceModeTest.rb | 2 ++ .../AssociationDeprecationTest/WarnModeTest.rb | 2 ++ .../fix_backtrace_cleaner.rb | 10 ++++++++++ 6 files changed, 20 insertions(+) create mode 100644 test/excludes/AssociationDeprecationTest/NotifyModeTest.rb create mode 100644 test/excludes/AssociationDeprecationTest/RaiseBacktraceModeTest.rb create mode 100644 test/excludes/AssociationDeprecationTest/RaiseModeTest.rb create mode 100644 test/excludes/AssociationDeprecationTest/WarnBacktraceModeTest.rb create mode 100644 test/excludes/AssociationDeprecationTest/WarnModeTest.rb create mode 100644 test/excludes/AssociationDeprecationTest/fix_backtrace_cleaner.rb diff --git a/test/excludes/AssociationDeprecationTest/NotifyModeTest.rb b/test/excludes/AssociationDeprecationTest/NotifyModeTest.rb new file mode 100644 index 00000000..ed1f6040 --- /dev/null +++ b/test/excludes/AssociationDeprecationTest/NotifyModeTest.rb @@ -0,0 +1,2 @@ +require_relative "fix_backtrace_cleaner" +include(FixBacktraceCleaner) diff --git a/test/excludes/AssociationDeprecationTest/RaiseBacktraceModeTest.rb b/test/excludes/AssociationDeprecationTest/RaiseBacktraceModeTest.rb new file mode 100644 index 00000000..ed1f6040 --- /dev/null +++ b/test/excludes/AssociationDeprecationTest/RaiseBacktraceModeTest.rb @@ -0,0 +1,2 @@ +require_relative "fix_backtrace_cleaner" +include(FixBacktraceCleaner) diff --git a/test/excludes/AssociationDeprecationTest/RaiseModeTest.rb b/test/excludes/AssociationDeprecationTest/RaiseModeTest.rb new file mode 100644 index 00000000..ed1f6040 --- /dev/null +++ b/test/excludes/AssociationDeprecationTest/RaiseModeTest.rb @@ -0,0 +1,2 @@ +require_relative "fix_backtrace_cleaner" +include(FixBacktraceCleaner) diff --git a/test/excludes/AssociationDeprecationTest/WarnBacktraceModeTest.rb b/test/excludes/AssociationDeprecationTest/WarnBacktraceModeTest.rb new file mode 100644 index 00000000..ed1f6040 --- /dev/null +++ b/test/excludes/AssociationDeprecationTest/WarnBacktraceModeTest.rb @@ -0,0 +1,2 @@ +require_relative "fix_backtrace_cleaner" +include(FixBacktraceCleaner) diff --git a/test/excludes/AssociationDeprecationTest/WarnModeTest.rb b/test/excludes/AssociationDeprecationTest/WarnModeTest.rb new file mode 100644 index 00000000..ed1f6040 --- /dev/null +++ b/test/excludes/AssociationDeprecationTest/WarnModeTest.rb @@ -0,0 +1,2 @@ +require_relative "fix_backtrace_cleaner" +include(FixBacktraceCleaner) diff --git a/test/excludes/AssociationDeprecationTest/fix_backtrace_cleaner.rb b/test/excludes/AssociationDeprecationTest/fix_backtrace_cleaner.rb new file mode 100644 index 00000000..9ed08029 --- /dev/null +++ b/test/excludes/AssociationDeprecationTest/fix_backtrace_cleaner.rb @@ -0,0 +1,10 @@ +module FixBacktraceCleaner + def setup + super + bc = ActiveSupport::BacktraceCleaner.new + bc.remove_silencers! + bc.remove_filters! + bc.add_silencer { !_1.include?(::AssociationDeprecationTest::TestCase::THIS_FILE) } + ActiveRecord::LogSubscriber.backtrace_cleaner = bc + end +end From b0041ea51c51c36216c076146d5cb876a9375cf1 Mon Sep 17 00:00:00 2001 From: Tony Drake Date: Sat, 18 Oct 2025 18:25:25 -0400 Subject: [PATCH 3/6] Remove pointless frozen check logic --- .../connection_adapters/postgis/oid/spatial.rb | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/lib/active_record/connection_adapters/postgis/oid/spatial.rb b/lib/active_record/connection_adapters/postgis/oid/spatial.rb index bd272a50..135dd291 100644 --- a/lib/active_record/connection_adapters/postgis/oid/spatial.rb +++ b/lib/active_record/connection_adapters/postgis/oid/spatial.rb @@ -59,16 +59,9 @@ def self.parse_sql_type(sql_type) end def spatial_factory - if frozen? - RGeo::ActiveRecord::SpatialFactoryStore.instance.factory( - factory_attrs - ) - else - @spatial_factory ||= - RGeo::ActiveRecord::SpatialFactoryStore.instance.factory( - factory_attrs - ) - end + RGeo::ActiveRecord::SpatialFactoryStore.instance.factory( + factory_attrs + ) end def spatial? From 4a4faf56967250d87cd3ca8606b9c84030a2e428 Mon Sep 17 00:00:00 2001 From: Tony Drake Date: Wed, 22 Oct 2025 14:19:16 -0400 Subject: [PATCH 4/6] Update gemspec for Rails 8.1.0 final --- .github/workflows/tests.yml | 2 +- CONTRIBUTING.md | 4 ++-- activerecord-postgis-adapter.gemspec | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8ec4b499..a3d7431a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,7 +39,7 @@ jobs: --health-timeout 5s --health-retries 5 env: - AR_VERSION: 8.1.0.rc1 + AR_VERSION: 8.1.0 strategy: fail-fast: false matrix: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5b6ff06d..a150be69 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -40,8 +40,8 @@ Make sure the tests pass: Run tests with a specific ActiveRecord version: ```sh -AR_VERSION=7.0.1 bundle install -AR_VERSION=7.0.1 bundle exec rake test +AR_VERSION=8.1.0 bundle install +AR_VERSION=8.1.0 bundle exec rake test ``` To run a specific test, use the `POSTGIS_TEST_FILES` environment variable: diff --git a/activerecord-postgis-adapter.gemspec b/activerecord-postgis-adapter.gemspec index 9920c5c3..7f83e830 100644 --- a/activerecord-postgis-adapter.gemspec +++ b/activerecord-postgis-adapter.gemspec @@ -20,7 +20,7 @@ Gem::Specification.new do |spec| # ruby-lang.org/en/downloads/branches spec.required_ruby_version = ">= 3.2.0" - spec.add_dependency "activerecord", "~> 8.1.0.rc1" + spec.add_dependency "activerecord", "~> 8.1.0" spec.add_dependency "rgeo-activerecord" spec.add_development_dependency "rake", "~> 13.0" From 365c2ff0c9886fc2402a5020d3a546de1b90672e Mon Sep 17 00:00:00 2001 From: Tony Drake Date: Fri, 21 Nov 2025 14:30:28 -0500 Subject: [PATCH 5/6] Apply BuonOmo's patch 1 --- .github/workflows/tests.yml | 4 +- Gemfile | 2 - activerecord-postgis-adapter.gemspec | 2 +- .../postgis/{spatial_column.rb => column.rb} | 50 +++++++++++++++++-- .../postgis/oid/spatial.rb | 40 +++++++-------- .../connection_adapters/postgis/quoting.rb | 15 ++++++ .../postgis/schema_statements.rb | 2 +- .../connection_adapters/postgis_adapter.rb | 9 ++-- 8 files changed, 88 insertions(+), 36 deletions(-) rename lib/active_record/connection_adapters/postgis/{spatial_column.rb => column.rb} (71%) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a3d7431a..fa03d102 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,14 +39,14 @@ jobs: --health-timeout 5s --health-retries 5 env: - AR_VERSION: 8.1.0 + AR_VERSION: 8.1.1 strategy: fail-fast: false matrix: # https://ruby-lang.org/en/downloads/branches ruby: ["3.4", "3.3", "3.2"] # https://www.postgresql.org/support/versioning/ - pg: [13-master, 14-master, 15-master, 16-master, 17-master] + pg: [14-master, 15-master, 16-master, 17-master, 18-master] steps: - name: Set Up Actions uses: actions/checkout@v4 diff --git a/Gemfile b/Gemfile index 337f6737..5976f205 100644 --- a/Gemfile +++ b/Gemfile @@ -6,8 +6,6 @@ gemspec gem "pg", "~> 1.0", platform: :ruby gem "byebug" if ENV["BYEBUG"] -gem "rgeo-activerecord", git: "https://github.com/rgeo/rgeo-activerecord.git" - def activerecord_version return ENV["AR_VERSION"] if ENV["AR_VERSION"] diff --git a/activerecord-postgis-adapter.gemspec b/activerecord-postgis-adapter.gemspec index 7f83e830..6174e12f 100644 --- a/activerecord-postgis-adapter.gemspec +++ b/activerecord-postgis-adapter.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |spec| spec.required_ruby_version = ">= 3.2.0" spec.add_dependency "activerecord", "~> 8.1.0" - spec.add_dependency "rgeo-activerecord" + spec.add_dependency "rgeo-activerecord", "~> 8.1.0" spec.add_development_dependency "rake", "~> 13.0" spec.add_development_dependency "minitest", "~> 5.4" diff --git a/lib/active_record/connection_adapters/postgis/spatial_column.rb b/lib/active_record/connection_adapters/postgis/column.rb similarity index 71% rename from lib/active_record/connection_adapters/postgis/spatial_column.rb rename to lib/active_record/connection_adapters/postgis/column.rb index ea50d69b..bb4d64d0 100644 --- a/lib/active_record/connection_adapters/postgis/spatial_column.rb +++ b/lib/active_record/connection_adapters/postgis/column.rb @@ -3,14 +3,15 @@ module ActiveRecord # :nodoc: module ConnectionAdapters # :nodoc: module PostGIS # :nodoc: - class SpatialColumn < ConnectionAdapters::PostgreSQLColumn # :nodoc: + class Column < PostgreSQL::Column # :nodoc: # sql_type examples: # "Geometry(Point,4326)" # "Geography(Point,4326)" def initialize(name, cast_type, default, sql_type_metadata = nil, null = true, default_function = nil, collation: nil, comment: nil, serial: nil, generated: nil, spatial: nil, identity: nil) - @sql_type_metadata = sql_type_metadata + super(name, cast_type, default, sql_type_metadata, null, default_function, + collation: collation, comment: comment, serial: serial, generated: generated, identity: identity) @geographic = !!(sql_type_metadata.sql_type =~ /geography\(/i) if spatial # This case comes from an entry in the geometry_columns table @@ -30,8 +31,6 @@ def initialize(name, cast_type, default, sql_type_metadata = nil, null = true, # @geometric_type = geo_type_from_sql_type(sql_type) build_from_sql_type(sql_type_metadata.sql_type) end - super(name, cast_type, default, sql_type_metadata, null, default_function, - collation: collation, comment: comment, serial: serial, generated: generated, identity: identity) if spatial? && @srid @limit = { srid: @srid, type: to_type_name(geometric_type) } @limit[:has_z] = true if @has_z @@ -58,6 +57,49 @@ def spatial? %i[geometry geography].include?(@sql_type_metadata.type) end + def init_with(coder) + @geographic = coder["geographic"] + @geometric_type = coder["geometric_type"] + @has_m = coder["has_m"] + @has_z = coder["has_z"] + @srid = coder["srid"] + @limit = coder["limit"] + super + end + + def encode_with(coder) + coder["geographic"] = @geographic + coder["geometric_type"] = @geometric_type + coder["has_m"] = @has_m + coder["has_z"] = @has_z + coder["srid"] = @srid + coder["limit"] = @limit + super + end + + def ==(other) + other.is_a?(Column) && + super && + other.geographic == geographic && + other.geometric_type == geometric_type && + other.has_m == has_m && + other.has_z == has_z && + other.srid == srid && + other.limit == limit + end + alias :eql? :== + + def hash + Column.hash ^ + super.hash ^ + geographic.hash ^ + geometric_type.hash ^ + has_m.hash ^ + has_z.hash ^ + srid.hash ^ + limit.hash + end + private def set_geometric_type_from_name(name) diff --git a/lib/active_record/connection_adapters/postgis/oid/spatial.rb b/lib/active_record/connection_adapters/postgis/oid/spatial.rb index 135dd291..d44c933b 100644 --- a/lib/active_record/connection_adapters/postgis/oid/spatial.rb +++ b/lib/active_record/connection_adapters/postgis/oid/spatial.rb @@ -11,12 +11,16 @@ module OID class Spatial < Type::Value def initialize(geo_type: "geometry", srid: 0, has_z: false, has_m: false, geographic: false) super() - @geo_type = geo_type - @srid = srid - @has_z = has_z - @has_m = has_m - @geographic = geographic + @geographic = geographic.freeze + @factory_attrs = { + geo_type: geo_type.underscore.freeze, + has_m: has_m.freeze, + has_z: has_z.freeze, + srid: srid.freeze, + sql_type: type.to_s.freeze + }.freeze end + protected attr_reader :geographic, :factory_attrs # sql_type: geometry, geometry(Point), geometry(Point,4326), ... # @@ -26,11 +30,6 @@ def initialize(geo_type: "geometry", srid: 0, has_z: false, has_m: false, geogra # has_z: false # has_m: false def self.parse_sql_type(sql_type) - # Could be nil during type registration - if sql_type.nil? - return [nil, 0, false, false, false] - end - geo_type = nil srid = 0 has_z = false @@ -85,6 +84,17 @@ def serialize(value) .generate(geo_value) end + def ==(other) + super && + @geographic == other.geographic && + @factory_attrs == other.factory_attrs + end + alias eql? == + + def hash + super ^ [@geographic, @factory_attrs].hash + end + private def cast_value(value) @@ -110,16 +120,6 @@ def wkt_parser(string) RGeo::WKRep::WKTParser.new(spatial_factory, support_ewkt: true, default_srid: @srid) end end - - def factory_attrs - { - geo_type: @geo_type.underscore, - has_m: @has_m, - has_z: @has_z, - srid: @srid, - sql_type: type.to_s - } - end end end end diff --git a/lib/active_record/connection_adapters/postgis/quoting.rb b/lib/active_record/connection_adapters/postgis/quoting.rb index 1d7c8b98..87b1d5c3 100644 --- a/lib/active_record/connection_adapters/postgis/quoting.rb +++ b/lib/active_record/connection_adapters/postgis/quoting.rb @@ -12,6 +12,21 @@ def type_cast(value) super end end + + # NOTE: This method should be private in future rails versions. + # Hence we should also make it private then. + # + # See https://github.com/rails/rails/blob/v8.1.1/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb#L190 + def lookup_cast_type(sql_type) + type_map.lookup( + # oid + query_value("SELECT #{quote(sql_type)}::regtype::oid", "SCHEMA").to_i, + # fmod, not needed. + nil, + # details needed for `..::PostGIS::OID::Spatial` (e.g. `geometry(point,3857)`) + sql_type + ) + end end end end diff --git a/lib/active_record/connection_adapters/postgis/schema_statements.rb b/lib/active_record/connection_adapters/postgis/schema_statements.rb index f1e02c58..6a021797 100644 --- a/lib/active_record/connection_adapters/postgis/schema_statements.rb +++ b/lib/active_record/connection_adapters/postgis/schema_statements.rb @@ -25,7 +25,7 @@ def new_column_from_field(table_name, field, _definitions) # {:dimension=>2, :has_m=>false, :has_z=>false, :name=>"latlon", :srid=>0, :type=>"GEOMETRY"} spatial = spatial_column_info(table_name).get(column_name, type_metadata.sql_type) - SpatialColumn.new( + Column.new( column_name, get_oid_type(oid.to_i, fmod.to_i, column_name, type), default_value, diff --git a/lib/active_record/connection_adapters/postgis_adapter.rb b/lib/active_record/connection_adapters/postgis_adapter.rb index 1a823e6e..1a749e4b 100644 --- a/lib/active_record/connection_adapters/postgis_adapter.rb +++ b/lib/active_record/connection_adapters/postgis_adapter.rb @@ -12,7 +12,7 @@ require_relative "postgis/database_statements" require_relative "postgis/spatial_column_info" require_relative "postgis/spatial_table_definition" -require_relative "postgis/spatial_column" +require_relative "postgis/column" require_relative "postgis/arel_tosql" require_relative "postgis/oid/spatial" require_relative "postgis/oid/date_time" @@ -84,7 +84,7 @@ def initialize_type_map(map = type_map) # "geometry(Polygon,4326) NOT NULL" # "geometry(Geography,4326)" geo_type, srid, has_z, has_m, geographic = PostGIS::OID::Spatial.parse_sql_type(sql_type) - PostGIS::OID::Spatial.new(geo_type: geo_type, srid: srid, has_z: has_z, has_m: has_m, geographic: geographic) + PostGIS::OID::Spatial.new(geo_type: geo_type, srid: srid, has_z: has_z, has_m: has_m, geographic: geographic).freeze end end @@ -92,9 +92,7 @@ def initialize_type_map(map = type_map) end def native_database_types - @native_database_types ||= begin - default_types = PostgreSQLAdapter.native_database_types - default_types.merge({ + @native_database_types ||= super.merge({ geography: { name: "geography" }, geometry: { name: "geometry" }, geometry_collection: { name: "geometry_collection" }, @@ -106,7 +104,6 @@ def native_database_types st_point: { name: "st_point" }, st_polygon: { name: "st_polygon" } }) - end end end From de40243abe5f3a10bf637914c382097c9cfdaaf2 Mon Sep 17 00:00:00 2001 From: Tony Drake Date: Fri, 21 Nov 2025 15:12:39 -0500 Subject: [PATCH 6/6] Update tests.yml --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index fa03d102..b5c97c00 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -46,7 +46,7 @@ jobs: # https://ruby-lang.org/en/downloads/branches ruby: ["3.4", "3.3", "3.2"] # https://www.postgresql.org/support/versioning/ - pg: [14-master, 15-master, 16-master, 17-master, 18-master] + pg: [14-master, 15-master, 16-master, 17-master, 18-3.6-alpine] steps: - name: Set Up Actions uses: actions/checkout@v4