News for hackers. Stuff that matters.
Re:Instead of deleting account, NYT appends ‘1000’ to userna... by inopinatus on Tuesday April 28, 2020 @09:16AM (#23006628)
I’d bet (a small amount of) money they have no ability to delete accounts at all, and it goes all the way down to foreign key constraints introduced by a well-meaning but inexperienced developer that unnecessarily couple the accounts table to many other records.
Re:Instead of deleting account, NYT appends ‘1000’ to userna... by koheripbal on Tuesday April 28, 2020 @11:45AM (#23008133)
Regardless of the constraint on the key, the design fact remains that deleting a user record that might, for example, have associated transaction data (like subscription payments) is a little complex.

You don't want to cascade that deletion to a record of credit card charges, but you also need to make sure that all queries respect that the user record might now be deleted - ie make it an outer-join.

It's far more robust to add an active/inactive field.

The longer an organization has been around, the more interconnected the database is, and the more consequent changes are needed to accommodate a core database change.

I would be surprised if many many organizations have some hack like this under the covers.

Re:Instead of deleting account, NYT appends ‘1000’ to userna... by nitrogen on Tuesday April 28, 2020 @12:03PM (#23008346)
Do active/inactive fields comply with data privacy laws like those in California and the EU?
Re:Instead of deleting account, NYT appends ‘1000’ to userna... by akx on Tuesday April 28, 2020 @12:27PM (#23008628)
IANAL, but if you anonymize (not just pseudonymize) the PII from the user table (and others) I think so, yeah.
Re:Instead of deleting account, NYT appends ‘1000’ to userna... by emodendroket on Tuesday April 28, 2020 @09:50AM (#23006922)
In that case it seems simpler to introduce an IsDeleted flag than to have a convention that 1000 goes on the end of the name.
Re:Instead of deleting account, NYT appends ‘1000’ to userna... by Bjartr on Tuesday April 28, 2020 @09:52AM (#23006942)
Someone wanted to get this done without waiting on the DBA team so they rolled some implicit schema instead.
Re:Instead of deleting account, NYT appends ‘1000’ to userna... by neovive on Tuesday April 28, 2020 @10:07AM (#23007089)
This reminds me of a good use case for the Laravel Soft Deletes: https://laravel.com/docs/7.x/eloquent#soft-deleting.
Re:Instead of deleting account, NYT appends ‘1000’ to userna... by marcofatica on Tuesday April 28, 2020 @10:10AM (#23007119)
love this feature so much
Re:Instead of deleting account, NYT appends ‘1000’ to userna... by nunez on Tuesday April 28, 2020 @12:20PM (#23008535)
I'm learning about database design, and I'm learning that this might not be that easy if the relationships between users and other data on the site are ill-defined. There may be multiple tables in their design that will require knowledge of that flag, and it might legitimately be way easier to just add junk to the end of the user account than it is to introduce a new flag.
Re:Instead of deleting account, NYT appends ‘1000’ to userna... by 0xCMP on Tuesday April 28, 2020 @10:55AM (#23007581)
Sure, but that just covers up the lie better. Maybe a flag "ToBeDeleted" and any stilled logged in sessions see account is scheduled for deletion.
Re:Instead of deleting account, NYT appends ‘1000’ to userna... by asdfman123 on Tuesday April 28, 2020 @12:44PM (#23008813)
> it goes all the way down to foreign key constraints introduced by a well-meaning but inexperienced developer that unnecessarily couple the accounts table to many other records.

You make it sound like developers doing things the wrong way is the exception instead of the norm.

Good developers don't, but every place I've worked at has a few chunks of the software by people who didn't know or care enough to do things the right way.

Re:Instead of deleting account, NYT appends ‘1000’ to userna... by throwaway55554 on Tuesday April 28, 2020 @11:35AM (#23007997)
> I’d bet (a small amount of) money they have no ability to delete accounts at all

Probably not. I bet that goes for so very many organizations. It is far easier to reinstate an accidentally (user) deleted account if it is merely marked as deleted than if it were truly deleted.

Now, how NYT is handling this is ... well, it's bad.

Re:Instead of deleting account, NYT appends ‘1000’ to userna... by calvinmorrison on Tuesday April 28, 2020 @11:41AM (#23008089)
probably the fact that a good portion account deletes are users doing something they want to undo in the next few days. Soft deletes make this much easier, then going back and deleting anything older than X days is simpler than expensive customer support tickets of "how do i login it says my account is deleted"
Re:Instead of deleting account, NYT appends ‘1000’ to userna... by londt8 on Tuesday April 28, 2020 @09:23AM (#23006686)
Why not just anonymize the data instead? Not using foreign key constraint just for the sake of GDPR sounds weird.
Re:Instead of deleting account, NYT appends ‘1000’ to userna... by unicornfinder on Tuesday April 28, 2020 @10:04AM (#23007058)
That and why not allow null for the foreign key constraint and set it to nullify upon deletion? Or indeed, anonymise data.
Re:Instead of deleting account, NYT appends ‘1000’ to userna... by sopooneo on Tuesday April 28, 2020 @11:54AM (#23008224)
I have used that pattern in my apps and found it works well. But then I've watched video from respected DB experts, that I learn a great deal from, where they practically beg you to stop using nullable columns.

So I'm torn, because I think there may just be a major problem I've not yet grown my apps big enough to suffer. Anyone have thoughts either way?

Re:Instead of deleting account, NYT appends ‘1000’ to userna... by dmux on Tuesday April 28, 2020 @04:49PM (#23011802)
Any particular videos you'd recommend?
Re:Instead of deleting account, NYT appends ‘1000’ to userna... by cptskippy on Tuesday April 28, 2020 @09:59AM (#23007000)
> Not using foreign key constraint just for the sake of GDPR sounds weird.

That isn't what he said.

He said their inability to delete an account is due to poor design of their data schema by a well intentioned developer.