Skip to content

Commit

Permalink
fix: Prefix replication slot and publication name
Browse files Browse the repository at this point in the history
To make it easier to manage supabase specific elements we're adding the prefix supabase to the replication slot and publication
  • Loading branch information
filipecabaco committed Jan 22, 2025
1 parent 5f1c769 commit 11298b9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/realtime/tenants/replication_connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -349,11 +349,11 @@ defmodule Realtime.Tenants.ReplicationConnection do
end

def publication_name(%__MODULE__{table: table, schema: schema}) do
"#{schema}_#{table}_publication_#{slot_suffix()}"
"supabase_#{schema}_#{table}_publication_#{slot_suffix()}"
end

def replication_slot_name(%__MODULE__{table: table, schema: schema}) do
"#{schema}_#{table}_replication_slot_#{slot_suffix()}"
"supabase_#{schema}_#{table}_replication_slot_#{slot_suffix()}"
end

defp slot_suffix(), do: Application.get_env(:realtime, :slot_name_suffix)
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Realtime.MixProject do
def project do
[
app: :realtime,
version: "2.34.1",
version: "2.34.2",
elixir: "~> 1.17.3",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
Expand Down
2 changes: 1 addition & 1 deletion test/realtime_web/controllers/tenant_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ defmodule RealtimeWeb.TenantControllerTest do

{:ok, db_conn} = Database.connect(tenant, "realtime_test", :stop)

assert %{rows: [["realtime_messages_replication_slot_"]]} =
assert %{rows: [["supabase_srealtime_messages_replication_slot_"]]} =
Postgrex.query!(db_conn, "SELECT slot_name FROM pg_replication_slots", [])

conn = delete(conn, Routes.tenant_path(conn, :delete, tenant.external_id))
Expand Down

0 comments on commit 11298b9

Please sign in to comment.