Merge remote-tracking branch 'pleroma/develop' into cycles-streaming
[akkoma] / priv / repo / migrations / 20210203141144_add_featured_address_to_users.exs
1 defmodule Pleroma.Repo.Migrations.AddFeaturedAddressToUsers do
2 use Ecto.Migration
3
4 def up do
5 alter table(:users) do
6 add(:featured_address, :string)
7 end
8
9 create(index(:users, [:featured_address]))
10
11 execute("""
12
13 update users set featured_address = concat(ap_id, '/collections/featured') where local = true and featured_address is null;
14
15 """)
16 end
17
18 def down do
19 alter table(:users) do
20 remove(:featured_address)
21 end
22 end
23 end