diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2019-04-08 18:57:05 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2019-04-08 19:23:26 +0900 |
commit | f185e0ebc9cc18c596eb9cab1a9cd99e26a20500 (patch) | |
tree | 7e505622c6c7672b7f401424969f82800caaa675 /activerecord/lib/active_record/schema_dumper.rb | |
parent | bf1494a1018a0bdc50dac4e87fdbf4b6b03083fa (diff) | |
download | rails-f185e0ebc9cc18c596eb9cab1a9cd99e26a20500.tar.gz rails-f185e0ebc9cc18c596eb9cab1a9cd99e26a20500.tar.bz2 rails-f185e0ebc9cc18c596eb9cab1a9cd99e26a20500.zip |
Except `table_name` from column objects
The `table_name` was added at #23677 to detect whether serial column or
not correctly.
We can do that detection before initialize column object, it makes
column object size smaller, and it probably helps column object
de-duplication.
Diffstat (limited to 'activerecord/lib/active_record/schema_dumper.rb')
-rw-r--r-- | activerecord/lib/active_record/schema_dumper.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/schema_dumper.rb b/activerecord/lib/active_record/schema_dumper.rb index d475e77444..2f7cc07221 100644 --- a/activerecord/lib/active_record/schema_dumper.rb +++ b/activerecord/lib/active_record/schema_dumper.rb @@ -47,6 +47,7 @@ module ActiveRecord end private + attr_accessor :table_name def initialize(connection, options = {}) @connection = connection @@ -110,6 +111,8 @@ HEADER def table(table, stream) columns = @connection.columns(table) begin + self.table_name = table + tbl = StringIO.new # first dump primary key column @@ -159,6 +162,8 @@ HEADER stream.puts "# Could not dump table #{table.inspect} because of following #{e.class}" stream.puts "# #{e.message}" stream.puts + ensure + self.table_name = nil end end |