Metadata Database problems

Metadata Database problems

In an abortive attempt to refactor a solution, involving moving an entity from one eSpace to a new one, I messed up my new eSpace. To try to recover, I deleted the eSpace, and all of the SQL Server tables. Then I added the eSpace again, and now it is even worse. All the new SQL tables are named with a "1" suffix after the entity name, except for the entity I moved, which now appears twice, with a "1" and a "2". And, the eSpace references both these "1" and "2" tables.

So, looking into the metadata tables I see that the old eSpace was not removed, just marked inactive; same with all associated entities.

Short of hacking the metadata, how can I truely delete an eSpace, and all associated SQL tables? I'd like a clean database, where the tables have the same name as the associated entities. Is that too much to ask?
Hi Terry,

The OutSystems Platform never deletes the db data associated with espaces that are "deleted" (as you noticed they are just deactivated): this goes for whole tables down to any columns that you may have deleted the attribute to. This is for safety reasons and to prevent data loss.

Though what you are trying to achieve is perfectly reasonable, we have found throughout the years that it's not a common scenario at all, and one that people prefer to do DBA (or at least human :) ) assisted. If you really want to do this, then yes, you will need to look into the metadata, namely the Physical Table Names in ossys_entity to decide which tables to delete. Don't forget you'll need to delete any keys and indices before dropping the tables.


Hi Miguel,

As I mentioned, I did delete the SQL tables; I ran queries generated from scripts I found in Performance Tuning for OutSystems Applications, and they worked quite well.

My issue is with the entries in the ossys tables. The old version of the eSpace is marked inactive, but all the entities are still marked active. So, when I recreated my eSpace, duplicate ossys_entity entries were generated, with a "1" appended to the SQL table name.

Is there some script I could run, after deleting an eSpace and associated SQL tables, that would wipe out all traces of the old eSpace from the ossys tables? Or can I just manually remove the entries from ossys_espace and ossys_entity? Or, mark the old ossys_entity entries inactive?