Class: ActiveRecord::SchemaDumper
- Inherits:
-
Object
- Object
- ActiveRecord::SchemaDumper
- Defined in:
- 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
Class Method Summary collapse
Instance Method Summary collapse
-
#chk_ignore_pattern ⇒ Object
:singleton-method: Specify a custom regular expression matching check constraints which name should not be dumped to db/schema.rb.
- #dump(stream) ⇒ Object
-
#fk_ignore_pattern ⇒ Object
:singleton-method: Specify a custom regular expression matching foreign keys which name should not be dumped to db/schema.rb.
-
#ignore_tables ⇒ Object
:singleton-method: A list of tables which should not be dumped to the schema.
Class Method Details
.dump(connection = ActiveRecord::Base.connection, stream = STDOUT, config = ActiveRecord::Base) ⇒ Object
33 34 35 36 |
# File 'lib/active_record/schema_dumper.rb', line 33 def dump(connection = ActiveRecord::Base.connection, stream = STDOUT, config = ActiveRecord::Base) connection.create_schema_dumper((config)).dump(stream) stream end |
Instance Method Details
#chk_ignore_pattern ⇒ Object
:singleton-method: Specify a custom regular expression matching check constraints which name should not be dumped to db/schema.rb.
30 |
# File 'lib/active_record/schema_dumper.rb', line 30 cattr_accessor :chk_ignore_pattern, default: /^chk_rails_[0-9a-f]{10}$/ |
#dump(stream) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/active_record/schema_dumper.rb', line 47 def dump(stream) header(stream) extensions(stream) tables(stream) trailer(stream) stream end |
#fk_ignore_pattern ⇒ Object
:singleton-method: Specify a custom regular expression matching foreign keys which name should not be dumped to db/schema.rb.
24 |
# File 'lib/active_record/schema_dumper.rb', line 24 cattr_accessor :fk_ignore_pattern, default: /^fk_rails_[0-9a-f]{10}$/ |
#ignore_tables ⇒ Object
:singleton-method: A list of tables which should not be dumped to the schema. Acceptable values are strings as well as regexp if ActiveRecord::Base.schema_format == :ruby. Only strings are accepted if ActiveRecord::Base.schema_format == :sql.
18 |
# File 'lib/active_record/schema_dumper.rb', line 18 cattr_accessor :ignore_tables, default: [] |