Module: Foreigner::SchemaDumper
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/foreigner/schema_dumper.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#requires_foreigner_load? ⇒ Boolean
43 44 45 46 |
# File 'lib/foreigner/schema_dumper.rb', line 43 def requires_foreigner_load? major, minor, patch = Foreigner::Helper.active_record_version.segments major == 4 && minor == 1 && patch >= 9 end |
#tables_with_foreign_keys(stream) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/foreigner/schema_dumper.rb', line 48 def tables_with_foreign_keys(stream) tables_without_foreign_keys(stream) # Ensure Foreigner to be initialized before running foreign_keys. # This is required since schema::load is not initializing the environment # anymore in Rails 4.1.9 (https://github.com/rails/rails/commit/5d6bb89f) stream.puts ' Foreigner.load' if requires_foreigner_load? @connection.tables.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 |