diff options
author | Alex Gleason <alex@alexgleason.me> | 2021-12-27 18:01:25 -0600 |
---|---|---|
committer | Alex Gleason <alex@alexgleason.me> | 2021-12-27 18:01:25 -0600 |
commit | f5c3d45120364681b3601baa36a0ce9fa22680d7 (patch) | |
tree | 5f1379ca293a001111585849521615d69880b7cb /priv/repo | |
parent | 3117c6099733207b7f2a777f8cb8b5b3b839ebe8 (diff) | |
parent | 264f0fde1b9f0cbaf7679eeb59938eb9ca653779 (diff) | |
download | pleroma-f5c3d45120364681b3601baa36a0ce9fa22680d7.tar.gz |
Merge remote-tracking branch 'origin/develop' into apps-api-endpoint
Diffstat (limited to 'priv/repo')
8 files changed, 66 insertions, 6 deletions
diff --git a/priv/repo/migrations/20171212164525_fill_recipients_in_activities.exs b/priv/repo/migrations/20171212164525_fill_recipients_in_activities.exs index 6dfa93716..77a09781c 100644 --- a/priv/repo/migrations/20171212164525_fill_recipients_in_activities.exs +++ b/priv/repo/migrations/20171212164525_fill_recipients_in_activities.exs @@ -14,9 +14,7 @@ defmodule Pleroma.Repo.Migrations.FillRecipientsInActivities do max = min + 10_000 execute(""" - update activities set recipients = array(select jsonb_array_elements_text(data->'to')) where id > #{ - min - } and id <= #{max}; + update activities set recipients = array(select jsonb_array_elements_text(data->'to')) where id > #{min} and id <= #{max}; """) |> IO.inspect() end) diff --git a/priv/repo/migrations/20200428221338_insert_skeletons_for_deleted_users.exs b/priv/repo/migrations/20200428221338_insert_skeletons_for_deleted_users.exs index 2adc38186..81f941198 100644 --- a/priv/repo/migrations/20200428221338_insert_skeletons_for_deleted_users.exs +++ b/priv/repo/migrations/20200428221338_insert_skeletons_for_deleted_users.exs @@ -28,9 +28,7 @@ defmodule Pleroma.Repo.Migrations.InsertSkeletonsForDeletedUsers do {:ok, %{rows: ap_ids}} = Ecto.Adapters.SQL.query( Repo, - "select distinct unnest(nonexistent_locals.recipients) from activities, lateral (select array_agg(recipient) as recipients from unnest(activities.recipients) as recipient where recipient similar to '#{ - instance_uri - }/users/[A-Za-z0-9]*' and not(recipient in (select ap_id from users))) nonexistent_locals;", + "select distinct unnest(nonexistent_locals.recipients) from activities, lateral (select array_agg(recipient) as recipients from unnest(activities.recipients) as recipient where recipient similar to '#{instance_uri}/users/[A-Za-z0-9]*' and not(recipient in (select ap_id from users))) nonexistent_locals;", [], timeout: :infinity ) diff --git a/priv/repo/migrations/20210416051708_remove_mastofe_settings_from_users.exs b/priv/repo/migrations/20210416051708_remove_mastofe_settings_from_users.exs new file mode 100644 index 000000000..a8d7306bd --- /dev/null +++ b/priv/repo/migrations/20210416051708_remove_mastofe_settings_from_users.exs @@ -0,0 +1,9 @@ +defmodule Pleroma.Repo.Migrations.RemoveMastofeSettingsFromUsers do + use Ecto.Migration + + def change do + alter table(:users) do + remove_if_exists(:mastofe_settings, :map) + end + end +end diff --git a/priv/repo/migrations/20211121000000_create_user_notes.exs b/priv/repo/migrations/20211121000000_create_user_notes.exs new file mode 100644 index 000000000..b75e11695 --- /dev/null +++ b/priv/repo/migrations/20211121000000_create_user_notes.exs @@ -0,0 +1,15 @@ +defmodule Pleroma.Repo.Migrations.CreateUserNotes do + use Ecto.Migration + + def change do + create_if_not_exists table(:user_notes) do + add(:source_id, references(:users, type: :uuid, on_delete: :delete_all)) + add(:target_id, references(:users, type: :uuid, on_delete: :delete_all)) + add(:comment, :string) + + timestamps() + end + + create_if_not_exists(unique_index(:user_notes, [:source_id, :target_id])) + end +end diff --git a/priv/repo/migrations/20211125110126_force_pinned_objects_to_exist.exs b/priv/repo/migrations/20211125110126_force_pinned_objects_to_exist.exs new file mode 100644 index 000000000..1fe9271f0 --- /dev/null +++ b/priv/repo/migrations/20211125110126_force_pinned_objects_to_exist.exs @@ -0,0 +1,11 @@ +defmodule Pleroma.Repo.Migrations.ForcePinnedObjectsToExist do + use Ecto.Migration + + def change do + execute("UPDATE users SET pinned_objects = '{}' WHERE pinned_objects IS NULL") + + alter table("users") do + modify(:pinned_objects, :map, null: false, default: %{}) + end + end +end diff --git a/priv/repo/migrations/20211126191138_add_suggestions.exs b/priv/repo/migrations/20211126191138_add_suggestions.exs new file mode 100644 index 000000000..7cc67d8ef --- /dev/null +++ b/priv/repo/migrations/20211126191138_add_suggestions.exs @@ -0,0 +1,11 @@ +defmodule Pleroma.Repo.Migrations.AddSuggestions do + use Ecto.Migration + + def change do + alter table(:users) do + add(:is_suggested, :boolean, default: false, null: false) + end + + create_if_not_exists(index(:users, [:is_suggested])) + end +end diff --git a/priv/repo/migrations/20211222165256_add_last_status_at_to_users.exs b/priv/repo/migrations/20211222165256_add_last_status_at_to_users.exs new file mode 100644 index 000000000..906178216 --- /dev/null +++ b/priv/repo/migrations/20211222165256_add_last_status_at_to_users.exs @@ -0,0 +1,11 @@ +defmodule Pleroma.Repo.Migrations.AddLastStatusAtToUsers do + use Ecto.Migration + + def change do + alter table(:users) do + add(:last_status_at, :naive_datetime) + end + + create_if_not_exists(index(:users, [:last_status_at])) + end +end diff --git a/priv/repo/migrations/20211225154802_add_is_discoverable_index_to_users.exs b/priv/repo/migrations/20211225154802_add_is_discoverable_index_to_users.exs new file mode 100644 index 000000000..9f8f52b65 --- /dev/null +++ b/priv/repo/migrations/20211225154802_add_is_discoverable_index_to_users.exs @@ -0,0 +1,7 @@ +defmodule Pleroma.Repo.Migrations.AddIsDiscoverableIndexToUsers do + use Ecto.Migration + + def change do + create(index(:users, [:is_discoverable])) + end +end |