aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activerecord/lib/active_record/schema_dumper.rb17
1 files changed, 2 insertions, 15 deletions
diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb
index b65d5b56f1..ab2d64e903 100644
--- a/activerecord/lib/active_record/schema_dumper.rb
+++ b/activerecord/lib/active_record/schema_dumper.rb
@@ -145,22 +145,9 @@ HEADER
# find all migration keys used in this table
keys = @connection.migration_keys
- # figure out the lengths for each column based on above keys
- lengths = [0] * keys.length
-
- # the string we're going to sprintf our values against, with standardized column widths
- format_string = ["%s"] * keys.length
-
- # add column type definition to our format string
- format_string.unshift " t.%s "
-
- format_string *= ""
-
column_specs.each do |colspec|
- values = keys.zip(lengths).map { |key, len| colspec.key?(key) ? colspec[key] + ", " : " " * len }
- values.unshift colspec[:type]
- tbl.print((format_string % values).gsub(/,\s*$/, ""))
- tbl.puts
+ values = keys.map { |key| colspec[key] }.compact
+ tbl.puts " t.#{colspec[:type]} #{values.join(", ")}"
end
indexes_in_create(table, tbl)