diff options
author | Vincent Wong <wingyu64@gmail.com> | 2016-12-21 17:59:54 +0300 |
---|---|---|
committer | Vincent Wong <wingyu64@gmail.com> | 2017-01-08 20:15:39 +0300 |
commit | b6df93a51f90c7ed29ce6667c6b1a8debf02506e (patch) | |
tree | ff13ffc730ceeb52635bad3204db1050d0e74947 /db | |
parent | f264ec6ee74a0263b4e5212e921c4638c25f8fcd (diff) |
Record and show last used date of SSH Keys
Addresses: Issue #13810
1. Adds a last_used_at attribute to the Key table/model
2. Update a key's last_used_at whenever it gets used
3. Display how long ago an ssh key was last used
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20161221152132_add_last_used_at_to_key.rb | 9 | ||||
-rw-r--r-- | db/schema.rb | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/db/migrate/20161221152132_add_last_used_at_to_key.rb b/db/migrate/20161221152132_add_last_used_at_to_key.rb new file mode 100644 index 00000000000..fb2b15817de --- /dev/null +++ b/db/migrate/20161221152132_add_last_used_at_to_key.rb @@ -0,0 +1,9 @@ +class AddLastUsedAtToKey < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + add_column :keys, :last_used_at, :datetime + end +end diff --git a/db/schema.rb b/db/schema.rb index 2198dcee2cd..6834218553f 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -528,6 +528,7 @@ ActiveRecord::Schema.define(version: 20161226122833) do t.string "fingerprint" t.boolean "public", default: false, null: false t.boolean "can_push", default: false, null: false + t.datetime "last_used_at" end add_index "keys", ["fingerprint"], name: "index_keys_on_fingerprint", unique: true, using: :btree |