mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 04:03:57 -06:00
52c5cf33f8
- Allow revoking keys without deleting them - Auto-revoke keys after a period of no use (default 6 months) - Allow multiple keys per user - Allow attaching a description to each key, for easier auditing - Log changes to keys in the staff action log - Move all key management to one place, and improve the UI
18 lines
521 B
Ruby
18 lines
521 B
Ruby
# frozen_string_literal: true
|
|
class AddRevokedAtToApiKey < ActiveRecord::Migration[5.2]
|
|
def up
|
|
add_column :api_keys, :revoked_at, :datetime
|
|
add_column :api_keys, :description, :text
|
|
|
|
execute "INSERT INTO site_settings(name, data_type, value, created_at, updated_at)
|
|
VALUES ('api_key_last_used_epoch', 1, now(), now(), now())"
|
|
|
|
remove_index :api_keys, :user_id # Remove unique index
|
|
add_index :api_keys, :user_id
|
|
end
|
|
|
|
def down
|
|
raise ActiveRecord::IrreversibleMigration
|
|
end
|
|
end
|