summaryrefslogtreecommitdiff
path: root/priv/repo/migrations/20201217172858_data_migration_prolong_o_auth_tokens_valid_until.exs
blob: 560cc74478340961a4c4b01c912d13c5b86291bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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