Skip to main content
OutSystems

How to delete tables from database

Question

I have several inactive users that originated from the OSP Directory App:

  • I have deleted all the apps, and they still hang around.
  • I try to delete then and they are locked with a key from the employee entity, which has been deleted a long time ago.

How can I delete these inactive users?

Answer

Even tough you've installed and deleted the directory app, the platform doesn't delete any data stored in the database. This feature is specially important when you are dealing with real data or good seed data and by mistake you delete an entity or an app. This way if you rollback or reinstall the app that you've changed or deleted, it will restore the links to the data that you still have in the database.

Having this in mind, to clean your database you have to possible options.

First, you can reinstall the directory app and you'll get the application linked to tables you've already in the database. This way you can create your own logic to clean the contents of the database. Following this process, when you delete the apps again, you'll still have the tables in the database but with no data.

Since the version 9.0.0.23 of the platform you've available the DBCleaner component that allows you to actively manage the tables, attributes and old versions of eSpaces and Emails. In this app you can drop one-by-one the tables you have and keep your actual database in sync with the apps you've. Just be careful doing this process, since it will DROP the entities from the database deleting all the contents!

You can find the DBCleaner in our OutSystems Forge: http://www.outsystems.com/forge/component/423/dbcleaner/