Websites/db/migrate/20231114021606_create_api_keys.rb

25 lines
982 B
Ruby
Raw Permalink Normal View History

2024-05-03 03:04:43 +00:00
# frozen_string_literal: true
class CreateAPIKeys < ActiveRecord::Migration[7.1]
def change
create_table(:api_keys) do |t|
t.references(:owner, foreign_key: { to_table: :api_users }, null: false)
t.boolean(:active, default: true, null: false)
t.boolean(:disabled, default: false, null: false)
t.boolean(:super, default: false, null: false)
t.boolean(:unlimited, default: false, null: false)
t.integer(:bulk_limit, default: 100, null: false)
t.integer(:flags, default: APIKey::Flags.default, null: false)
t.integer(:limit_long, default: 12, null: false)
t.integer(:limit_short, default: 4, null: false)
t.integer(:window_long, default: 10_000, null: false)
t.integer(:window_short, default: 2000, null: false)
t.string(:application_name, null: false)
t.string(:usage, null: false, default: "")
t.string(:disabled_reason)
t.string(:key, null: false)
t.timestamps
end
end
end