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
-
#excl_ignore_pattern ⇒ Object
:singleton-method: Specify a custom regular expression matching exclusion constraints which name should not be dumped to db/schema.rb.
-
#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.
-
#unique_ignore_pattern ⇒ Object
:singleton-method: Specify a custom regular expression matching unique constraints which name should not be dumped to db/schema.rb.
Class Method Details
.dump(pool = ActiveRecord::Base.connection_pool, stream = $stdout, config = ActiveRecord::Base) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/active_record/schema_dumper.rb', line 44 def dump(pool = ActiveRecord::Base.connection_pool, stream = $stdout, config = ActiveRecord::Base) pool.with_connection do |connection| connection.create_schema_dumper((config)).dump(stream) end 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.
29 |
# File 'lib/active_record/schema_dumper.rb', line 29 cattr_accessor :chk_ignore_pattern, default: /^chk_rails_[0-9a-f]{10}$/ |
#dump(stream) ⇒ Object
60 61 62 63 64 65 66 67 68 |
# File 'lib/active_record/schema_dumper.rb', line 60 def dump(stream) header(stream) schemas(stream) extensions(stream) types(stream) tables(stream) trailer(stream) stream end |
#excl_ignore_pattern ⇒ Object
:singleton-method: Specify a custom regular expression matching exclusion constraints which name should not be dumped to db/schema.rb.
35 |
# File 'lib/active_record/schema_dumper.rb', line 35 cattr_accessor :excl_ignore_pattern, default: /^excl_rails_[0-9a-f]{10}$/ |
#fk_ignore_pattern ⇒ Object
:singleton-method: Specify a custom regular expression matching foreign keys which name should not be dumped to db/schema.rb.
23 |
# File 'lib/active_record/schema_dumper.rb', line 23 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 and regexps.
17 |
# File 'lib/active_record/schema_dumper.rb', line 17 cattr_accessor :ignore_tables, default: [] |
#unique_ignore_pattern ⇒ Object
:singleton-method: Specify a custom regular expression matching unique constraints which name should not be dumped to db/schema.rb.
41 |
# File 'lib/active_record/schema_dumper.rb', line 41 cattr_accessor :unique_ignore_pattern, default: /^uniq_rails_[0-9a-f]{10}$/ |