spring-projects / spring-projects/spring-batch

DELETE CASCADE on Foreign Keys

Open
#4,555 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: core related-to: ddl-scripts type: feature
Dominant language
Java
Stars
3k
Forks
2.5k
Avg merge
6d 53m
Merged PRs (30d)
3

Description

Current Behaviour

The current implementation to delete job instances or job executions issues a separate SQL statement for each metadata table. (see https://github.com/spring-projects/spring-batch/pull/4497)

Suggested Change

If we define the DELETE CASCADE option on each Foreign Key in the metadata table, we could remove all metadata by simply deleting the desired table row and the database will take care of the rest.
As far as I can see each supported database supports the DELETE CASCADE option

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading PR 4497 and tracing how job instances and job executions are deleted from the metadata tables. Inspect the foreign-key definitions for each supported database and determine whether cascading deletes can replace the separate SQL statements. Done means the relevant metadata rows are removed through the cascade without breaking supported database schemas.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
databases
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.