Sha256: dc5973531504216a0e6dd2a145ebb8bbb73ae5ed7ce638042257abd8cdde828b
Contents?: true
Size: 1.18 KB
Versions: 4
Compression:
Stored size: 1.18 KB
Contents
class CreateMunsterTables < ActiveRecord::Migration<%= migration_version %> <% id_type = Rails.application.config.generators.options[:active_record][:primary_key_type] rescue nil %> def change create_table :received_webhooks <%= ", id: :#{id_type}" if id_type %> do |t| t.string :handler_event_id, null: false t.string :handler_module_name, null: false t.string :status, default: "received", null: false # We don't assume, that we can always parse received body as JSON. Body could be invalid or partly missing, # we can argue how we can handle that for different integrations, but we still should be able to save this data # if it's required. Hence, we don't use :jsonb, but :binary type column here. t.binary :body, null: false t.timestamps end # For deduplication at ingress. UNIQUE indices in Postgres are case-sensitive # which is what we want, as these are externally-generated IDs add_index :received_webhooks, [:handler_module_name, :handler_event_id], unique: true, name: "webhook_dedup_idx" # For backfill processing (to know how many skipped etc. payloads we have) add_index :received_webhooks, [:status] end end
Version data entries
4 entries across 4 versions & 1 rubygems