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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:34:22+00:00 2026-05-25T23:34:22+00:00

My head’s spinning from reading all the pro’s & con’s articles about soft-delete. But

  • 0

My head’s spinning from reading all the pro’s & con’s articles about soft-delete. But that’s the only way I know to achieve this:

maintain the foreign keys & user info (history data)
Even if the user is deleted/inactive, there are foreign keys in comments, attachments and stories tables. So that it can still be identified that it was him who wrote this comment etc.

Other info:

deactivated users cannot login, won’t be included in lists.

But if I use soft delete, it’s not really good adding an extra column in the WHERE in sql statement every time I query for that table.

What to do? Hope you guys can give some inputs.

Note: I use mysql and ROR

  • 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-25T23:34:23+00:00Added an answer on May 25, 2026 at 11:34 pm

    If you “soft delete” users, you don’t add an extra column in the WHERE clause of every SQL statement. Instead, build one view that returns only active users, and the queries that need to know about active users use that query. They don’t use the base table.

    It might look something like this.

    create view users_active as
    select * from users
    where deleted = false;
    

    Depending on how much development you’ve done so far, you might want to rename the users table, and name the new view “users” instead. Something along these lines . . .

    alter table users rename to users_all;
    
    create view users as
    select user_id, user_name from users_all   -- All columns except "deleted"
    where deleted = false;
    

    Now any query that used to hit the table “users” will instead hit the view “users”. Logical data independence–this is why views and tables share the same namespace in the relational model.

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

Sidebar

Related Questions

My head is spinning, I tried to do this on my own, but cant
Head First book says about include directive as include code from any other file
My head hurts: I've read so many blogs about C++11x's move semantics that my
head([Y],Y):-!. head([X|XS],X). I understand that the head of the list is stored on the
My head is about to explode with this logic, can anyone help? Class A
My head is about to explode with everything I've read about SQL Server and
I'm reading through head first design patterns at the moment and while the book
After reading the Head First Design Patterns book and using a number of other
I have dual head (VGA output, DVI or HDMI output) from 1 PC using
In the Head First Design Patterns book, the author often says that one should

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.