Module: PgPower::SchemaDumper::ForeignerMethods
- Included in:
- PgPower::SchemaDumper
- Defined in:
- lib/pg_power/schema_dumper/foreigner_methods.rb
Overview
Provides methods to extend ActiveRecord::SchemaDumper to dump foreign keys.
Instance Method Summary collapse
-
#tables_with_foreign_keys(stream) ⇒ Object
Hooks ActiveRecord::SchemaDumper#table method to dump foreign keys.
Instance Method Details
#tables_with_foreign_keys(stream) ⇒ Object
Hooks ActiveRecord::SchemaDumper#table method to dump foreign keys.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/pg_power/schema_dumper/foreigner_methods.rb', line 5 def tables_with_foreign_keys(stream) tables_without_foreign_keys(stream) table_names = @connection.tables.sort table_names.sort.each do |table| next if ['schema_migrations', ignore_tables].flatten.any? do |ignored| case ignored when String; table == ignored when Regexp; table =~ ignored else raise StandardError, 'ActiveRecord::SchemaDumper.ignore_tables accepts an array of String and / or Regexp values.' end end foreign_keys(table, stream) end end |