Create migration adding TOTP fields to `users` and recovery codes table (#3535)

pull/3537/head r2023.11.20-254
Adrian Gruntkowski 3 years ago committed by GitHub
parent 9b0a6e6e7d
commit 2512f3cbe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,19 @@
defmodule Plausible.Repo.Migrations.AddTotpUserFieldsAndRecoveryCodes do
use Ecto.Migration
def change do
alter table(:users) do
add :totp_secret, :binary
add :totp_enabled, :boolean, null: false, default: false
add :totp_last_used_at, :naive_datetime
end
create table(:totp_recovery_codes) do
add :code_digest, :binary, null: false
add :user_id, references(:users, on_delete: :delete_all), null: false
timestamps(updated_at: false)
end
create index(:totp_recovery_codes, [:user_id])
end
end
Loading…
Cancel
Save