Sha256: e1b9240684b0401a5d28779c6e575f19a0f80dc7db27435c781defcfec4fb34e

Contents?: true

Size: 545 Bytes

Versions: 144

Compression:

Stored size: 545 Bytes

Contents

class MigrateEventTypeIdsOnWebhooksOutgoingEndpoints < ActiveRecord::Migration[6.1]
  def change
    Webhooks::Outgoing::Endpoint.find_each do |endpoint|
      event_type_ids = ActiveRecord::Base.connection.execute("SELECT * FROM webhooks_outgoing_endpoint_event_types JOIN webhooks_outgoing_event_types ON webhooks_outgoing_endpoint_event_types.event_type_id = webhooks_outgoing_event_types.id WHERE endpoint_id = #{endpoint.id}").to_a.map { |result| result.dig("name") }
      endpoint.update(event_type_ids: event_type_ids)
    end
  end
end

Version data entries

144 entries across 144 versions & 2 rubygems

Version Path
bullet_train-outgoing_webhooks-1.6.25 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb
bullet_train-outgoing_webhooks-1.6.24 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb
bullet_train-outgoing_webhooks-1.6.23 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb
bullet_train-outgoing_webhooks-1.6.22 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb
bullet_train-outgoing_webhooks-1.6.21 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb
bullet_train-outgoing_webhooks-1.6.20 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb
bullet_train-outgoing_webhooks-1.6.19 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb
bullet_train-outgoing_webhooks-1.6.18 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb
bullet_train-outgoing_webhooks-1.6.17 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb
bullet_train-outgoing_webhooks-1.6.16 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb
bullet_train-outgoing_webhooks-1.6.15 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb
bullet_train-outgoing_webhooks-1.6.14 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb
bullet_train-outgoing_webhooks-1.6.13 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb
bullet_train-outgoing_webhooks-1.6.12 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb
bullet_train-outgoing_webhooks-1.6.11 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb
bullet_train-outgoing_webhooks-1.6.10 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb
bullet_train-outgoing_webhooks-1.6.9 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb
bullet_train-outgoing_webhooks-1.6.8 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb
bullet_train-outgoing_webhooks-1.6.7 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb
bullet_train-outgoing_webhooks-1.6.6 db/migrate/20211126230847_migrate_event_type_ids_on_webhooks_outgoing_endpoints.rb