aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/schema_dumper.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2016-08-22 15:46:04 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2016-08-22 15:46:04 -0300
commitdf84e9867219e9311aef6f4efd5dd9ec675bee5c (patch)
tree69e1aaa4201ca87ad671a90adfc60bf8ae9eb58a /activerecord/lib/active_record/schema_dumper.rb
parentd25a5ce256c56d2f9e140aaf59f48945ddfcac1a (diff)
downloadrails-df84e9867219e9311aef6f4efd5dd9ec675bee5c.tar.gz
rails-df84e9867219e9311aef6f4efd5dd9ec675bee5c.tar.bz2
rails-df84e9867219e9311aef6f4efd5dd9ec675bee5c.zip
Remove the SchemaDumper options and change the default behavior
Now the schema dumper by default doesn't align the types and arguments in the ruby format anymore.
Diffstat (limited to 'activerecord/lib/active_record/schema_dumper.rb')
-rw-r--r--activerecord/lib/active_record/schema_dumper.rb41
1 files changed, 3 insertions, 38 deletions
diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb
index be74922453..b65d5b56f1 100644
--- a/activerecord/lib/active_record/schema_dumper.rb
+++ b/activerecord/lib/active_record/schema_dumper.rb
@@ -16,22 +16,6 @@ module ActiveRecord
cattr_accessor :ignore_tables
@@ignore_tables = []
- ##
- # :singleton-method:
- # Define whether column arguments are lined up in dump.
- # Acceptable values are true or false.
- # This setting is only used if ActiveRecord::Base.schema_format == :ruby
- cattr_accessor :standardized_argument_widths
- @@standardized_argument_widths = true
-
- ##
- # :singleton-method:
- # Define whether columns types are lined up in dump.
- # Acceptable values are true or false.
- # This setting is only used if ActiveRecord::Base.schema_format == :ruby
- cattr_accessor :standardized_type_widths
- @@standardized_type_widths = true
-
class << self
def dump(connection=ActiveRecord::Base.connection, stream=STDOUT, config = ActiveRecord::Base)
new(connection, generate_options(config)).dump(stream)
@@ -162,32 +146,13 @@ HEADER
keys = @connection.migration_keys
# figure out the lengths for each column based on above keys
- lengths = if standardized_argument_widths
- keys.map { |key|
- column_specs.map { |spec|
- spec[key] ? spec[key].length + 2 : 0
- }.max
- }
- else
- [0] * keys.length
- end
+ lengths = [0] * keys.length
# the string we're going to sprintf our values against, with standardized column widths
- format_string = if standardized_argument_widths
- lengths.map { |len| "%-#{len}s" }
- else
- ["%s"] * keys.length
- end
+ format_string = ["%s"] * keys.length
# add column type definition to our format string
- if standardized_type_widths
- # find the max length for the 'type' column, which is special
- type_length = column_specs.map { |column| column[:type].length }.max
-
- format_string.unshift " t.%-#{type_length}s "
- else
- format_string.unshift " t.%s "
- end
+ format_string.unshift " t.%s "
format_string *= ""