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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:24:41+00:00 2026-05-12T11:24:41+00:00

I have database application, I want to allow the user to restore the deleted

  • 0

I have database application, I want to allow the user to restore the deleted records from the database, like in windows we have Recycle bin for files I want to do the same thing but for database records, Assume that I have a lot of related tables that have a lot of fields.

Edit:

let’s say that I have the following structures:

Reports table

  • RepName primary key
  • ReportData

Users table

  • ID primary key
  • Name

UserReports table

  • RepName primary key
  • UserID primary key
  • IsDeleted

now if I put isdeleted field in UserReports table, the user can’t add same record again if it marked as deleted, because the record is already and this will make duplication.

  • 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-12T11:24:41+00:00Added an answer on May 12, 2026 at 11:24 am

    Note: I always use surrogate primary key.

    Add a timestamp ‘deleted_at’ column. When user deletes entry put there current time. Make this key part of your constrain.

    In every query remember to search only for records that have null in deleted_at field.

    Some frameworks (like ActiveRecord) make it trivial to do.

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

Sidebar

Related Questions

I currently have a database that gets updated from a legacy application. I'd like
I have a large web form application that I want to allow the user
I have developed an application that pulls X amount of records from my database
Suppose I have some application A with a database. Now I want to add
I have an application that reads a table from a database. I issue an
I have a rails application where each user has a separate database. (taking Joel
I have a large database and want to implement a feature which would allow
I have a database that I want to access via a .NET web application.
I have a service application in C# which queries data from one database and
I have an application that imports data read from text files from a directory

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.