Skip to content

Commit f9b1c88

Browse files
committed
fix: add cast_type to Column.new
1 parent b43f379 commit f9b1c88

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/active_record/connection_adapters/cockroachdb/column.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module CockroachDB
2020
class Column < PostgreSQL::Column
2121
# most functions taken from activerecord-postgis-adapter spatial_column
2222
# https://github.com/rgeo/activerecord-postgis-adapter/blob/master/lib/active_record/connection_adapters/postgis/spatial_column.rb
23-
def initialize(name, default, sql_type_metadata = nil, null = true,
23+
def initialize(name, cast_type, default, sql_type_metadata = nil, null = true,
2424
default_function = nil, collation: nil, comment: nil, identity: nil,
2525
serial: nil, spatial: nil, generated: nil, hidden: nil)
2626
@sql_type_metadata = sql_type_metadata
@@ -45,7 +45,7 @@ def initialize(name, default, sql_type_metadata = nil, null = true,
4545
# @geometric_type = geo_type_from_sql_type(sql_type)
4646
build_from_sql_type(sql_type_metadata.sql_type)
4747
end
48-
super(name, default, sql_type_metadata, null, default_function,
48+
super(name, cast_type, default, sql_type_metadata, null, default_function,
4949
collation: collation, comment: comment, serial: serial, generated: generated, identity: identity)
5050
if spatial? && @srid
5151
@limit = { srid: @srid, type: to_type_name(geometric_type) }

lib/active_record/connection_adapters/cockroachdb/schema_statements.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ def new_column_from_field(table_name, field, _definition)
250250

251251
CockroachDB::Column.new(
252252
column_name,
253+
get_oid_type(oid.to_i, fmod.to_i, column_name, type),
253254
default_value,
254255
type_metadata,
255256
!notnull,

0 commit comments

Comments
 (0)