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

Hasura.RQL.DDL.Schema.Rename

Description

Functions for updating the metadata (with integrity checking) to incorporate schema changes discovered after applying a user-supplied SQL query. None of these functions modify the schema cache, so it must be reloaded after the metadata is updated.

Synopsis

Documentation

renameTableInMetadata :: forall b m. (MonadError QErr m, CacheRM m, MonadWriter MetadataModifier m, BackendMetadata b) => SourceName -> TableName b -> TableName b -> m () Source #

Replace all references to a given table name by its new name across the entire metadata.

This function will make use of the metadata dependency graph (see getDependentObjs) to identify all places that refer to the old table name, and replace it accordingly. Most operations will occur within the same source, such as table references in relationships and permissions. Dependencies across sources can happen in the case of cross-source relationships.

This function will fail if it encounters a nonsensical dependency; for instance, if there's a dependency from that table to a source.

For more information about the dependency graph, see SchemaObjId.

renameColumnInMetadata :: forall b m. (MonadError QErr m, CacheRM m, MonadWriter MetadataModifier m, BackendMetadata b) => Column b -> Column b -> SourceName -> TableName b -> FieldInfoMap (FieldInfo b) -> m () Source #

Replace all references to a given column name by its new name across the entire metadata.

This function will make use of the metadata dependency graph (see getDependentObjs) to identify all places that refer to the old column name, and replace it accordingly. Most operations will occur within the same source, such as column references in relationships and permissions. Dependencies across sources can happen in the case of cross-source relationships.

This function will fail if it encounters a nonsensical dependency; for instance, if there's a dependency from that table to a source.

For more information about the dependency graph, see SchemaObjId.