Skip to content

Consolidate shared ALTER enums (breaking API change) - #2746

Open
minleejae wants to merge 1 commit into
JSQLParser:masterfrom
minleejae:refactor/shared-alter-enums-20261002
Open

minleejae wants to merge 1 commit into
JSQLParser:masterfrom
minleejae:refactor/shared-alter-enums-20261002

Conversation

@minleejae

@minleejae minleejae commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

ALTER SERVER and ALTER FOREIGN DATA WRAPPER expose separate enums for the same OPTIONS/OWNER/RENAME actions. Replace both with ForeignObjectAlterAction while retaining each statement's own payload. Trigger and rewrite-rule actions already share EnableState internally; remove the redundant TriggerState compatibility layer.

Breaking API changes:

  • AlterServer.Action and AlterForeignDataWrapper.Action are removed; getAction/setAction now use net.sf.jsqlparser.statement.alter.ForeignObjectAlterAction.
  • RelationAlterAction.TriggerState, getTriggerState and setTriggerState are removed. Use EnableState, getEnableState and setEnableState.

usage.rst includes migration examples and recompilation guidance. OPTIONS still covers server VERSION and wrapper handler/validator changes. Trigger/rule action kinds and NAME/ALL/USER targets stay distinct; switching actions retains inactive payload without rendering it.

Validation: Java 17 Gradle check passes: 9,403 tests, 9,378 passed, 25 skipped, zero failures/errors, including formatting, grammar conflicts, Checkstyle, PMD and SpotBugs. The 151 focused tests cover action changes, inactive fields, VERSION NULL versus omission, trigger targets, both renderers and reparsing. Grammar edits only replace Java enum references; SQL acceptance is unchanged.

Combined validation of these three refactoring branches: Gradle check passes (9,465 tests, 9,440 passed, 25 skipped, zero failures). All 882 original DDL fixtures execute on MySQL 8.4.11/PostgreSQL 18.6. The 875 supported cases also produce toString and deparser SQL that executes successfully. Seven parse failures already exist on base bb55bb9, including two foreign-option identifier cases using SAMPLE. Final parsing results and SQL outputs match the base and the DB-replayed outputs exactly; there are no new parsing/rendering regressions.

Replace the server and foreign-data wrapper Action enums with ForeignObjectAlterAction. Remove the TriggerState compatibility enum and accessors in favor of EnableState, and document the API migration.

Signed-off-by: minleejae <mmj9808@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant