1 defmodule Pleroma.Repo.Migrations.AddScopesToPleromaFEOAuthRecords do
5 update_scopes_clause = "SET scopes = '{read,write,follow,push,admin}'"
6 apps_where = "WHERE apps.client_name like 'PleromaFE_%' or apps.client_name like 'AdminFE_%'"
7 app_id_subquery_where = "WHERE app_id IN (SELECT apps.id FROM apps #{apps_where})"
9 execute("UPDATE apps #{update_scopes_clause} #{apps_where}")
11 for table <- ["oauth_authorizations", "oauth_tokens"] do
12 execute("UPDATE #{table} #{update_scopes_clause} #{app_id_subquery_where}")