From c94c6eac22663a46d8c2822953e3b8b959a3d1fb Mon Sep 17 00:00:00 2001 From: floatingghost Date: Mon, 5 Dec 2022 12:58:48 +0000 Subject: Remerge of hashtag following (#341) this time with less idiot Co-authored-by: FloatingGhost Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/341 Signed-off-by: mkljczk --- .../migrations/20221203232118_add_user_follows_hashtag.exs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 priv/repo/migrations/20221203232118_add_user_follows_hashtag.exs (limited to 'priv') diff --git a/priv/repo/migrations/20221203232118_add_user_follows_hashtag.exs b/priv/repo/migrations/20221203232118_add_user_follows_hashtag.exs new file mode 100644 index 000000000..27fff2586 --- /dev/null +++ b/priv/repo/migrations/20221203232118_add_user_follows_hashtag.exs @@ -0,0 +1,12 @@ +defmodule Pleroma.Repo.Migrations.AddUserFollowsHashtag do + use Ecto.Migration + + def change do + create table(:user_follows_hashtag) do + add(:hashtag_id, references(:hashtags)) + add(:user_id, references(:users, type: :uuid, on_delete: :delete_all)) + end + + create(unique_index(:user_follows_hashtag, [:user_id, :hashtag_id])) + end +end -- cgit v1.2.3 From aa74c87443230921aadf6022b13eb9e44a031d95 Mon Sep 17 00:00:00 2001 From: mkljczk Date: Mon, 30 Dec 2024 22:41:53 +0100 Subject: fix tests Signed-off-by: mkljczk --- priv/repo/migrations/20221203232118_add_user_follows_hashtag.exs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'priv') diff --git a/priv/repo/migrations/20221203232118_add_user_follows_hashtag.exs b/priv/repo/migrations/20221203232118_add_user_follows_hashtag.exs index 27fff2586..2b5ae91be 100644 --- a/priv/repo/migrations/20221203232118_add_user_follows_hashtag.exs +++ b/priv/repo/migrations/20221203232118_add_user_follows_hashtag.exs @@ -8,5 +8,7 @@ defmodule Pleroma.Repo.Migrations.AddUserFollowsHashtag do end create(unique_index(:user_follows_hashtag, [:user_id, :hashtag_id])) + + create_if_not_exists(index(:user_follows_hashtag, [:hashtag_id])) end end -- cgit v1.2.3