View Source Electric.Postgres.Configuration (electric v0.9.5)

Module for functions that configure Postgres in some way using a provided connection.

Summary

Functions

Ensure that all tables are configured for replication.

Drops all tables from the given publication.

Types

@type filter() :: String.t() | nil
@type filters() :: %{required(Electric.relation()) => filter()}

Functions

Link to this function

configure_tables_for_replication!(pool, relations, get_pg_version, publication_name)

View Source
@spec configure_tables_for_replication!(
  Postgrex.conn(),
  [Electric.Shapes.Shape.table_with_where_clause()],
  (-> String.t()),
  float()
) :: {:ok, [:ok]}

Ensure that all tables are configured for replication.

Table is considered configured for replication when it's REPLICA IDENTITY is set to FULL and it's added to the specified publication.

Important: this function should not be ran in a transaction, because it starts multiple internal transactions that are sometimes expected to fail.

Raises if it fails to configure all the tables in the expected way.

Link to this function

drop_all_publication_tables(conn, publication_name)

View Source
@spec drop_all_publication_tables(Postgrex.conn(), String.t()) :: Postgrex.Result.t()

Drops all tables from the given publication.