Websites/db/migrate/20240102073042_create_api_usages.rb

18 lines
538 B
Ruby
Raw Normal View History

2024-05-03 03:04:43 +00:00
# frozen_string_literal: true
class CreateAPIUsages < ActiveRecord::Migration[7.1]
def change
create_table(:api_usages) do |t|
t.references(:user, foreign_key: { to_table: :api_users })
t.references(:api_key)
t.text(:user_agent, null: false, default: "")
t.text(:method, null: false, default: "GET")
t.text(:path, null: false, default: "/")
t.jsonb(:params, null: false, default: "{}")
t.text(:service, null: false)
t.inet(:ip_addr, null: false)
t.timestamps
end
end
end