Replace silent CREATE PROTO BUNDLE ignore with --ignore-proto-bundles flag#88
Merged
Merged
Conversation
… flag
CREATE PROTO BUNDLE was silently dropped in NewDatabase, while the
analogous unsupported statement CREATE MODEL required users to opt in
via the --ignore-models flag. The silent path has two problems:
- Users can't tell that hammer just stripped a statement from their
schema, so a CREATE PROTO BUNDLE typo or paste mistake never produces
an error.
- If hammer later grows real CREATE PROTO BUNDLE support, schemas that
relied on the silent drop will suddenly start emitting diffs the user
never asked for.
Add IgnoreProtoBundles to DDLOption and a corresponding
--ignore-proto-bundles flag to apply / create / diff / export. Drop the
silent case in NewDatabase so the default behaviour now errors out with
"unexpected ddl statement", matching how --ignore-models handles
CREATE MODEL.
Existing tests (`ignore create proto bundle in {from,to,both}`) are
updated to set ignoreProtoBundles: true and continue to verify the
flag's behaviour. README's Flags section gets the new entry.
Behavioural impact: this is a breaking change for users who were
relying on the silent ignore added in PR #84 (v0.7.0-beta.7). The fix
is to pass `--ignore-proto-bundles` and the previous behaviour is
restored.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
CREATE PROTO BUNDLE was silently dropped in
NewDatabase, while the analogous unsupported statementCREATE MODELrequired users to opt in via the--ignore-modelsflag. This PR unifies the two patterns under the explicit-opt-in approach by introducing--ignore-proto-bundles.Problem with the silent path
This has two issues:
CREATE PROTO BUNDLEtypo or paste mistake never produces an error.CREATE PROTO BUNDLEsupport, schemas that relied on the silent drop will suddenly start emitting diffs the user never asked for.Changes
DDLOptiongains anIgnoreProtoBundles boolfield.ParseDDLfilters*ast.CreateProtoBundlewhen the flag is set, matching the existing*ast.CreateModelhandling.case *ast.CreateProtoBundle:inNewDatabaseis removed, so the statement now falls through to the defaultunexpected ddl statementerror path.--ignore-proto-bundlesis added toapply/create/diff/export.ignore create proto bundle in {from,to,both}tests setignoreProtoBundles: trueand continue to verify the flag's behaviour.