T
Twenty3mo ago
Raph

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
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
They're only soft-deleted? @charles @Weiko @Félix problem with soft deletion is even worse than I thought 😶
Raph
RaphOP3mo ago
yeah..
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
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)
Raph
RaphOP3mo ago
People appear to be good, BUT companies have all been soft deleted.
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
It shouldn't but who knows
Raph
RaphOP3mo ago
No description
Raph
RaphOP3mo ago
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
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
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?
Raph
RaphOP3mo ago
Yes they are
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
I'm afraid that's a different case of reported problem
Raph
RaphOP3mo ago
I noticed that they are available in the UI as both states after it’s been restored.
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
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
Raph
RaphOP3mo ago
Yup!! Sounds about right.
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
The only word of advice which I have right now is to NOT delete anything
Raph
RaphOP3mo ago
Noted..
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
Just leave it in this Schrödinger state
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
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...
Raph
RaphOP3mo ago
The really odd part is that I didn’t delete anything in the first place.
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
Then something must have happened with migration process
Raph
RaphOP3mo ago
Yes, I ran the migrations and the state of those companies all changed
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
I don't really see anything else responsible for this except for migration according to you
Raph
RaphOP3mo ago
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
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
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;
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
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
No description
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
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
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
Raph
RaphOP3mo ago
@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!
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
No problem, just be aware of potential consequences
Raph
RaphOP3mo ago
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.
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
Oh That's... Quite bad to say the least
Raph
RaphOP3mo ago
It's an easy fix, but not for most people.
ɃØĦɆᵾS
ɃØĦɆᵾS3mo ago
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?
Raph
RaphOP3mo ago
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...
charles
charles3mo ago
@Weiko this looks urgent, could you take look
Weiko
Weiko3mo ago
Looking Can't reproduce on v0.30.2/prod 🤔
Weiko
Weiko3mo ago
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
Raph
RaphOP3mo ago
I'll try to reproduce with a video later today. Update: I sent a video to @Weiko and @charles with the issue. Thanks all!
Weiko
Weiko3mo ago
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) .
Raph
RaphOP3mo ago
That's what I was thinking! Thanks for confirming. I updated the issue to be more specific about using the "Select All" action.
charles
charles3mo ago
@Raphaël fyi Fixed on 0.31.2
Want results from more Discord servers?
Add your server