diff --git a/lib/realtime/tenants/migrations.ex b/lib/realtime/tenants/migrations.ex index 4a592429d..822c5e1ff 100644 --- a/lib/realtime/tenants/migrations.ex +++ b/lib/realtime/tenants/migrations.ex @@ -66,7 +66,8 @@ defmodule Realtime.Tenants.Migrations do UuidAutoGeneration, MessagesPartitioning, MessagesUsingUuid, - FixSendFunction + FixSendFunction, + RecreateEntityIndexUsingBtree } @migrations [ @@ -122,7 +123,8 @@ defmodule Realtime.Tenants.Migrations do {20_241_019_105_805, UuidAutoGeneration}, {20_241_030_150_047, MessagesPartitioning}, {20_241_108_114_728, MessagesUsingUuid}, - {20_241_121_104_152, FixSendFunction} + {20_241_121_104_152, FixSendFunction}, + {20_241_130_184_212, RecreateEntityIndexUsingBtree} ] defstruct [:tenant_external_id, :settings] diff --git a/lib/realtime/tenants/repo/migrations/20241130184212_recreate_entity_index_using_btree.ex b/lib/realtime/tenants/repo/migrations/20241130184212_recreate_entity_index_using_btree.ex new file mode 100644 index 000000000..3684632a8 --- /dev/null +++ b/lib/realtime/tenants/repo/migrations/20241130184212_recreate_entity_index_using_btree.ex @@ -0,0 +1,18 @@ +defmodule Realtime.Tenants.Migrations.RecreateEntityIndexUsingBtree do + @moduledoc false + use Ecto.Migration + + def change do + execute("drop index if exists \"realtime\".\"ix_realtime_subscription_entity\"") + + execute(""" + do $$ + begin + create index concurrently if not exists ix_realtime_subscription_entity on realtime.subscription using btree (entity); + exception + when others then + create index if not exists ix_realtime_subscription_entity on realtime.subscription using btree (entity); + end$$; + """) + end +end diff --git a/mix.exs b/mix.exs index 8eda3f8a1..6d9d5ee25 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule Realtime.MixProject do def project do [ app: :realtime, - version: "2.33.60", + version: "2.33.61", elixir: "~> 1.17.3", elixirc_paths: elixirc_paths(Mix.env()), start_permanent: Mix.env() == :prod,