Skip to content

Commit

Permalink
Support Bit and BitVarying
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-tan committed Sep 26, 2024
1 parent 88dd78e commit a51fcbd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/tapioca/dsl/helpers/active_record_column_type_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,16 @@ def type_for_activerecord_value(column_type, column_nullability:)
ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Array === type
}
"T::Array[#{type_for_activerecord_value(column_type.subtype, column_nullability:)}]"
when ->(type) {
defined?(ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Bit) &&
ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Bit === type
}
"::String"
when ->(type) {
defined?(ActiveRecord::ConnectionAdapters::PostgreSQL::OID::BitVarying) &&
ActiveRecord::ConnectionAdapters::PostgreSQL::OID::BitVarying === type
}
"::String"
when ->(type) {
defined?(ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Range) &&
ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Range === type
Expand Down
2 changes: 2 additions & 0 deletions sorbet/rbi/shims/activerecord_postgresql.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Hstore; end
module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Cidr; end
module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Interval; end
module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Range; end
module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Bit; end
module ActiveRecord::ConnectionAdapters::PostgreSQL::OID::BitVarying; end

0 comments on commit a51fcbd

Please sign in to comment.