Merge remote-tracking branch 'remotes/origin/develop' into feature/object-hashtags-rework
# Conflicts: # CHANGELOG.md
This commit is contained in:
commit
2634a16b4c
161 changed files with 1462 additions and 473 deletions
|
|
@ -1,6 +1,9 @@
|
|||
defmodule Pleroma.Repo.Migrations.AddObanJobsTable do
|
||||
use Ecto.Migration
|
||||
|
||||
defdelegate up, to: Oban.Migrations
|
||||
def up do
|
||||
Oban.Migrations.up(version: 2)
|
||||
end
|
||||
|
||||
defdelegate down, to: Oban.Migrations
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@ defmodule Pleroma.Repo.Migrations.UpdateOban do
|
|||
end
|
||||
|
||||
def down do
|
||||
Oban.Migrations.down(version: 2)
|
||||
Oban.Migrations.down(version: 3)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@ defmodule Pleroma.Repo.Migrations.UpdateObanJobsTable do
|
|||
end
|
||||
|
||||
def down do
|
||||
Oban.Migrations.down(version: 7)
|
||||
Oban.Migrations.down(version: 8)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ defmodule Pleroma.Repo.Migrations.MoveActivityExpirationsToOban do
|
|||
def change do
|
||||
Pleroma.Config.Oban.warn()
|
||||
|
||||
Application.ensure_all_started(:oban)
|
||||
|
||||
Supervisor.start_link([{Oban, Pleroma.Config.get(Oban)}],
|
||||
strategy: :one_for_one,
|
||||
name: Pleroma.Supervisor
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ defmodule Pleroma.Repo.Migrations.MoveTokensExpirationIntoOban do
|
|||
def change do
|
||||
Pleroma.Config.Oban.warn()
|
||||
|
||||
Application.ensure_all_started(:oban)
|
||||
|
||||
Supervisor.start_link([{Oban, Pleroma.Config.get(Oban)}],
|
||||
strategy: :one_for_one,
|
||||
name: Pleroma.Supervisor
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Repo.Migrations.RefactorConfirmationPendingUserField do
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
# Flip the values before we change the meaning of the column
|
||||
execute("UPDATE users SET confirmation_pending = NOT confirmation_pending;")
|
||||
execute("ALTER TABLE users RENAME COLUMN confirmation_pending TO is_confirmed;")
|
||||
execute("ALTER TABLE users ALTER COLUMN is_confirmed SET DEFAULT true;")
|
||||
end
|
||||
|
||||
def down do
|
||||
execute("UPDATE users SET is_confirmed = NOT is_confirmed;")
|
||||
execute("ALTER TABLE users RENAME COLUMN is_confirmed TO confirmation_pending;")
|
||||
execute("ALTER TABLE users ALTER COLUMN confirmation_pending SET DEFAULT false;")
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Repo.Migrations.RefactorApprovalPendingUserField do
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
# Flip the values before we change the meaning of the column
|
||||
execute("UPDATE users SET approval_pending = NOT approval_pending;")
|
||||
execute("ALTER TABLE users RENAME COLUMN approval_pending TO is_approved;")
|
||||
execute("ALTER TABLE users ALTER COLUMN is_approved SET DEFAULT true;")
|
||||
end
|
||||
|
||||
def down do
|
||||
execute("UPDATE users SET is_approved = NOT is_approved;")
|
||||
execute("ALTER TABLE users RENAME COLUMN is_approved TO approval_pending;")
|
||||
execute("ALTER TABLE users ALTER COLUMN approval_pending SET DEFAULT false;")
|
||||
end
|
||||
end
|
||||
|
|
@ -11,9 +11,9 @@ defmodule Pleroma.Repo.Migrations.ConfirmLoggedInUsers do
|
|||
|
||||
def up do
|
||||
User
|
||||
|> where([u], u.confirmation_pending == true)
|
||||
|> where([u], u.is_confirmed == false)
|
||||
|> join(:inner, [u], t in Token, on: t.user_id == u.id)
|
||||
|> Repo.update_all(set: [confirmation_pending: false])
|
||||
|> Repo.update_all(set: [is_confirmed: true])
|
||||
end
|
||||
|
||||
def down do
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Repo.Migrations.DeprecatePublicEndpoint do
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
with %Pleroma.ConfigDB{} = s3_config <-
|
||||
Pleroma.ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Uploaders.S3}),
|
||||
%Pleroma.ConfigDB{} = upload_config <-
|
||||
Pleroma.ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}) do
|
||||
public_endpoint = s3_config.value[:public_endpoint]
|
||||
|
||||
if !is_nil(public_endpoint) do
|
||||
upload_value = upload_config.value |> Keyword.merge(base_url: public_endpoint)
|
||||
|
||||
upload_config
|
||||
|> Ecto.Changeset.change(value: upload_value)
|
||||
|> Pleroma.Repo.update()
|
||||
|
||||
s3_value = s3_config.value |> Keyword.delete(:public_endpoint)
|
||||
|
||||
s3_config
|
||||
|> Ecto.Changeset.change(value: s3_value)
|
||||
|> Pleroma.Repo.update()
|
||||
end
|
||||
else
|
||||
_ -> :ok
|
||||
end
|
||||
end
|
||||
|
||||
def down do
|
||||
with %Pleroma.ConfigDB{} = upload_config <-
|
||||
Pleroma.ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Upload}),
|
||||
%Pleroma.ConfigDB{} = s3_config <-
|
||||
Pleroma.ConfigDB.get_by_params(%{group: :pleroma, key: Pleroma.Uploaders.S3}) do
|
||||
base_url = upload_config.value[:base_url]
|
||||
|
||||
if !is_nil(base_url) do
|
||||
s3_value = s3_config.value |> Keyword.merge(public_endpoint: base_url)
|
||||
|
||||
s3_config
|
||||
|> Ecto.Changeset.change(value: s3_value)
|
||||
|> Pleroma.Repo.update()
|
||||
|
||||
upload_value = upload_config.value |> Keyword.delete(:base_url)
|
||||
|
||||
upload_config
|
||||
|> Ecto.Changeset.change(value: upload_value)
|
||||
|> Pleroma.Repo.update()
|
||||
end
|
||||
else
|
||||
_ -> :ok
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
# Pleroma: A lightweight social networking server
|
||||
# Copyright © 2017-2021 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Repo.Migrations.UpgradeObanJobsToV9 do
|
||||
use Ecto.Migration
|
||||
|
||||
def up do
|
||||
Oban.Migrations.up(version: 9)
|
||||
end
|
||||
|
||||
def down do
|
||||
Oban.Migrations.down(version: 9)
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue