Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
615B

  1. defmodule Pleroma.Repo.Migrations.AddScopesToPleromaFEOAuthRecords do
  2. use Ecto.Migration
  3. def up do
  4. update_scopes_clause = "SET scopes = '{read,write,follow,push,admin}'"
  5. apps_where = "WHERE apps.client_name like 'PleromaFE_%' or apps.client_name like 'AdminFE_%'"
  6. app_id_subquery_where = "WHERE app_id IN (SELECT apps.id FROM apps #{apps_where})"
  7. execute("UPDATE apps #{update_scopes_clause} #{apps_where}")
  8. for table <- ["oauth_authorizations", "oauth_tokens"] do
  9. execute("UPDATE #{table} #{update_scopes_clause} #{app_id_subquery_where}")
  10. end
  11. end
  12. def down, do: :noop
  13. end