Class: ActiveRecord::SchemaDumper

Inherits:
Object
  • Object
show all
Defined in:
activerecord/lib/active_record/schema_dumper.rb

Overview

Active Record Schema Dumper

This class is used to dump the database schema for some connection to some output format (i.e., ActiveRecord::Schema).

Direct Known Subclasses

ConnectionAdapters::SchemaDumper

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.dump(connection = ActiveRecord::Base.connection, stream = STDOUT, config = ActiveRecord::Base) ⇒ Object



44
45
46
47
# File 'activerecord/lib/active_record/schema_dumper.rb', line 44

def dump(connection = ActiveRecord::Base.connection, stream = STDOUT, config = ActiveRecord::Base)
  connection.create_schema_dumper(generate_options(config)).dump(stream)
  stream
end

Instance Method Details

#chk_ignore_patternObject

:singleton-method: Specify a custom regular expression matching check constraints which name should not be dumped to db/schema.rb.



29
# File 'activerecord/lib/active_record/schema_dumper.rb', line 29

cattr_accessor :chk_ignore_pattern, default: /^chk_rails_[0-9a-f]{10}$/

#dump(stream) ⇒ Object



58
59
60
61
62
63
64
65
# File 'activerecord/lib/active_record/schema_dumper.rb', line 58

def dump(stream)
  header(stream)
  extensions(stream)
  types(stream)
  tables(stream)
  trailer(stream)
  stream
end

#excl_ignore_patternObject

:singleton-method: Specify a custom regular expression matching exclusion constraints which name should not be dumped to db/schema.rb.



35
# File 'activerecord/lib/active_record/schema_dumper.rb', line 35

cattr_accessor :excl_ignore_pattern, default: /^excl_rails_[0-9a-f]{10}$/

#fk_ignore_patternObject

:singleton-method: Specify a custom regular expression matching foreign keys which name should not be dumped to db/schema.rb.



23
# File 'activerecord/lib/active_record/schema_dumper.rb', line 23

cattr_accessor :fk_ignore_pattern, default: /^fk_rails_[0-9a-f]{10}$/

#ignore_tablesObject

:singleton-method: A list of tables which should not be dumped to the schema. Acceptable values are strings and regexps.



17
# File 'activerecord/lib/active_record/schema_dumper.rb', line 17

cattr_accessor :ignore_tables, default: []

#unique_ignore_patternObject

:singleton-method: Specify a custom regular expression matching unique constraints which name should not be dumped to db/schema.rb.



41
# File 'activerecord/lib/active_record/schema_dumper.rb', line 41

cattr_accessor :unique_ignore_pattern, default: /^uniq_rails_[0-9a-f]{10}$/