Electric.Postgres.Configuration (electric v1.0.22)
View SourceModule for functions that configure Postgres in some way using a provided connection.
Summary
Functions
Configure the publication to include all relevant tables, also setting table identity to FULL
if necessary. Return a list of tables that could not be configured.
Get Postgres server version
Types
@type filters() :: %{ required(Electric.oid_relation()) => Electric.Replication.PublicationManager.RelationFilter.t() }
Functions
@spec configure_publication!( Postgrex.conn(), [Electric.oid_relation()], filters(), non_neg_integer(), String.t() ) :: relations_failed_to_configure when relations_failed_to_configure: [Electric.oid_relation()]
Configure the publication to include all relevant tables, also setting table identity to FULL
if necessary. Return a list of tables that could not be configured.
Any tables that were previously configured but were either renamed or dropped will not be automatically re-added to the publication. Mentioned tables that have been renamed or dropped will be returned as a list.
previous_relations
argument is used to figure out renamed/dropped table based on table OIDs.
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.
@spec get_pg_version(Postgrex.conn()) :: {:ok, non_neg_integer()} | {:error, term()}
Get Postgres server version
@spec get_publication_tables(Postgrex.conn(), String.t()) :: [Electric.relation()]