move to 2.5.5
[anni] / priv / repo / migrations / 20180918182427_create_push_subscriptions.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.CreatePushSubscriptions do
6   use Ecto.Migration
7
8   def change do
9     create_if_not_exists table("push_subscriptions") do
10       add(:user_id, references("users", on_delete: :delete_all))
11       add(:token_id, references("oauth_tokens", on_delete: :delete_all))
12       add(:endpoint, :string)
13       add(:key_p256dh, :string)
14       add(:key_auth, :string)
15       add(:data, :map)
16
17       timestamps()
18     end
19
20     create_if_not_exists(index("push_subscriptions", [:user_id, :token_id], unique: true))
21   end
22 end