feat: AlterSchema, dropPredicate, and embedded DropAttr#24
Open
mlwelles wants to merge 1 commit into
Open
Conversation
Adds raw schema-DDL primitives that complement UpdateSchema's object-template inference: - Client.AlterSchema(ctx, schema) applies a raw DQL schema string directly, giving full control over predicate types, indexes, and directives — useful for migrations that declare predicates no Go type models yet. - Engine.dropPredicate deletes a single predicate (and its data) from the embedded engine via posting.DeletePredicate. - embedded_client.go routes an Alter carrying DropAttr to dropPredicate, so the embedded path matches a remote Dgraph cluster's DropAttr behavior. TestDropPredicateEmbedded exercises the full declare/insert/drop cycle against the embedded engine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds raw schema-DDL primitives that complement
UpdateSchema's object-template inference.What
Client.AlterSchema(ctx, schema string)— applies a raw DQL schema string directly, giving full control over predicate types, indexes, and directives. Useful for schema migrations that declare predicates no Go type models yet.Engine.dropPredicate— deletes a single predicate (and its data) from the embedded engine viaposting.DeletePredicate.embedded_client.go— routes anAltercarryingDropAttrtodropPredicate, so the embedded (file://) path matches a remote Dgraph cluster'sDropAttrsemantics.Tests
TestDropPredicateEmbeddedruns the full declare → insert → confirm-present → DropAttr → confirm-gone cycle against the embedded engine (and against a live cluster whenMODUSGRAPH_TEST_ADDRis set).Summary by cubic
Add raw schema DDL support via
AlterSchemaand implementDropAttrhandling for the embedded engine to match remote Dgraph behavior. This enables precise schema migrations and safe single-predicate drops across embedded and remote modes.Client.AlterSchema(ctx, schema)applies raw Dgraph schema directly, bypassingUpdateSchemainference (full control over types, indexes, directives).AlterwithDropAttrdeletes a predicate and its data by routing to enginedropPredicate, mirroring cluster semantics.dropPredicateusingposting.DeletePredicate.Written for commit bd16559. Summary will update on new commits.