Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7801983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:07:11+00:00 2026-06-02T01:07:11+00:00

I am having some trouble formulating a solution for this foreseen situation. TableA has

  • 0

I am having some trouble formulating a solution for this foreseen situation.

TableA has a FK to TableB. TableC has a FK to TableA. TableC has a FK to TableD.

TableA
------
taId
tbId

TableB
------
tbId

TableC
------
tcId
taId
tdId

TableD
------
tdId

A brief series of events:

  • 1) A cascade soft-delete is issued to a record in TableB. This causes all related records in TableA to be soft-deleted, cascading to all related records in TableC being soft-deleted.
  • 2) At a later time, a record in TableD is soft-deleted, cascading again. This record in TableD was held as a FK in TableC. However, TableC was already marked as soft-deleted.
  • 3) The record in TableB in step 1 is requested to be restored.

    How can I make sure that when restoring the related records to the restored record in TableB (namely in TableA and TableC) that I do not restore any which had a dependency on the record from Step 2, TableD – moreover, that in not restoring parts which had a dependency on the record from Table D, I restrict restoration in a cascading manner (i.e. that TableA not be restored if TableC is found to have a relation to a soft-deleted record)?

    What I have considered is leveraging a temporal design in the tables along with a GUID. Each table would have (aside from a soft-delete flag) a DateDeleted field, and a GUID field (where the same GUID would be assigned to each node in a cascade soft-delete to distinguish the set of cascade). This would make it pretty easy to restore a cascaded set because they would share a date and a GUID. But the issue I came across, which is the one outlined above, was how to handle the situation where the soft-deleted records would have been removed from a different cascade.

    • 1 1 Answer
    • 0 Views
    • 0 Followers
    • 0
    Share
    • Facebook
    • Report

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Forgot Password?

    Need An Account, Sign Up Here

    1 Answer

    • Voted
    • Oldest
    • Recent
    • Random
    1. Editorial Team
      Editorial Team
      2026-06-02T01:07:13+00:00Added an answer on June 2, 2026 at 1:07 am

      Since your TableD record is soft-deleted, you don’t have to worry about breaking referential integrity by restoring your first soft cascade delete. However, what your cascade restore logic needs to do is to test the other dependencies of each table in which a soft-restore is being made.

      If there is a reference to a parent item which itself has been soft-deleted, then you need to do a soft-restore of that parent item too.

      A good way to achieve this is to have a per-table soft delete stored proc (or trigger) and a per-table soft restore stored proc (or trigger). These procs will take your date/GUID (soft delete business transaction ID) as input parameters.

      For each table, the procs in question will know what the dependencies are. The soft delete has downstream cascade dependencies and the soft-restore will have upstream cascade dependencies. Each proc will mark its own table’s record as deleted or restored and then call the procs necessary to perform the cascade actions.

      • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
        • Report

    Sidebar

    Related Questions

    Im having some trouble writing a getstring function, this is what I have so
    Im having some trouble with joining two tables. This is what my two tables
    I having some trouble figuring this problem out where I have one button which
    Having some trouble with this code. Trying to return a tuple of tuples (coordinates)
    I must admit I'm having trouble formulating this question, but I'll try my best
    Having some trouble getting this query to work correctly. mysql_query(DELETE FROM `table` WHERE `id`
    Iam having some trouble with a PDO execute statement. My code looks like this:
    I´m having some trouble deciding in which way to go... I've got this application
    I'm having some trouble formulating a findAll query for BeautifulSoup that'll do what I
    having some trouble trying to figure this out, complete novice when it come to

    Explore

    • Home
    • Add group
    • Groups page
    • Communities
    • Questions
      • New Questions
      • Trending Questions
      • Must read Questions
      • Hot Questions
    • Polls
    • Tags
    • Badges
    • Users
    • Help
    • SEARCH

    Footer

    © 2021 The Archive Base. All Rights Reserved
    With Love by The Archive Base

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.