Commit 65af43e6 by Jmarques Committed by Cuong Tran

Adding hstore to no default column types (#382)

parent b5a201d9
...@@ -61,7 +61,7 @@ module AnnotateModels ...@@ -61,7 +61,7 @@ module AnnotateModels
NO_LIMIT_COL_TYPES = %w(integer boolean) NO_LIMIT_COL_TYPES = %w(integer boolean)
# Don't show default value for these column types # Don't show default value for these column types
NO_DEFAULT_COL_TYPES = %w(json jsonb) NO_DEFAULT_COL_TYPES = %w(json jsonb hstore)
class << self class << self
def annotate_pattern(options = {}) def annotate_pattern(options = {})
......
...@@ -153,11 +153,12 @@ EOS ...@@ -153,11 +153,12 @@ EOS
EOS EOS
end end
it "should ignore default value of json columns " do it "should ignore default value of json and hstore columns " do
klass = mock_class(:users, nil, [ klass = mock_class(:users, nil, [
mock_column(:id, :integer), mock_column(:id, :integer),
mock_column(:profile, :json, :default => '{}'), mock_column(:profile, :json, :default => '{}'),
mock_column(:settings, :jsonb, :default => '{}') mock_column(:settings, :jsonb, :default => '{}'),
mock_column(:parameters, :hstore, :default => '{}'),
]) ])
expect(AnnotateModels.get_schema_info(klass, "Schema Info")).to eql(<<-EOS) expect(AnnotateModels.get_schema_info(klass, "Schema Info")).to eql(<<-EOS)
...@@ -165,9 +166,10 @@ EOS ...@@ -165,9 +166,10 @@ EOS
# #
# Table name: users # Table name: users
# #
# id :integer not null # id :integer not null
# profile :json not null # profile :json not null
# settings :jsonb not null # settings :jsonb not null
# parameters :hstore not null
# #
EOS EOS
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment