@@ -187,15 +187,7 @@ def schema_default(klass, column)
187
187
# the type (and length), and any optional attributes
188
188
def get_schema_info ( klass , header , options = { } )
189
189
info = "# #{ header } \n "
190
- info << "#\n "
191
- if options [ :format_markdown ]
192
- info << "# Table name: `#{ klass . table_name } `\n "
193
- info << "#\n "
194
- info << "# ### Columns\n "
195
- else
196
- info << "# Table name: #{ klass . table_name } \n "
197
- end
198
- info << "#\n "
190
+ info << get_schema_header_text ( klass , options )
199
191
200
192
max_size = klass . column_names . map ( &:size ) . max || 0
201
193
max_size += options [ :format_rdoc ] ? 5 : 1
@@ -220,9 +212,9 @@ def get_schema_info(klass, header, options = {})
220
212
cols = classified_sort ( cols ) if options [ :classified_sort ]
221
213
cols . each do |col |
222
214
col_type = ( col . type || col . sql_type ) . to_s
223
-
224
215
attrs = [ ]
225
216
attrs << "default(#{ schema_default ( klass , col ) } )" unless col . default . nil? || hide_default? ( col_type , options )
217
+ attrs << 'unsigned' if col . respond_to? ( :unsigned? ) && col . unsigned?
226
218
attrs << 'not null' unless col . null
227
219
attrs << 'primary key' if klass . primary_key && ( klass . primary_key . is_a? ( Array ) ? klass . primary_key . collect ( &:to_sym ) . include? ( col . name . to_sym ) : col . name . to_sym == klass . primary_key . to_sym )
228
220
@@ -280,6 +272,23 @@ def get_schema_info(klass, header, options = {})
280
272
info << get_foreign_key_info ( klass , options )
281
273
end
282
274
275
+ info << get_schema_footer_text ( klass , options )
276
+ end
277
+
278
+ def get_schema_header_text ( klass , options = { } )
279
+ info = "#\n "
280
+ if options [ :format_markdown ]
281
+ info << "# Table name: `#{ klass . table_name } `\n "
282
+ info << "#\n "
283
+ info << "# ### Columns\n "
284
+ else
285
+ info << "# Table name: #{ klass . table_name } \n "
286
+ end
287
+ info << "#\n "
288
+ end
289
+
290
+ def get_schema_footer_text ( _klass , options = { } )
291
+ info = ""
283
292
if options [ :format_rdoc ]
284
293
info << "#--\n "
285
294
info << "# #{ END_MARK } \n "
0 commit comments