Class: PactBroker::DB::DataMigrations::SetWebhookUuid
- Inherits:
-
Object
- Object
- PactBroker::DB::DataMigrations::SetWebhookUuid
show all
- Extended by:
- Helpers
- Defined in:
- lib/pact_broker/db/data_migrations/set_webhook_uuid.rb
Class Method Summary
collapse
Methods included from Helpers
column_exists?, columns_exist?
Class Method Details
.call(connection, _options = {}) ⇒ Object
12
13
14
15
16
|
# File 'lib/pact_broker/db/data_migrations/set_webhook_uuid.rb', line 12
def self.call(connection, _options = {})
if required_columns_exist?(connection)
connection[:triggered_webhooks].where(uuid: nil).update(uuid: [SecureRandom.uuid, "-", :id].sql_string_join)
end
end
|
.required_columns_exist?(connection) ⇒ Boolean
18
19
20
|
# File 'lib/pact_broker/db/data_migrations/set_webhook_uuid.rb', line 18
def self.required_columns_exist?(connection)
columns_exist?(connection, :triggered_webhooks, [:uuid])
end
|