move to 2.5.5
[anni] / priv / repo / migrations / 20180813003722_create_filters.exs
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
5 defmodule Pleroma.Repo.Migrations.CreateFilters do
6   use Ecto.Migration
7
8   def change do
9     create_if_not_exists table(:filters) do
10       add(:user_id, references(:users, on_delete: :delete_all))
11       add(:filter_id, :integer)
12       add(:hide, :boolean)
13       add(:phrase, :string)
14       add(:context, {:array, :string})
15       add(:expires_at, :utc_datetime)
16       add(:whole_word, :boolean)
17
18       timestamps()
19     end
20
21     create_if_not_exists(index(:filters, [:user_id]))
22
23     create_if_not_exists(
24       index(:filters, [:phrase], where: "hide = true", name: :hided_phrases_index)
25     )
26   end
27 end