logo

pleroma

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

20180221210540_make_following_postgres_array.exs (606B)


  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.MakeFollowingPostgresArray do
  5. use Ecto.Migration
  6. def up do
  7. alter table(:users) do
  8. add(:following_temp, {:array, :string})
  9. end
  10. execute("""
  11. update users set following_temp = array(select jsonb_array_elements_text(following));
  12. """)
  13. alter table(:users) do
  14. remove(:following)
  15. end
  16. rename(table(:users), :following_temp, to: :following)
  17. end
  18. def down, do: :ok
  19. end