1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
5 defmodule Pleroma.Repo.Migrations.AddScopesToPleromaFEOAuthRecords do
9 update_scopes_clause = "SET scopes = '{read,write,follow,push,admin}'"
10 apps_where = "WHERE apps.client_name like 'PleromaFE_%' or apps.client_name like 'AdminFE_%'"
11 app_id_subquery_where = "WHERE app_id IN (SELECT apps.id FROM apps #{apps_where})"
13 execute("UPDATE apps #{update_scopes_clause} #{apps_where}")
15 for table <- ["oauth_authorizations", "oauth_tokens"] do
16 execute("UPDATE #{table} #{update_scopes_clause} #{app_id_subquery_where}")