Module: PactBroker::DB::DataMigrations::Helpers

Instance Method Summary collapse

Instance Method Details

#column_exists?(connection, table, column) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/pact_broker/db/data_migrations/helpers.rb', line 5

def column_exists?(connection, table, column)
  connection.table_exists?(table) && connection.schema(table).find{|col| col.first == column }
end

#columns_exist?(connection, table, columns) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/pact_broker/db/data_migrations/helpers.rb', line 9

def columns_exist?(connection, table, columns)
  columns.all?{ | column | column_exists?(connection, table, column) }
end