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 6764321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:34:48+00:00 2026-05-26T14:34:48+00:00

For example, let’s say I had a social networking site for movie fans. Some

  • 0

For example, let’s say I had a social networking site for movie fans. Some people list “Rocky” as their favorite movie, others list “Rocky 1”, other still “Rocky I”. The obvious thing is to merge the three together and update the associated tables. However, for every obvious solution there’s a design pattern that’s 1) more complicated and 2) has some extra benefits. Is there a design pattern for merging duplicate database records? Specifically, something that provides auditability or reversibility?

  • 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-05-26T14:34:49+00:00Added an answer on May 26, 2026 at 2:34 pm

    As soon as you as you say “reversibility” I think Command Pattern.

    The typical example is to support Undo style behaviour but I think this would be a good fit for auditability as well – especially as the individual “steps” (for want of a better word) are so small and easily represented (e.g. {Merged "Rocky I" -> "Rocky" }).

    How would I get the Command pattern to actually work for your scenario?

    Well, keeping this very much in the RDBMS arena rather than OO modelling, assuming you’ve already got tables USER_FAVORITE and MOVIE, I’d add a new table USER_FAVORITE_MOVIE_MERGE_COMMAND with columns:

    • id
    • date
    • user_id
    • old_favorite_movie_title
    • new_favorite_movie_title

    So your nightly cleanup script (or whatever) runs over the USER_FAVORITE table looking for non-standard movie titles. Each time it finds one, it corrects it and records the pertinent facts in the USER_FAVORITE_MOVIE_MERGE_COMMAND table.

    Your audit trail is right there, and if you ever need to reverse the cleanup job, “play back” the rows in reverse chronological order, replacing new with old.

    Notice how you’ve got both reversibility and auditability both in the temporal sense (e.g. last night’s batch run went weird at 2.12am, let’s roll back all the work done after that) and in the per-user sense.

    Is this the sort of thing you’re after?

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

Sidebar

Related Questions

I write some code to learning F#. Here is a example: let nextPrime list=
For example: Let's say I'm grabbing a list of names and saving it to
For example let us say that we want to save a list of URLs
I'm having some trouble writing a query. For example: Let's say I have just
Simpler Example Let's try a simpler example, so people can wrap their heads around
Let's say I want my program to do something after some inactivity. For example
A simple example: Let's say I have one alias being sourced somewhere as: alias
There is an example (let us say in a file named mybatch.bat ): @echo
Is there any way to get PDF document text language? Example: Let's say I
Let's say for example I wanted to echo You are using Windows! or You

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.