2020-12-31 13:04:51 -07:00
|
|
|
# Pleroma: A lightweight social networking server
|
2023-01-02 13:38:50 -07:00
|
|
|
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
2020-12-31 13:04:51 -07:00
|
|
|
# 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
|
2020-10-13 15:07:36 -06:00
|
|
|
|> where([u], u.is_confirmed == false)
|
2020-12-31 13:04:51 -07:00
|
|
|
|> join(:inner, [u], t in Token, on: t.user_id == u.id)
|
2020-10-13 15:07:36 -06:00
|
|
|
|> Repo.update_all(set: [is_confirmed: true])
|
2020-12-31 13:04:51 -07:00
|
|
|
end
|
|
|
|
|
|
|
|
def down do
|
|
|
|
:noop
|
|
|
|
end
|
|
|
|
end
|