Welp, all of my companies have been soft deleted.
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?
40 Replies
They're only soft-deleted?
@charles @Weiko @Félix problem with soft deletion is even worse than I thought 😶
yeah..
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)
People appear to be good, BUT companies have all been soft deleted.
It shouldn't but who knows
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
I took me a while but I've narrowed it down to specific table
Wait
@Raph could you restore any company and check if said company is visible in both normal and deleted view?
Yes they are
I'm afraid that's a different case of reported problem
I noticed that they are available in the UI as both states after it’s been restored.
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
Yup!! Sounds about right.
The only word of advice which I have right now is to NOT delete anything
Noted..
Just leave it in this Schrödinger state
Because if you delete any record, any record deleted later won't be soft deleted can be permamently deleted https://github.com/twentyhq/twenty/issues/7382
GitHub
Deleting record isn't soft deleted but permamently deleted · Issue ...
Scenario: Log in Go to Companies tab (or any other tab) and create new record Delete new record and click Options > Deleted companies to check if there's new record Actual: There is no recor...
The really odd part is that I didn’t delete anything in the first place.
Then something must have happened with migration process
Yes, I ran the migrations and the state of those companies all changed
I don't really see anything else responsible for this except for migration according to you
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
Yes, please create an issue about migrating
@Raph 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 dayThe 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
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
@Félix 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.
Thanks, @bob!
No problem, just be aware of potential consequences
I'll backup prior to it.
@bob 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.
Oh
That's... Quite bad to say the least
It's an easy fix, but not for most people.
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?
GitHub
v.0.30.2 - Deleting company twice will soft delete all of the works...
Bug Description When using the soft delete functionality the UI will soft delete all of the workspace companies. To Recreate: Log into your v.0.30.2 workspace and soft delete a company. Then procee...
@Weiko this looks urgent, could you take look
Looking
Can't reproduce on v0.30.2/prod 🤔
While I agree that deleting an already soft-deleted record does nothing (should do hard delete), I don't see the behavior you are describing above
I'll try to reproduce with a video later today.
Update: I sent a video to @Weiko and @charles with the issue. Thanks all!
Ok I can reproduce, thanks for the video @Raph
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) .
That's what I was thinking!
Thanks for confirming.
I updated the issue to be more specific about using the "Select All" action.
@Raphaël fyi
Fixed on 0.31.2