diff options
| author | Mark Felder <feld@FreeBSD.org> | 2020-01-20 12:55:51 -0600 |
|---|---|---|
| committer | Mark Felder <feld@FreeBSD.org> | 2020-01-20 12:55:51 -0600 |
| commit | 390bf9b097cab96b9d3a0214f974044667524442 (patch) | |
| tree | 2f0a6fbefb264dcedb12910870db0f9aea8c3d29 /priv/repo/migrations | |
| parent | cde828ff7df64740f36b2fc9dfdbfc8d76a8a78d (diff) | |
| parent | ab36459464311389c2929ff1c48537889066a9f8 (diff) | |
| download | pleroma-390bf9b097cab96b9d3a0214f974044667524442.tar.gz pleroma-390bf9b097cab96b9d3a0214f974044667524442.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.exs | 17 |
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 |
