summaryrefslogtreecommitdiff
path: root/priv/repo
diff options
context:
space:
mode:
Diffstat (limited to 'priv/repo')
-rw-r--r--priv/repo/migrations/20200626163359_rename_notification_privacy_option.exs19
-rw-r--r--priv/repo/migrations/20200630162024_rename_user_settings_col.exs11
-rw-r--r--priv/repo/migrations/20200703101031_add_chat_acceptance_to_users.exs17
-rw-r--r--priv/repo/migrations/20200706060258_remove_tesla_from_config.exs10
-rw-r--r--priv/repo/migrations/20200707112859_instances_add_favicon.exs10
-rw-r--r--priv/repo/migrations/20200708193702_drop_user_trigram_index.exs18
-rw-r--r--priv/repo/migrations/20200714081657_oban_2_0_config_changes.exs27
7 files changed, 112 insertions, 0 deletions
diff --git a/priv/repo/migrations/20200626163359_rename_notification_privacy_option.exs b/priv/repo/migrations/20200626163359_rename_notification_privacy_option.exs
new file mode 100644
index 000000000..06d7f7272
--- /dev/null
+++ b/priv/repo/migrations/20200626163359_rename_notification_privacy_option.exs
@@ -0,0 +1,19 @@
+defmodule Pleroma.Repo.Migrations.RenameNotificationPrivacyOption do
+ use Ecto.Migration
+
+ def up do
+ execute(
+ "UPDATE users SET notification_settings = notification_settings - 'privacy_option' || jsonb_build_object('hide_notification_contents', notification_settings->'privacy_option')
+where notification_settings ? 'privacy_option'
+and local"
+ )
+ end
+
+ def down do
+ execute(
+ "UPDATE users SET notification_settings = notification_settings - 'hide_notification_contents' || jsonb_build_object('privacy_option', notification_settings->'hide_notification_contents')
+where notification_settings ? 'hide_notification_contents'
+and local"
+ )
+ end
+end
diff --git a/priv/repo/migrations/20200630162024_rename_user_settings_col.exs b/priv/repo/migrations/20200630162024_rename_user_settings_col.exs
new file mode 100644
index 000000000..2355eb681
--- /dev/null
+++ b/priv/repo/migrations/20200630162024_rename_user_settings_col.exs
@@ -0,0 +1,11 @@
+defmodule Pleroma.Repo.Migrations.RenameUserSettingsCol do
+ use Ecto.Migration
+
+ def up do
+ rename(table(:users), :settings, to: :mastofe_settings)
+ end
+
+ def down do
+ rename(table(:users), :mastofe_settings, to: :settings)
+ end
+end
diff --git a/priv/repo/migrations/20200703101031_add_chat_acceptance_to_users.exs b/priv/repo/migrations/20200703101031_add_chat_acceptance_to_users.exs
new file mode 100644
index 000000000..8dfda89f1
--- /dev/null
+++ b/priv/repo/migrations/20200703101031_add_chat_acceptance_to_users.exs
@@ -0,0 +1,17 @@
+defmodule Pleroma.Repo.Migrations.AddChatAcceptanceToUsers do
+ use Ecto.Migration
+
+ def up do
+ alter table(:users) do
+ add(:accepts_chat_messages, :boolean, nullable: true)
+ end
+
+ execute("update users set accepts_chat_messages = true where local = true")
+ end
+
+ def down do
+ alter table(:users) do
+ remove(:accepts_chat_messages)
+ end
+ end
+end
diff --git a/priv/repo/migrations/20200706060258_remove_tesla_from_config.exs b/priv/repo/migrations/20200706060258_remove_tesla_from_config.exs
new file mode 100644
index 000000000..798687f8a
--- /dev/null
+++ b/priv/repo/migrations/20200706060258_remove_tesla_from_config.exs
@@ -0,0 +1,10 @@
+defmodule Pleroma.Repo.Migrations.RemoveTeslaFromConfig do
+ use Ecto.Migration
+
+ def up do
+ execute("DELETE FROM config WHERE config.group = ':tesla'")
+ end
+
+ def down do
+ end
+end
diff --git a/priv/repo/migrations/20200707112859_instances_add_favicon.exs b/priv/repo/migrations/20200707112859_instances_add_favicon.exs
new file mode 100644
index 000000000..5538749dc
--- /dev/null
+++ b/priv/repo/migrations/20200707112859_instances_add_favicon.exs
@@ -0,0 +1,10 @@
+defmodule Pleroma.Repo.Migrations.InstancesAddFavicon do
+ use Ecto.Migration
+
+ def change do
+ alter table(:instances) do
+ add(:favicon, :string)
+ add(:favicon_updated_at, :naive_datetime)
+ end
+ end
+end
diff --git a/priv/repo/migrations/20200708193702_drop_user_trigram_index.exs b/priv/repo/migrations/20200708193702_drop_user_trigram_index.exs
new file mode 100644
index 000000000..94efe323a
--- /dev/null
+++ b/priv/repo/migrations/20200708193702_drop_user_trigram_index.exs
@@ -0,0 +1,18 @@
+defmodule Pleroma.Repo.Migrations.DropUserTrigramIndex do
+ @moduledoc "Drops unused trigram index on `users` (FTS index is being used instead)"
+
+ use Ecto.Migration
+
+ def up do
+ drop_if_exists(index(:users, [], name: :users_trigram_index))
+ end
+
+ def down do
+ create_if_not_exists(
+ index(:users, ["(trim(nickname || ' ' || coalesce(name, ''))) gist_trgm_ops"],
+ name: :users_trigram_index,
+ using: :gist
+ )
+ )
+ end
+end
diff --git a/priv/repo/migrations/20200714081657_oban_2_0_config_changes.exs b/priv/repo/migrations/20200714081657_oban_2_0_config_changes.exs
new file mode 100644
index 000000000..c54bb2511
--- /dev/null
+++ b/priv/repo/migrations/20200714081657_oban_2_0_config_changes.exs
@@ -0,0 +1,27 @@
+defmodule Elixir.Pleroma.Repo.Migrations.Oban20ConfigChanges do
+ use Ecto.Migration
+ import Ecto.Query
+ alias Pleroma.ConfigDB
+ alias Pleroma.Repo
+
+ def change do
+ config_entry =
+ from(c in ConfigDB, where: c.group == ^":pleroma" and c.key == ^"Oban")
+ |> select([c], struct(c, [:value, :id]))
+ |> Repo.one()
+
+ if config_entry do
+ %{value: value} = config_entry
+
+ value =
+ case Keyword.fetch(value, :verbose) do
+ {:ok, log} -> Keyword.put_new(value, :log, log)
+ _ -> value
+ end
+ |> Keyword.drop([:verbose, :prune])
+
+ Ecto.Changeset.change(config_entry, %{value: value})
+ |> Repo.update()
+ end
+ end
+end