From 7951fc7469e18014e9bf348c0acb4c7a352f61af Mon Sep 17 00:00:00 2001 From: Filipe Cabaco Date: Wed, 26 Jul 2023 23:53:28 +0100 Subject: [PATCH] fix - Inserts when schema was set was creating issues Due to the schema setup inserts were failing when prefix was not set. --- VERSION | 2 +- lib/logflare/backends/adaptor/postgres_adaptor/pg_repo.ex | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 0fea825bd..b4f409c95 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.3.23 \ No newline at end of file +1.3.24 \ No newline at end of file diff --git a/lib/logflare/backends/adaptor/postgres_adaptor/pg_repo.ex b/lib/logflare/backends/adaptor/postgres_adaptor/pg_repo.ex index c9de133f2..8e90f6852 100644 --- a/lib/logflare/backends/adaptor/postgres_adaptor/pg_repo.ex +++ b/lib/logflare/backends/adaptor/postgres_adaptor/pg_repo.ex @@ -174,7 +174,7 @@ defmodule Logflare.Backends.Adaptor.PostgresAdaptor.PgRepo do Inserts a LogEvent into the given source backend table """ @spec insert_log_event(SourceBackend.t(), LogEvent.t()) :: {:ok, PgLogEvent.t()} - def insert_log_event(source_backend, %LogEvent{} = log_event) do + def insert_log_event(%{config: config} = source_backend, %LogEvent{} = log_event) do repo = get_repo_module(source_backend) table = PostgresAdaptor.table_name(source_backend) @@ -192,7 +192,7 @@ defmodule Logflare.Backends.Adaptor.PostgresAdaptor.PgRepo do changeset = %PgLogEvent{} - |> Ecto.put_meta(source: table) + |> Ecto.put_meta(source: table, prefix: config["schema"]) |> PgLogEvent.changeset(params) repo.insert(changeset)