Sha256: adcaa6437dd8d62fd2ffa193dba958c1ef1b69a8b20900fd9cb0a52871282ec0

Contents?: true

Size: 1.79 KB

Versions: 4

Compression:

Stored size: 1.79 KB

Contents

# frozen_string_literal: true

class CreateVigilesArchiveConversationsTable < ActiveRecord::Migration<%= migration_version %>

  def change
    create_table :vigiles_archive_conversations do |t|
      t.text     :request_content_type, null: false
      t.text     :request_user_agent,   null: false
      t.datetime :request_timestamp,    null: false
      t.inet     :request_remote_ip,    null: false
      t.text     :request_protocol,     null: false
      t.jsonb    :request_headers,      null: false, default: {}

      # if the request doesn't origin from an identifiable origin,
      # like a website, this value is typically nil. in which case
      # we can substitute with `request_user_agent`.
      t.text     :request_origin
      t.jsonb    :request_payload,      null: false, default: {}
      t.text     :request_method,       null: false
      t.text     :request_path,         null: false
      t.text     :request_url,          null: false
      t.text     :request_id,           null: false

      t.text     :response_content_type, null: false
      t.jsonb    :response_headers,      null: false
      t.jsonb    :response_payload,      null: false
      t.integer  :response_status,       null: false

      # conversation `metadata` holds all other information that might be
      # useful when inspecting the conversation. for example, metadata
      # could hold user information (id, rate limiting usage, etc), or
      # the (rack) environment within which rails handled the request.
      t.jsonb :metadata, null: false, default: {}

      # `extras` are added here as convenience. it's a grab bag of all
      # data that wouldn't cleanly fit in any of the above columns. it's
      # also a mixed bag of request and response data.
      t.jsonb :extras, null: false, default: {}
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vigiles-0.1.5 lib/generators/vigiles/templates/archive_conversation_migration.rb.erb
vigiles-0.1.4 lib/generators/templates/archive_conversation_migration.rb.erb
vigiles-0.1.3 lib/generators/templates/archive_conversation_migration.rb.erb
vigiles-0.1.2 lib/generators/templates/archive_conversation_migration.rb.erb