Fixing Database Integrity Suggestions through SQL script - IS_ACTIVE attribute?

Hi guys!

I am looking to make an SQL script for clearing out unused attributes from the Outsystems database by dropping those columns from their respective tables in SQL. It all started with trying to get rid of Database Integrity Suggestions (Inconsistent database table and entity definitions):

I have made the required functions and stored procs for dropping the columns and constraints by hand, but I was hoping to create something more automated that could be run periodically to clear these columns, so i started looking into how to identify deleted columns in the ossys_Entity_Attr table. This would get me a list of columns to be dropped dynamically:

My question is whether anyone knows if the columns marked as ossys_Entity_Attr.IS_ACTIVE correspond directly to the Database Integrity Suggestion warnings, and whether there would be any consequences to dropping them, other than not being able to roll back the entity to a previous version? Do I need to drop the ossys_Entity_Attr record as well after dropping the table?

Have you looked at the dbcleaner forge component? That has functions to cleanup inactive entities and attributes built in as well as manage other things such as old espace versions and emails etc.

Rank: #51

Hi Chris,

Let me just add a couple of notes here.

Although listed as inactive on the most recent version, those attributes can still be used on previous versions.

In this case the platform protects its permanent removal, just in case a developer decides to rollback the code.

This not only includes the previous OML version, but also any tagged solution. It might take sometime to get rid of those attributes, since the platform always tries to protect your data.

This logic also applies for entities.

Hope this gives you a bit more context.

Best Regards