Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
annotate
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
annotate
Commits
65af43e6
Commit
65af43e6
authored
Jun 13, 2016
by
Jmarques
Committed by
Cuong Tran
Jun 13, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding hstore to no default column types (#382)
parent
b5a201d9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
annotate_models.rb
lib/annotate/annotate_models.rb
+1
-1
annotate_models_spec.rb
spec/annotate/annotate_models_spec.rb
+4
-2
No files found.
lib/annotate/annotate_models.rb
View file @
65af43e6
...
@@ -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
=
{})
...
...
spec/annotate/annotate_models_spec.rb
View file @
65af43e6
...
@@ -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
)
...
@@ -168,6 +169,7 @@ EOS
...
@@ -168,6 +169,7 @@ EOS
# 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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment