add webhook events
This commit is contained in:
committed by
Pete Matsyburka
parent
1b60b42428
commit
988a5361a6
@@ -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
|
||||
+26
-1
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do
|
||||
ActiveRecord::Schema[8.0].define(version: 2025_06_27_130628) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "btree_gin"
|
||||
enable_extension "plpgsql"
|
||||
@@ -437,6 +437,31 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_18_085322) do
|
||||
t.index ["uuid"], name: "index_users_on_uuid", unique: true
|
||||
end
|
||||
|
||||
create_table "webhook_attempts", force: :cascade do |t|
|
||||
t.bigint "webhook_event_id", null: false
|
||||
t.text "response_body"
|
||||
t.integer "response_status_code", null: false
|
||||
t.integer "attempt", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["webhook_event_id"], name: "index_webhook_attempts_on_webhook_event_id"
|
||||
end
|
||||
|
||||
create_table "webhook_events", force: :cascade 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.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["uuid", "webhook_url_id"], name: "index_webhook_events_on_uuid_and_webhook_url_id", unique: true
|
||||
t.index ["webhook_url_id", "id"], name: "index_webhook_events_error", where: "((status)::text = 'error'::text)"
|
||||
t.index ["webhook_url_id", "id"], name: "index_webhook_events_on_webhook_url_id_and_id"
|
||||
end
|
||||
|
||||
create_table "webhook_urls", force: :cascade do |t|
|
||||
t.bigint "account_id", null: false
|
||||
t.text "url", null: false
|
||||
|
||||
Reference in New Issue
Block a user