Module: PactBroker::DB::DataMigrations::Helpers
- Included in:
- CreateBranches, DeleteDeprecatedWebhookExecutions, MigrateIntegrations, MigratePactVersionProviderTagSuccessfulVerifications, MigrateWebhookHeaders, SetConsumerVersionOrderForPactPublications, SetExtraColumnsForTags, SetPacticipantDisplayName, SetPacticipantMainBranch, SetWebhookUuid, SetWebhooksEnabled
- Defined in:
- lib/pact_broker/db/data_migrations/helpers.rb
Instance Method Summary collapse
- #column_exists?(connection, table, column) ⇒ Boolean
- #columns_exist?(connection, table, columns) ⇒ Boolean
Instance Method Details
#column_exists?(connection, table, column) ⇒ 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
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 |