Merge pull request 'Add dark and light theme mode to docs, detection, and button...
[akkoma] / priv / repo / migrations / 20180918182427_create_push_subscriptions.exs
1 defmodule Pleroma.Repo.Migrations.CreatePushSubscriptions do
2 use Ecto.Migration
3
4 def change do
5 create_if_not_exists table("push_subscriptions") do
6 add(:user_id, references("users", on_delete: :delete_all))
7 add(:token_id, references("oauth_tokens", on_delete: :delete_all))
8 add(:endpoint, :string)
9 add(:key_p256dh, :string)
10 add(:key_auth, :string)
11 add(:data, :map)
12
13 timestamps()
14 end
15
16 create_if_not_exists(index("push_subscriptions", [:user_id, :token_id], unique: true))
17 end
18 end