Sha256: 855db9875669877cc10f6115b75c89728fdb5b07063f4e0a6d438d7705a98937

Contents?: true

Size: 518 Bytes

Versions: 1

Compression:

Stored size: 518 Bytes

Contents

require 'securerandom'

Sequel.migration do
  up do
    from(:triggered_webhooks).where(webhook_id: nil).each do | triggered_webhook |
      from(:webhook_executions).where(triggered_webhook_id: triggered_webhook[:id]).delete
      from(:triggered_webhooks).where(id: triggered_webhook[:id]).delete
    end

    from(:webhook_executions).where(webhook_id: nil, triggered_webhook_id: nil).delete
  end

  # TODO
  # alter_table(:triggered_webhooks) do
  #  set_column_not_null(:webhook_id)
  # end

  down do
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pact_broker-2.6.0 db/migrations/42_delete_orphan_webhook_data.rb