@@ -36,6 +36,10 @@ module AnnotateModels
36
36
using : {
37
37
default : 'USING' ,
38
38
markdown : '_using_'
39
+ } ,
40
+ comment : {
41
+ default : 'COMMENT' ,
42
+ markdown : '_comment_'
39
43
}
40
44
} . freeze
41
45
@@ -295,12 +299,22 @@ def index_using_info(index, format = :default)
295
299
end
296
300
end
297
301
302
+ def index_comment_info ( index , format = :default )
303
+ value = index . try ( :comment ) . try ( :to_s )
304
+ if value . blank?
305
+ ''
306
+ else
307
+ " #{ INDEX_CLAUSES [ :comment ] [ format ] } #{ value } "
308
+ end
309
+ end
310
+
298
311
def final_index_string_in_markdown ( index )
299
312
details = sprintf (
300
- "%s%s%s" ,
313
+ "%s%s%s%s " ,
301
314
index_unique_info ( index , :markdown ) ,
302
315
index_where_info ( index , :markdown ) ,
303
- index_using_info ( index , :markdown )
316
+ index_using_info ( index , :markdown ) ,
317
+ index_comment_info ( index , :markdown )
304
318
) . strip
305
319
details = " (#{ details } )" unless details . blank?
306
320
@@ -314,12 +328,13 @@ def final_index_string_in_markdown(index)
314
328
315
329
def final_index_string ( index , max_size )
316
330
sprintf (
317
- "# %-#{ max_size } .#{ max_size } s %s%s%s%s" ,
331
+ "# %-#{ max_size } .#{ max_size } s %s%s%s%s%s " ,
318
332
index . name ,
319
333
"(#{ index_columns_info ( index ) . join ( ',' ) } )" ,
320
334
index_unique_info ( index ) ,
321
335
index_where_info ( index ) ,
322
- index_using_info ( index )
336
+ index_using_info ( index ) ,
337
+ index_comment_info ( index )
323
338
) . rstrip + "\n "
324
339
end
325
340
0 commit comments