summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20201231185546_confirm_logged_in_users.exs
blob: de2f351698619d33d27ae6bfe78dfa6507f8a695 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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