From 62bf4a12929fb61164874180af491f9e12f21084 Mon Sep 17 00:00:00 2001 From: Ivan Tashkinov Date: Thu, 17 Dec 2020 20:49:00 +0300 Subject: [#2353] Virtually never-expiring OAuth tokens (new and already issued ones). --- ...858_data_migration_prolong_o_auth_tokens_valid_until.exs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 priv/repo/migrations/20201217172858_data_migration_prolong_o_auth_tokens_valid_until.exs (limited to 'priv/repo') diff --git a/priv/repo/migrations/20201217172858_data_migration_prolong_o_auth_tokens_valid_until.exs b/priv/repo/migrations/20201217172858_data_migration_prolong_o_auth_tokens_valid_until.exs new file mode 100644 index 000000000..560cc7447 --- /dev/null +++ b/priv/repo/migrations/20201217172858_data_migration_prolong_o_auth_tokens_valid_until.exs @@ -0,0 +1,13 @@ +defmodule Pleroma.Repo.Migrations.DataMigrationProlongOAuthTokensValidUntil do + use Ecto.Migration + + def up do + expires_in = Pleroma.Config.get!([:oauth2, :token_expires_in]) + valid_until = NaiveDateTime.add(NaiveDateTime.utc_now(), expires_in, :second) + execute("update oauth_tokens set valid_until = '#{valid_until}'") + end + + def down do + :noop + end +end -- cgit v1.2.3