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
63cc88c1
Commit
63cc88c1
authored
Oct 11, 2017
by
Shinichi Maeshima
Committed by
Cuong Tran
Oct 10, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Annotate bigint columns as 'bigint' instead of 'integer' (#515)
parent
52757575
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
annotate_models.rb
lib/annotate/annotate_models.rb
+9
-1
annotate_models_spec.rb
spec/annotate/annotate_models_spec.rb
+1
-1
No files found.
lib/annotate/annotate_models.rb
View file @
63cc88c1
...
...
@@ -249,7 +249,7 @@ module AnnotateModels
cols
=
cols
.
sort_by
(
&
:name
)
if
options
[
:sort
]
cols
=
classified_sort
(
cols
)
if
options
[
:classified_sort
]
cols
.
each
do
|
col
|
col_type
=
(
col
.
type
||
col
.
sql_type
).
to_s
col_type
=
get_col_type
(
col
)
attrs
=
[]
attrs
<<
"default(
#{
schema_default
(
klass
,
col
)
}
)"
unless
col
.
default
.
nil?
||
hide_default?
(
col_type
,
options
)
attrs
<<
'unsigned'
if
col
.
respond_to?
(
:unsigned?
)
&&
col
.
unsigned?
...
...
@@ -363,6 +363,14 @@ module AnnotateModels
index_info
end
def
get_col_type
(
col
)
if
col
.
respond_to?
(
:bigint?
)
&&
col
.
bigint?
'bigint'
else
(
col
.
type
||
col
.
sql_type
).
to_s
end
end
def
index_columns_info
(
index
)
Array
(
index
.
columns
).
map
do
|
col
|
if
index
.
try
(
:orders
)
&&
index
.
orders
[
col
.
to_s
]
...
...
spec/annotate/annotate_models_spec.rb
View file @
63cc88c1
...
...
@@ -158,7 +158,7 @@ EOS
[
mock_column
(
:id
,
:integer
),
mock_column
(
:integer
,
:integer
,
unsigned?:
true
),
mock_column
(
:bigint
,
:
bigint
,
unsigned
?:
true
),
mock_column
(
:bigint
,
:
integer
,
unsigned?:
true
,
bigint
?:
true
),
mock_column
(
:float
,
:float
,
unsigned?:
true
),
mock_column
(
:decimal
,
:decimal
,
unsigned?:
true
,
precision:
10
,
scale:
2
),
])
...
...
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