Skip to content

feat: support MySQL named foreign key and check drops - #2675

Open
minleejae wants to merge 1 commit into
JSQLParser:masterfrom
minleejae:feat/mysql-named-constraint-drops
Open

minleejae wants to merge 1 commit into
JSQLParser:masterfrom
minleejae:feat/mysql-named-constraint-drops

Conversation

@minleejae

Copy link
Copy Markdown
Contributor

In MYSQL mode, support ALTER TABLE t DROP FOREIGN KEY fk1 and DROP CHECK c1, including quoted names and combined ALTER actions. Expose the deletion target through getConstraintName() and the action through DROP_FOREIGN_KEY / new DROP_CHECK, so callers can inspect, rename or construct the action without editing raw SQL.

Share special DROP rendering between parser-created actions and directly constructed AlterExpression nodes. Preserve the existing parenthesized foreign-key form and other DROP branches. Includes usage documentation, AST mutation/construction tests and parse/deparse/reparse checks.

Validation: full Gradle check on Java 17; six valid DDL fixtures executed in original and rendered form on MySQL 8.4, with catalog checks confirming the target constraints were removed. New named alternatives are selected only by Dialect.MYSQL.

Syntax reference: https://dev.mysql.com/doc/refman/8.4/en/alter-table.html

Signed-off-by: minleejae <mmj9808@gmail.com>
@minleejae
minleejae force-pushed the feat/mysql-named-constraint-drops branch from a96a174 to 796cad3 Compare September 22, 2026 09:38

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