about summary refs log tree commit diff
path: root/db/migrate
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-05-11 11:49:12 +0200
committerGitHub <noreply@github.com>2018-05-11 11:49:12 +0200
commitb4fb766b23f4b50b51a366f55b451770ece3153a (patch)
treef3089da3ee1d3d937525a227136a739a451caad9 /db/migrate
parent9a794067f77d936783736574640b1238bb8e6b18 (diff)
Add REST API for Web Push Notifications subscriptions (#7445)
- POST /api/v1/push/subscription
- PUT /api/v1/push/subscription
- DELETE /api/v1/push/subscription
- New OAuth scope: "push" (required for the above methods)
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20180510214435_add_access_token_id_to_web_push_subscriptions.rb6
-rw-r--r--db/migrate/20180510230049_migrate_web_push_subscriptions.rb13
2 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20180510214435_add_access_token_id_to_web_push_subscriptions.rb b/db/migrate/20180510214435_add_access_token_id_to_web_push_subscriptions.rb
new file mode 100644
index 000000000..94ef8e0f5
--- /dev/null
+++ b/db/migrate/20180510214435_add_access_token_id_to_web_push_subscriptions.rb
@@ -0,0 +1,6 @@
+class AddAccessTokenIdToWebPushSubscriptions < ActiveRecord::Migration[5.2]
+  def change
+    add_reference :web_push_subscriptions, :access_token, null: true, default: nil, foreign_key: { on_delete: :cascade, to_table: :oauth_access_tokens }, index: false
+    add_reference :web_push_subscriptions, :user, null: true, default: nil, foreign_key: { on_delete: :cascade }, index: false
+  end
+end
diff --git a/db/migrate/20180510230049_migrate_web_push_subscriptions.rb b/db/migrate/20180510230049_migrate_web_push_subscriptions.rb
new file mode 100644
index 000000000..6de1bed79
--- /dev/null
+++ b/db/migrate/20180510230049_migrate_web_push_subscriptions.rb
@@ -0,0 +1,13 @@
+class MigrateWebPushSubscriptions < ActiveRecord::Migration[5.2]
+  disable_ddl_transaction!
+
+  def up
+    add_index :web_push_subscriptions, :user_id, algorithm: :concurrently
+    add_index :web_push_subscriptions, :access_token_id, algorithm: :concurrently
+  end
+
+  def down
+    remove_index :web_push_subscriptions, :user_id
+    remove_index :web_push_subscriptions, :access_token_id
+  end
+end