move to 2.5.5
[anni] / priv / repo / migrations / 20201217172858_data_migration_prolong_o_auth_tokens_valid_until.exs
1 # Pleroma: A lightweight social networking server
2 # Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
3 # SPDX-License-Identifier: AGPL-3.0-only
4
5 defmodule Pleroma.Repo.Migrations.DataMigrationProlongOAuthTokensValidUntil do
6   use Ecto.Migration
7
8   def up do
9     expires_in = Pleroma.Config.get!([:oauth2, :token_expires_in])
10     valid_until = NaiveDateTime.add(NaiveDateTime.utc_now(), expires_in, :second)
11     execute("update oauth_tokens set valid_until = '#{valid_until}'")
12   end
13
14   def down do
15     :noop
16   end
17 end