Skip to content

Commit 65af43e

Browse files
Jmarquesctran
authored andcommitted
Adding hstore to no default column types (#382)
1 parent b5a201d commit 65af43e

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

lib/annotate/annotate_models.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ module AnnotateModels
6161
NO_LIMIT_COL_TYPES = %w(integer boolean)
6262

6363
# Don't show default value for these column types
64-
NO_DEFAULT_COL_TYPES = %w(json jsonb)
64+
NO_DEFAULT_COL_TYPES = %w(json jsonb hstore)
6565

6666
class << self
6767
def annotate_pattern(options = {})

spec/annotate/annotate_models_spec.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,21 +153,23 @@ def mock_column(name, type, options={})
153153
EOS
154154
end
155155

156-
it "should ignore default value of json columns " do
156+
it "should ignore default value of json and hstore columns " do
157157
klass = mock_class(:users, nil, [
158158
mock_column(:id, :integer),
159-
mock_column(:profile, :json, :default => '{}'),
160-
mock_column(:settings, :jsonb, :default => '{}')
159+
mock_column(:profile, :json, :default => '{}'),
160+
mock_column(:settings, :jsonb, :default => '{}'),
161+
mock_column(:parameters, :hstore, :default => '{}'),
161162
])
162163

163164
expect(AnnotateModels.get_schema_info(klass, "Schema Info")).to eql(<<-EOS)
164165
# Schema Info
165166
#
166167
# Table name: users
167168
#
168-
# id :integer not null
169-
# profile :json not null
170-
# settings :jsonb not null
169+
# id :integer not null
170+
# profile :json not null
171+
# settings :jsonb not null
172+
# parameters :hstore not null
171173
#
172174
EOS
173175
end

0 commit comments

Comments
 (0)