From b227ccab827471359f539d23a14413e70ad67e33 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Fri, 22 Feb 2019 14:00:18 +0300 Subject: [PATCH] Fixed `scopes` of apps / authorizations / tokens from apps initially created with space-delimited `scope`. --- ...20190222104808_data_migration_normalize_scopes.exs | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 priv/repo/migrations/20190222104808_data_migration_normalize_scopes.exs diff --git a/priv/repo/migrations/20190222104808_data_migration_normalize_scopes.exs b/priv/repo/migrations/20190222104808_data_migration_normalize_scopes.exs new file mode 100644 index 000000000..d44e5096b --- /dev/null +++ b/priv/repo/migrations/20190222104808_data_migration_normalize_scopes.exs @@ -0,0 +1,11 @@ +defmodule Pleroma.Repo.Migrations.DataMigrationNormalizeScopes do + use Ecto.Migration + + def up do + for t <- [:apps, :oauth_authorizations, :oauth_tokens] do + execute "UPDATE #{t} SET scopes = string_to_array(array_to_string(scopes, ' '), ' ');" + end + end + + def down, do: :noop +end -- 2.45.2