graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hasura.Backends.Postgres.DDL.Source

Description

Postgres DDL Source

A Source is a connected database. One can have multiple sources of the same kind (e.g. Postgres).

This module provides ways to fetch, update, and deal with table and function metadata and hdb_catalog migrations for a Postgres Source.

NOTE: Please have a look at the `serverdocumentationmigration-guidelines.md` before adding any new migration if you haven't already looked at it.

Synopsis

Documentation

class ToMetadataFetchQuery (pgKind :: PostgresKind) Source #

We differentiate the handling of metadata between Citus, Cockroach and Vanilla Postgres because Citus imposes limitations on the types of joins that it permits, which then limits the types of relations that we can track.

Minimal complete definition

tableMetadata

logPGSourceCatalogMigrationLockedQueries :: MonadIO m => Logger Hasura -> PGSourceConfig -> m Void Source #

logPGSourceCatalogMigrationLockedQueries as the name suggests logs the queries which are blocking in the database. This function is called asynchronously from initCatalogIfNeeded while the source catalog is being migrated. NOTE: When there are no locking queries present in the database, nothing will be logged.

prepareCatalog :: (MonadIO m, MonadBaseControl IO m) => SourceConfig ('Postgres pgKind) -> ExceptT QErr m (RecreateEventTriggers, SourceCatalogMigrationState) Source #

Initialise catalog tables for a source, including those required by the event delivery subsystem.

class FetchTableMetadata (pgKind :: PostgresKind) where Source #

We differentiate for CockroachDB and other PG implementations as our CockroachDB table fetching SQL does not require table information, and fails if it receives unused prepared arguments this distinction should no longer be necessary if this issue is resolved: https://github.com/cockroachdb/cockroach/issues/86375

pgFetchTableMetadata :: forall pgKind m. (Backend ('Postgres pgKind), ToMetadataFetchQuery pgKind, MonadTx m) => HashSet QualifiedTable -> m (DBTablesMetadata ('Postgres pgKind)) Source #

Fetch Postgres metadata of all user tables

postDropSourceHook :: (MonadIO m, MonadError QErr m, MonadBaseControl IO m) => SourceConfig ('Postgres pgKind) -> TableEventTriggers ('Postgres pgKind) -> m () Source #

Clean source database after dropping in metadata