Migration to confirm previously-logged-in users
This commit is contained in:
parent
64f0e96ff6
commit
7b44605cb8
2 changed files with 62 additions and 0 deletions
|
|
@ -0,0 +1,22 @@
|
|||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Repo.Migrations.ConfirmLoggedInUsers do
|
||||
use Ecto.Migration
|
||||
import Ecto.Query
|
||||
alias Pleroma.Repo
|
||||
alias Pleroma.User
|
||||
alias Pleroma.Web.OAuth.Token
|
||||
|
||||
def up do
|
||||
User
|
||||
|> where([u], u.confirmation_pending == true)
|
||||
|> join(:inner, [u], t in Token, on: t.user_id == u.id)
|
||||
|> Repo.update_all(set: [confirmation_pending: false])
|
||||
end
|
||||
|
||||
def down do
|
||||
:noop
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue