summaryrefslogtreecommitdiff
path: root/priv/repo
diff options
context:
space:
mode:
authormarcin mikołajczak <git@mkljczk.pl>2024-01-31 22:19:33 +0100
committermarcin mikołajczak <git@mkljczk.pl>2024-01-31 22:19:33 +0100
commit226e53fdd73e95483efec08d11f6fae217b68f45 (patch)
treede3c09b6d5c625d41db8ef6fa54de74f642c2363 /priv/repo
parent9363ef53a34c9d96191bccaece76dd4e01f493b6 (diff)
parent3b9d991514e53ad8f442ffc674dd9b1422fdc415 (diff)
downloadpleroma-226e53fdd73e95483efec08d11f6fae217b68f45.tar.gz
pleroma-226e53fdd73e95483efec08d11f6fae217b68f45.zip
Merge remote-tracking branch 'origin/develop' into status-notification-type
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
Diffstat (limited to 'priv/repo')
-rw-r--r--priv/repo/migrations/20180516144508_add_trigram_extension.exs6
-rw-r--r--priv/repo/migrations/20190710125158_add_following_address_from_source_data.exs2
-rw-r--r--priv/repo/migrations/20191118084500_data_migration_populate_user_relationships.exs2
-rw-r--r--priv/repo/migrations/20200811143147_ap_id_not_null.exs2
-rw-r--r--priv/repo/migrations/20220527134341_add_quote_url_index_to_objects.exs17
-rw-r--r--priv/repo/migrations/20220905011454_generate_unset_user_keys.exs10
-rw-r--r--priv/repo/migrations/20221216052127_add_state_to_backups.exs21
-rw-r--r--priv/repo/migrations/20230306112859_instances_add_metadata.exs14
-rw-r--r--priv/repo/migrations/20230422154018_drop_unused_indexes.exs73
-rw-r--r--priv/repo/migrations/20230504173400_remove_user_ap_enabled.exs13
-rw-r--r--priv/repo/migrations/20231107200724_consolidate_email_queues.exs9
11 files changed, 162 insertions, 7 deletions
diff --git a/priv/repo/migrations/20180516144508_add_trigram_extension.exs b/priv/repo/migrations/20180516144508_add_trigram_extension.exs
index b14104cc4..21ead8758 100644
--- a/priv/repo/migrations/20180516144508_add_trigram_extension.exs
+++ b/priv/repo/migrations/20180516144508_add_trigram_extension.exs
@@ -7,13 +7,13 @@ defmodule Pleroma.Repo.Migrations.AddTrigramExtension do
require Logger
def up do
- Logger.warn("ATTENTION ATTENTION ATTENTION\n")
+ Logger.warning("ATTENTION ATTENTION ATTENTION\n")
- Logger.warn(
+ Logger.warning(
"This will try to create the pg_trgm extension on your database. If your database user does NOT have the necessary rights, you will have to do it manually and re-run the migrations.\nYou can probably do this by running the following:\n"
)
- Logger.warn(
+ Logger.warning(
"sudo -u postgres psql pleroma_dev -c \"create extension if not exists pg_trgm\"\n"
)
diff --git a/priv/repo/migrations/20190710125158_add_following_address_from_source_data.exs b/priv/repo/migrations/20190710125158_add_following_address_from_source_data.exs
index 44a3d6d2d..3a1bf677b 100644
--- a/priv/repo/migrations/20190710125158_add_following_address_from_source_data.exs
+++ b/priv/repo/migrations/20190710125158_add_following_address_from_source_data.exs
@@ -26,7 +26,7 @@ defmodule Pleroma.Repo.Migrations.AddFollowingAddressFromSourceData do
|> Pleroma.Repo.update()
user ->
- Logger.warn("User #{user.id} / #{user.nickname} does not seem to have source_data")
+ Logger.warning("User #{user.id} / #{user.nickname} does not seem to have source_data")
end)
end
end
diff --git a/priv/repo/migrations/20191118084500_data_migration_populate_user_relationships.exs b/priv/repo/migrations/20191118084500_data_migration_populate_user_relationships.exs
index 571a75160..6fa671a79 100644
--- a/priv/repo/migrations/20191118084500_data_migration_populate_user_relationships.exs
+++ b/priv/repo/migrations/20191118084500_data_migration_populate_user_relationships.exs
@@ -63,7 +63,7 @@ defmodule Pleroma.Repo.Migrations.DataMigrationPopulateUserRelationships do
ON CONFLICT (source_id, relationship_type, target_id) DO NOTHING
""")
else
- _ -> Logger.warn("Unresolved #{field} reference: (#{source_uuid}, #{target_id})")
+ _ -> Logger.warning("Unresolved #{field} reference: (#{source_uuid}, #{target_id})")
end
end
end
diff --git a/priv/repo/migrations/20200811143147_ap_id_not_null.exs b/priv/repo/migrations/20200811143147_ap_id_not_null.exs
index a160daef4..dbc226663 100644
--- a/priv/repo/migrations/20200811143147_ap_id_not_null.exs
+++ b/priv/repo/migrations/20200811143147_ap_id_not_null.exs
@@ -8,7 +8,7 @@ defmodule Pleroma.Repo.Migrations.ApIdNotNull do
require Logger
def up do
- Logger.warn(
+ Logger.warning(
"If this migration fails please open an issue at https://git.pleroma.social/pleroma/pleroma/-/issues/new \n"
)
diff --git a/priv/repo/migrations/20220527134341_add_quote_url_index_to_objects.exs b/priv/repo/migrations/20220527134341_add_quote_url_index_to_objects.exs
new file mode 100644
index 000000000..d77db34cd
--- /dev/null
+++ b/priv/repo/migrations/20220527134341_add_quote_url_index_to_objects.exs
@@ -0,0 +1,17 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Repo.Migrations.AddQuoteUrlIndexToObjects do
+ use Ecto.Migration
+ @disable_ddl_transaction true
+
+ def change do
+ create_if_not_exists(
+ index(:objects, ["(data->'quoteUrl')"],
+ name: :objects_quote_url,
+ concurrently: true
+ )
+ )
+ end
+end
diff --git a/priv/repo/migrations/20220905011454_generate_unset_user_keys.exs b/priv/repo/migrations/20220905011454_generate_unset_user_keys.exs
index 43bc7100b..580c38841 100644
--- a/priv/repo/migrations/20220905011454_generate_unset_user_keys.exs
+++ b/priv/repo/migrations/20220905011454_generate_unset_user_keys.exs
@@ -2,12 +2,20 @@
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
+defmodule User do
+ use Ecto.Schema
+
+ schema "users" do
+ field(:keys, :string)
+ field(:local, :boolean, default: true)
+ end
+end
+
defmodule Pleroma.Repo.Migrations.GenerateUnsetUserKeys do
use Ecto.Migration
import Ecto.Query
alias Pleroma.Keys
alias Pleroma.Repo
- alias Pleroma.User
def change do
query =
diff --git a/priv/repo/migrations/20221216052127_add_state_to_backups.exs b/priv/repo/migrations/20221216052127_add_state_to_backups.exs
new file mode 100644
index 000000000..73b30fc35
--- /dev/null
+++ b/priv/repo/migrations/20221216052127_add_state_to_backups.exs
@@ -0,0 +1,21 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Repo.Migrations.AddStateToBackups do
+ use Ecto.Migration
+
+ def up do
+ alter table(:backups) do
+ add(:state, :integer, default: 5)
+ add(:processed_number, :integer, default: 0)
+ end
+ end
+
+ def down do
+ alter table(:backups) do
+ remove(:state)
+ remove(:processed_number)
+ end
+ end
+end
diff --git a/priv/repo/migrations/20230306112859_instances_add_metadata.exs b/priv/repo/migrations/20230306112859_instances_add_metadata.exs
new file mode 100644
index 000000000..898f5220e
--- /dev/null
+++ b/priv/repo/migrations/20230306112859_instances_add_metadata.exs
@@ -0,0 +1,14 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2023 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Repo.Migrations.InstancesAddMetadata do
+ use Ecto.Migration
+
+ def change do
+ alter table(:instances) do
+ add(:metadata, :map)
+ add(:metadata_updated_at, :utc_datetime)
+ end
+ end
+end
diff --git a/priv/repo/migrations/20230422154018_drop_unused_indexes.exs b/priv/repo/migrations/20230422154018_drop_unused_indexes.exs
new file mode 100644
index 000000000..0d877a798
--- /dev/null
+++ b/priv/repo/migrations/20230422154018_drop_unused_indexes.exs
@@ -0,0 +1,73 @@
+defmodule Pleroma.Repo.Migrations.DropUnusedIndexes do
+ use Ecto.Migration
+
+ @disable_ddl_transaction true
+ @disable_migration_lock true
+
+ def up do
+ drop_if_exists(
+ index(:activities, ["(data->>'actor')", "inserted_at desc"], name: :activities_actor_index)
+ )
+
+ drop_if_exists(index(:activities, ["(data->'to')"], name: :activities_to_index))
+
+ drop_if_exists(index(:activities, ["(data->'cc')"], name: :activities_cc_index))
+
+ drop_if_exists(index(:activities, ["(split_part(actor, '/', 3))"], name: :activities_hosts))
+
+ drop_if_exists(
+ index(:activities, ["(data->'object'->>'inReplyTo')"], name: :activities_in_reply_to)
+ )
+
+ drop_if_exists(
+ index(:activities, ["((data #> '{\"object\",\"likes\"}'))"], name: :activities_likes)
+ )
+ end
+
+ def down do
+ create_if_not_exists(
+ index(:activities, ["(data->>'actor')", "inserted_at desc"],
+ name: :activities_actor_index,
+ concurrently: true
+ )
+ )
+
+ create_if_not_exists(
+ index(:activities, ["(data->'to')"],
+ name: :activities_to_index,
+ using: :gin,
+ concurrently: true
+ )
+ )
+
+ create_if_not_exists(
+ index(:activities, ["(data->'cc')"],
+ name: :activities_cc_index,
+ using: :gin,
+ concurrently: true
+ )
+ )
+
+ create_if_not_exists(
+ index(:activities, ["(split_part(actor, '/', 3))"],
+ name: :activities_hosts,
+ concurrently: true
+ )
+ )
+
+ create_if_not_exists(
+ index(:activities, ["(data->'object'->>'inReplyTo')"],
+ name: :activities_in_reply_to,
+ concurrently: true
+ )
+ )
+
+ create_if_not_exists(
+ index(:activities, ["((data #> '{\"object\",\"likes\"}'))"],
+ name: :activities_likes,
+ using: :gin,
+ concurrently: true
+ )
+ )
+ end
+end
diff --git a/priv/repo/migrations/20230504173400_remove_user_ap_enabled.exs b/priv/repo/migrations/20230504173400_remove_user_ap_enabled.exs
new file mode 100644
index 000000000..0aea41324
--- /dev/null
+++ b/priv/repo/migrations/20230504173400_remove_user_ap_enabled.exs
@@ -0,0 +1,13 @@
+# Pleroma: A lightweight social networking server
+# Copyright © 2017-2023 Pleroma Authors <https://pleroma.social/>
+# SPDX-License-Identifier: AGPL-3.0-only
+
+defmodule Pleroma.Repo.Migrations.RemoveUserApEnabled do
+ use Ecto.Migration
+
+ def change do
+ alter table(:users) do
+ remove(:ap_enabled, :boolean, default: false, null: false)
+ end
+ end
+end
diff --git a/priv/repo/migrations/20231107200724_consolidate_email_queues.exs b/priv/repo/migrations/20231107200724_consolidate_email_queues.exs
new file mode 100644
index 000000000..63f5af369
--- /dev/null
+++ b/priv/repo/migrations/20231107200724_consolidate_email_queues.exs
@@ -0,0 +1,9 @@
+defmodule Pleroma.Repo.Migrations.ConsolidateEmailQueues do
+ use Ecto.Migration
+
+ def change do
+ execute(
+ "UPDATE oban_jobs SET queue = 'mailer' WHERE queue in ('digest_emails', 'new_users_digest')"
+ )
+ end
+end