add webhook events

This commit is contained in:
Alex Turchyn
2025-07-04 21:11:08 +03:00
committed by Pete Matsyburka
parent 1b60b42428
commit 988a5361a6
54 changed files with 825 additions and 160 deletions
@@ -0,0 +1,30 @@
# frozen_string_literal: true
class CreateWebhookEventsAndAttempts < ActiveRecord::Migration[8.0]
def change
create_table :webhook_events do |t|
t.string :uuid, null: false
t.bigint :webhook_url_id, null: false
t.bigint :account_id, null: false
t.bigint :record_id, null: false
t.string :record_type, null: false
t.string :event_type, null: false
t.string :status, null: false
t.index %i[uuid webhook_url_id], unique: true
t.index %i[webhook_url_id id]
t.index %i[webhook_url_id id], where: "status = 'error'", name: 'index_webhook_events_error'
t.timestamps
end
create_table :webhook_attempts do |t|
t.bigint :webhook_event_id, null: false, index: true
t.text :response_body
t.integer :response_status_code, null: false
t.integer :attempt, null: false
t.timestamps
end
end
end