mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-17 12:31:52 +03:00
bacadc30da
## Remaining Work - [x] changelog entry - [x] more tests: `<backend>_delete_remote_relationship` is definitely untested - [x] negative tests: we probably want to assert that there are some APIs we DON'T support - [x] update the console to use the new API, if necessary - [x] ~~adding the corresponding documentation for the API for other backends (only `pg_` was added here)~~ - deferred to https://github.com/hasura/graphql-engine-mono/issues/3170 - [x] ~~deciding which backends should support this API~~ - deferred to https://github.com/hasura/graphql-engine-mono/issues/3170 - [x] ~~deciding what to do about potentially overlapping schematic representations~~ - ~~cf. https://github.com/hasura/graphql-engine-mono/pull/3157#issuecomment-995307624~~ - deferred to https://github.com/hasura/graphql-engine-mono/issues/3171 - [x] ~~add more descriptive versioning information to some of the types that are changing in this PR~~ - cf. https://github.com/hasura/graphql-engine-mono/pull/3157#discussion_r769830920 - deferred to https://github.com/hasura/graphql-engine-mono/issues/3172 ## Description This PR fixes several important issues wrt. the remote relationship API. - it fixes a regression introduced by [#3124](https://github.com/hasura/graphql-engine-mono/pull/3124), which prevented `<backend>_create_remote_relationship` from accepting the old argument format (break of backwards compatibility, broke the console) - it removes the command `create_remote_relationship` added to the v1/metadata API as a work-around as part of [#3124](https://github.com/hasura/graphql-engine-mono/pull/3124) - it reverts the subsequent fix in the console: [#3149](https://github.com/hasura/graphql-engine-mono/pull/3149) Furthermore, this PR also addresses two other issues: - THE DOCUMENTATION OF THE METADATA API WAS WRONG, and documented `create_remote_relationship` instead of `<backend>_create_remote_relationship`: this PR fixes this by adding `pg_` everywhere, but does not attempt to add the corresponding documentation for other backends, partly because: - `<backend>_delete_remote_relationship` WAS BROKEN ON NON-POSTGRES BACKENDS; it always expected an argument parameterized by Postgres. As of main, the `<backend>_(create|update|delete)_remote_relationship` commands are supported on Postgres, Citus, BigQuery, but **NOT MSSQL**. I do not know if this is intentional or not, if it even should be publicized or not, and as a result this PR doesn't change this. PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3157 Co-authored-by: jkachmar <8461423+jkachmar@users.noreply.github.com> GitOrigin-RevId: 37e2f41522a9229a11c595574c3f4984317d652a
139 lines
5.4 KiB
Haskell
139 lines
5.4 KiB
Haskell
module Hasura.Server.API.Metadata
|
|
( RQLMetadataV1 (..),
|
|
)
|
|
where
|
|
|
|
import Hasura.RQL.DDL.Action
|
|
import Hasura.RQL.DDL.ComputedField
|
|
import Hasura.RQL.DDL.EventTrigger
|
|
import Hasura.RQL.DDL.Metadata
|
|
import Hasura.RQL.DDL.Permission
|
|
import Hasura.RQL.DDL.QueryCollection
|
|
import Hasura.RQL.DDL.QueryTags
|
|
import Hasura.RQL.DDL.Relationship
|
|
import Hasura.RQL.DDL.Relationship.Rename
|
|
import Hasura.RQL.DDL.RemoteRelationship
|
|
import Hasura.RQL.DDL.Schema
|
|
import Hasura.RQL.DDL.Schema.Source
|
|
import Hasura.RQL.Types
|
|
import Hasura.SQL.AnyBackend
|
|
|
|
data RQLMetadataV1
|
|
= -- Sources
|
|
RMAddSource !(AnyBackend AddSource)
|
|
| RMDropSource DropSource
|
|
| RMRenameSource !RenameSource
|
|
| -- Tables
|
|
RMTrackTable !(AnyBackend TrackTableV2)
|
|
| RMUntrackTable !(AnyBackend UntrackTable)
|
|
| RMSetTableCustomization !(AnyBackend SetTableCustomization)
|
|
| -- Tables (PG-specific)
|
|
RMPgSetTableIsEnum !SetTableIsEnum
|
|
| -- Tables permissions
|
|
RMCreateInsertPermission !(AnyBackend (CreatePerm InsPerm))
|
|
| RMCreateSelectPermission !(AnyBackend (CreatePerm SelPerm))
|
|
| RMCreateUpdatePermission !(AnyBackend (CreatePerm UpdPerm))
|
|
| RMCreateDeletePermission !(AnyBackend (CreatePerm DelPerm))
|
|
| RMDropInsertPermission !(AnyBackend (DropPerm InsPerm))
|
|
| RMDropSelectPermission !(AnyBackend (DropPerm SelPerm))
|
|
| RMDropUpdatePermission !(AnyBackend (DropPerm UpdPerm))
|
|
| RMDropDeletePermission !(AnyBackend (DropPerm DelPerm))
|
|
| RMSetPermissionComment !(AnyBackend SetPermComment)
|
|
| -- Tables relationships
|
|
RMCreateObjectRelationship !(AnyBackend CreateObjRel)
|
|
| RMCreateArrayRelationship !(AnyBackend CreateArrRel)
|
|
| RMDropRelationship !(AnyBackend DropRel)
|
|
| RMSetRelationshipComment !(AnyBackend SetRelComment)
|
|
| RMRenameRelationship !(AnyBackend RenameRel)
|
|
| -- Tables remote relationships
|
|
RMCreateRemoteRelationship !(AnyBackend CreateFromSourceRelationship)
|
|
| RMUpdateRemoteRelationship !(AnyBackend CreateFromSourceRelationship)
|
|
| RMDeleteRemoteRelationship !(AnyBackend DeleteFromSourceRelationship)
|
|
| -- Functions
|
|
RMTrackFunction !(AnyBackend TrackFunctionV2)
|
|
| RMUntrackFunction !(AnyBackend UnTrackFunction)
|
|
| RMSetFunctionCustomization (AnyBackend SetFunctionCustomization)
|
|
| -- Functions permissions
|
|
RMCreateFunctionPermission !(AnyBackend FunctionPermissionArgument)
|
|
| RMDropFunctionPermission !(AnyBackend FunctionPermissionArgument)
|
|
| -- Computed fields (PG-specific)
|
|
RMAddComputedField !(AddComputedField ('Postgres 'Vanilla))
|
|
| RMDropComputedField !(DropComputedField ('Postgres 'Vanilla))
|
|
| -- Tables event triggers
|
|
RMCreateEventTrigger !(AnyBackend CreateEventTriggerQuery)
|
|
| RMDeleteEventTrigger !(AnyBackend DeleteEventTriggerQuery)
|
|
| RMRedeliverEvent !(AnyBackend RedeliverEventQuery)
|
|
| RMInvokeEventTrigger !(AnyBackend InvokeEventTriggerQuery)
|
|
| -- Remote schemas
|
|
RMAddRemoteSchema !AddRemoteSchemaQuery
|
|
| RMUpdateRemoteSchema !AddRemoteSchemaQuery
|
|
| RMRemoveRemoteSchema !RemoteSchemaNameQuery
|
|
| RMReloadRemoteSchema !RemoteSchemaNameQuery
|
|
| RMIntrospectRemoteSchema !RemoteSchemaNameQuery
|
|
| -- Remote schemas permissions
|
|
RMAddRemoteSchemaPermissions !AddRemoteSchemaPermission
|
|
| RMDropRemoteSchemaPermissions !DropRemoteSchemaPermissions
|
|
| -- Scheduled triggers
|
|
RMCreateCronTrigger !CreateCronTrigger
|
|
| RMDeleteCronTrigger !ScheduledTriggerName
|
|
| RMCreateScheduledEvent !CreateScheduledEvent
|
|
| RMDeleteScheduledEvent !DeleteScheduledEvent
|
|
| RMGetScheduledEvents !GetScheduledEvents
|
|
| RMGetEventInvocations !GetEventInvocations
|
|
| -- Actions
|
|
RMCreateAction !CreateAction
|
|
| RMDropAction !DropAction
|
|
| RMUpdateAction !UpdateAction
|
|
| RMCreateActionPermission !CreateActionPermission
|
|
| RMDropActionPermission !DropActionPermission
|
|
| -- Query collections, allow list related
|
|
RMCreateQueryCollection !CreateCollection
|
|
| RMDropQueryCollection !DropCollection
|
|
| RMAddQueryToCollection !AddQueryToCollection
|
|
| RMDropQueryFromCollection !DropQueryFromCollection
|
|
| RMAddCollectionToAllowlist !CollectionReq
|
|
| RMDropCollectionFromAllowlist !CollectionReq
|
|
| -- Rest endpoints
|
|
RMCreateRestEndpoint !CreateEndpoint
|
|
| RMDropRestEndpoint !DropEndpoint
|
|
| -- Custom types
|
|
RMSetCustomTypes !CustomTypes
|
|
| -- Api limits
|
|
RMSetApiLimits !ApiLimit
|
|
| RMRemoveApiLimits
|
|
| -- Metrics config
|
|
RMSetMetricsConfig !MetricsConfig
|
|
| RMRemoveMetricsConfig
|
|
| -- Inherited roles
|
|
RMAddInheritedRole !InheritedRole
|
|
| RMDropInheritedRole !DropInheritedRole
|
|
| -- Metadata management
|
|
RMReplaceMetadata !ReplaceMetadata
|
|
| RMExportMetadata !ExportMetadata
|
|
| RMClearMetadata !ClearMetadata
|
|
| RMReloadMetadata !ReloadMetadata
|
|
| RMGetInconsistentMetadata !GetInconsistentMetadata
|
|
| RMDropInconsistentMetadata !DropInconsistentMetadata
|
|
| -- Introspection options
|
|
RMSetGraphqlSchemaIntrospectionOptions !SetGraphqlIntrospectionOptions
|
|
| -- Network
|
|
RMAddHostToTLSAllowlist !AddHostToTLSAllowlist
|
|
| RMDropHostFromTLSAllowlist !DropHostFromTLSAllowlist
|
|
| -- QueryTags
|
|
RMSetQueryTagsConfig !SetQueryTagsConfig
|
|
| -- Debug
|
|
RMDumpInternalState !DumpInternalState
|
|
| RMGetCatalogState !GetCatalogState
|
|
| RMSetCatalogState !SetCatalogState
|
|
| RMTestWebhookTransform !TestWebhookTransform
|
|
| -- Bulk metadata queries
|
|
RMBulk [RQLMetadataRequest]
|
|
|
|
data RQLMetadataV2
|
|
= RMV2ReplaceMetadata !ReplaceMetadataV2
|
|
| RMV2ExportMetadata !ExportMetadata
|
|
|
|
data RQLMetadataRequest
|
|
= RMV1 !RQLMetadataV1
|
|
| RMV2 !RQLMetadataV2
|