Sha256: 8041e360cdec3e0c622a19649fc9098b336c8076f87e0865cd16dc72214b1f52

Contents?: true

Size: 816 Bytes

Versions: 8

Compression:

Stored size: 816 Bytes

Contents

module SchemaDumpingHelper
  def dump_table_schema(table, connection = ActiveRecord::Base.connection)
    old_ignore_tables = ActiveRecord::SchemaDumper.ignore_tables
    ActiveRecord::SchemaDumper.ignore_tables = connection.data_sources - [table]
    stream = StringIO.new
    ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, stream)
    stream.string
  ensure
    ActiveRecord::SchemaDumper.ignore_tables = old_ignore_tables
  end

  def dump_all_table_schema(ignore_tables)
    old_ignore_tables, ActiveRecord::SchemaDumper.ignore_tables = ActiveRecord::SchemaDumper.ignore_tables, ignore_tables
    stream = StringIO.new
    ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, stream)
    stream.string
  ensure
    ActiveRecord::SchemaDumper.ignore_tables = old_ignore_tables
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
ibm_db-5.2.0 test/support/schema_dumping_helper.rb
ibm_db-5.1.0 test/support/schema_dumping_helper.rb
ibm_db-5.0.5 test/support/schema_dumping_helper.rb
ibm_db-5.0.4 test/support/schema_dumping_helper.rb
ibm_db-5.0.3 test/support/schema_dumping_helper.rb
ibm_db-5.0.2 test/support/schema_dumping_helper.rb
ibm_db-4.0.0-x86-mingw32 test/support/schema_dumping_helper.rb
ibm_db-4.0.0 test/support/schema_dumping_helper.rb