[Discovery] Shouldn't the HouseKeeping timer delete from the database "deleted" applications?

[Discovery] Shouldn't the HouseKeeping timer delete from the database "deleted" applications?

  
Forge Component
(44)
Published on 6 Feb by Telmo Martins
44 votes
Published on 6 Feb by Telmo Martins

I was trying to delete "Inactive" Applications directly from the database. Got an error saying that there are FKs to it. Have check them out and it turns out that they are in the ApplicationDef entity from DiscoveryProbe eSpace, with the IsDeleted = True.

Shouldn't the HouseKeeping timer take care of all that stuff? Like deleting "IsDeleted=True" records.

Let me know if you need any more information or help.


Thanks,

Nelson

If you wanna delete old applications, you should use DbCleaner. https://www.outsystems.com/forge/component/423/dbcleaner/

true, but discovery should not prevent applications being deleted!

its an external component

Paulo Ricardo Fagundes Júnior wrote:

If you wanna delete old applications, you should use DbCleaner. https://www.outsystems.com/forge/component/423/dbcleaner/


Unfortunately I can't use DBCleaner because I simply don't trust it. The last time we've use it, it ended up by dropping a column from production. I believe it's not prepared for multi-tenant, which is what I'm working with. I think I've reported the problem, but got no answer at that time.

But this is not related with the real problem here, even if I use DBCleaner I would probably get a FK error saying it's being referenced in other table.

As J. said, Discovery, or any other application should not prevent platform applications being deleted. If Discovery had a timer to clean everything from it's app it would be good enough.

Solution

Hi all,

unfortunately as I expected, since I didn't get any feedback from Discovery's owners, I've dug in the code to check the entity order in which they could be deleted in cascade.

So, if you guys need the same as I needed, just do the DELETE FROM statement for the following entities in this order:

ApplicationNode
ImportMap_Element
ImportMap_Module
OldReference
Reference
ElementNode
ModuleNode
ModuleEffort
Snapshot
ApplicationReference
ModuleDef
ImportMap_Application
Applicationdef

Note: This will delete all the records for Discovery, you will need to create a new snapshot.


Hope it helps someone.

Thanks,

Nelson

Solution