summaryrefslogtreecommitdiff
path: root/priv/repo/migrations
diff options
context:
space:
mode:
authorRoman Chvanikov <chvanikoff@pm.me>2020-01-21 19:45:13 +0300
committerRoman Chvanikov <chvanikoff@pm.me>2020-01-21 19:45:13 +0300
commit22e94bb2c7a4de93a741b7ca45148cee4a0d601a (patch)
treec1e388a0d21ff768d8b53bc53662d96cbc3d2ae1 /priv/repo/migrations
parentcde828ff7df64740f36b2fc9dfdbfc8d76a8a78d (diff)
parent04c9ca5d68eb4d9c8abc82a91d5df3c483089b9b (diff)
downloadpleroma-22e94bb2c7a4de93a741b7ca45148cee4a0d601a.tar.gz
pleroma-22e94bb2c7a4de93a741b7ca45148cee4a0d601a.zip
Merge branch 'develop' into fix/attachments-cleanup
Diffstat (limited to 'priv/repo/migrations')
-rw-r--r--priv/repo/migrations/20191220174645_add_scopes_to_pleroma_feo_auth_records.exs17
1 files changed, 17 insertions, 0 deletions
diff --git a/priv/repo/migrations/20191220174645_add_scopes_to_pleroma_feo_auth_records.exs b/priv/repo/migrations/20191220174645_add_scopes_to_pleroma_feo_auth_records.exs
new file mode 100644
index 000000000..6b160ad16
--- /dev/null
+++ b/priv/repo/migrations/20191220174645_add_scopes_to_pleroma_feo_auth_records.exs
@@ -0,0 +1,17 @@
+defmodule Pleroma.Repo.Migrations.AddScopesToPleromaFEOAuthRecords do
+ use Ecto.Migration
+
+ def up do
+ update_scopes_clause = "SET scopes = '{read,write,follow,push,admin}'"
+ apps_where = "WHERE apps.client_name like 'PleromaFE_%' or apps.client_name like 'AdminFE_%'"
+ app_id_subquery_where = "WHERE app_id IN (SELECT apps.id FROM apps #{apps_where})"
+
+ execute("UPDATE apps #{update_scopes_clause} #{apps_where}")
+
+ for table <- ["oauth_authorizations", "oauth_tokens"] do
+ execute("UPDATE #{table} #{update_scopes_clause} #{app_id_subquery_where}")
+ end
+ end
+
+ def down, do: :noop
+end