logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git

20201231185546_confirm_logged_in_users.exs (548B)


  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Repo.Migrations.ConfirmLoggedInUsers do
  5. use Ecto.Migration
  6. import Ecto.Query
  7. alias Pleroma.Repo
  8. alias Pleroma.User
  9. alias Pleroma.Web.OAuth.Token
  10. def up do
  11. User
  12. |> where([u], u.is_confirmed == false)
  13. |> join(:inner, [u], t in Token, on: t.user_id == u.id)
  14. |> Repo.update_all(set: [is_confirmed: true])
  15. end
  16. def down do
  17. :noop
  18. end
  19. end