about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2021-06-21 17:07:30 +0200
committerGitHub <noreply@github.com>2021-06-21 17:07:30 +0200
commitd174d12c831989bf1d5d3ca54d4f26d28c2c8925 (patch)
tree9a40d954c9983d6ecbef59c078079a5bd9b26dca /db
parent946200b471685545878cec56e4959dd6b8d50ab8 (diff)
Add authentication history (#16408)
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20210609202149_create_login_activities.rb14
-rw-r--r--db/schema.rb15
2 files changed, 28 insertions, 1 deletions
diff --git a/db/migrate/20210609202149_create_login_activities.rb b/db/migrate/20210609202149_create_login_activities.rb
new file mode 100644
index 000000000..38e147c32
--- /dev/null
+++ b/db/migrate/20210609202149_create_login_activities.rb
@@ -0,0 +1,14 @@
+class CreateLoginActivities < ActiveRecord::Migration[6.1]
+  def change
+    create_table :login_activities do |t|
+      t.belongs_to :user, null: false, foreign_key: { on_delete: :cascade }
+      t.string :authentication_method
+      t.string :provider
+      t.boolean :success
+      t.string :failure_reason
+      t.inet :ip
+      t.string :user_agent
+      t.datetime :created_at
+    end
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 3fcee2d30..31bf565b4 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
 #
 # It's strongly recommended that you check this file into your version control system.
 
-ActiveRecord::Schema.define(version: 2021_05_26_193025) do
+ActiveRecord::Schema.define(version: 2021_06_09_202149) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -494,6 +494,18 @@ ActiveRecord::Schema.define(version: 2021_05_26_193025) do
     t.index ["account_id"], name: "index_lists_on_account_id"
   end
 
+  create_table "login_activities", force: :cascade do |t|
+    t.bigint "user_id", null: false
+    t.string "authentication_method"
+    t.string "provider"
+    t.boolean "success"
+    t.string "failure_reason"
+    t.inet "ip"
+    t.string "user_agent"
+    t.datetime "created_at"
+    t.index ["user_id"], name: "index_login_activities_on_user_id"
+  end
+
   create_table "markers", force: :cascade do |t|
     t.bigint "user_id"
     t.string "timeline", default: "", null: false
@@ -1010,6 +1022,7 @@ ActiveRecord::Schema.define(version: 2021_05_26_193025) do
   add_foreign_key "list_accounts", "follows", on_delete: :cascade
   add_foreign_key "list_accounts", "lists", on_delete: :cascade
   add_foreign_key "lists", "accounts", on_delete: :cascade
+  add_foreign_key "login_activities", "users", on_delete: :cascade
   add_foreign_key "markers", "users", on_delete: :cascade
   add_foreign_key "media_attachments", "accounts", name: "fk_96dd81e81b", on_delete: :nullify
   add_foreign_key "media_attachments", "scheduled_statuses", on_delete: :nullify