#Welp, all of my companies have been soft deleted.

1 messages · Page 1 of 1 (latest)

burnt valley
#

Just upgraded to 30.2 and all of the companies are acting like they're soft deleted!! It seems like all of the connections between people and companies have been broken. 😬

Is there any quick way short of running a query in psql to get them back?

feral remnant
#

They're only soft-deleted?

#

@static breach @nova bay @tropic fog problem with soft deletion is even worse than I thought 😶

burnt valley
#

yeah..

feral remnant
#

Let me check if it's possible to change its status in database (still I'd wait for core team if I were you because I'm not sure if running query directly in database won't break something else somewhere else)

burnt valley
#

People appear to be good, BUT companies have all been soft deleted.

feral remnant
#

It shouldn't but who knows

burnt valley
#

Making that jump to redis felt a little wonky, but there is definitely a performance gain.

#

moved from 0.24.1 to 0.30.1

feral remnant
#

I took me a while but I've narrowed it down to specific table

#

Wait

#

@burnt valley could you restore any company and check if said company is visible in both normal and deleted view?

burnt valley
#

Yes they are

feral remnant
#

I'm afraid that's a different case of reported problem

burnt valley
#

I noticed that they are available in the UI as both states after it’s been restored.

feral remnant
#

I've noticed it originally with duplicates but now I deleted a record in restarted database, restored it and it's in both views

#

Damn it

burnt valley
#

Yup!! Sounds about right.

feral remnant
#

The only word of advice which I have right now is to NOT delete anything

burnt valley
#

Noted..

feral remnant
#

Just leave it in this Schrödinger state

burnt valley
#

The really odd part is that I didn’t delete anything in the first place.

feral remnant
#

Then something must have happened with migration process

burnt valley
#

Yes, I ran the migrations and the state of those companies all changed

feral remnant
#

I don't really see anything else responsible for this except for migration according to you

burnt valley
#

I may have deleted one company manually. I can’t remember, but i definitely didn’t delete all 1400

#

Thanks for looking into the issue. I appreciate you. Should I create an issue?

#

The search also picks up deleted records. That part is weird too

feral remnant
#

Yes, please create an issue about migrating

#

@burnt valley I've found a database query which may resolve your problem

#

update workspace_{workspaceid}.company set "deletedAt" = null;

#

Just be aware that this query:

  • must have workspaceid automatically filled by pressing Tab as it's essentially a bunch of random characters like on screenshot
  • will update ALL records so if you have deleted some records earlier which you don't want to restore, you may have to use the where clause to select only those object you want to restore but you have to find something connecting all records like they've been created by the same person or in the same day
#

The other way to restore them is by writing script with Puppeteer/Playwright/Selenium which opens browser, logs in, goes to Company tab, opens Deleted view and one by one goes in to details of deleted record and restores them

#

I've restored a deleted record on my local instance and if I delete it again, then it's permamently deleted and skipping soft deletion part

#

If you need more help, just ping me

tropic fog
#

Hey @burnt valley sorry about that, I don't see what could have caused this mass deletion. I'll investigate now to see if I find any lead

burnt valley
#

@tropic fog all good. It happens when you’re building new things. When the objects are soft deleted is there an additional action to delete them permanently?

#

I feel like I was trying to delete a few records permanently then all of a sudden everything was soft deleted.

burnt valley
feral remnant
burnt valley
#

I'll backup prior to it.

burnt valley
#

@feral remnant I've been able to recreate the soft delete of ALL companies.

When the user deletes a company and then enters the "deleted company" section and deletes a company that has already been deleted the UI will delete all of the workspace's companies.

feral remnant
#

That's... Quite bad to say the least

burnt valley
#

It's an easy fix, but not for most people.

feral remnant
#

Especially when some probably won't think of creating a backup

#

So performing this will result in data loss

#

Did you create an issue by any chance?

burnt valley
static breach
#

@nova bay this looks urgent, could you take look

nova bay
#

Looking

#

Can't reproduce on v0.30.2/prod 🤔

burnt valley
#

I'll try to reproduce with a video later today.

burnt valley
#

Update: I sent a video to @nova bay and @static breach with the issue. Thanks all!

nova bay
#

Ok I can reproduce, thanks for the video @burnt valley
It seems to be related to the select all actions (as you suggested) and happens only on deleted records view. Seems like it's sending all the ids to the softDelete mutation regardless of the active filter (here "deleted records", so actually send all the non deleted records) .

burnt valley
#

That's what I was thinking!

#

Thanks for confirming.

#

I updated the issue to be more specific about using the "Select All" action.

static breach
#

@blazing mist fyi