When changing the data model of your applications, the changes are not immediately reflected in the database. This only happens when you deploy the application, and is done in a way that ensures no data is lost.

This topic explains how OutSystems Platform handles the following:

Deleting an Attribute

When deleting an Entity Attribute, OutSystems Platform removes it from your application model, but not from the database. The consequence is that you’ll no longer be able to use that attribute in the development environment.

Nonetheless, the data is still safely stored on the database. You can access it directly in the database or by rolling back your application.

After deleting an attribute, OutSystems Platform warns you that the database has more columns than your Entity. Learn more about the Database Integrity Suggestion.

Adding an Attribute

When you add an attribute to an Entity, OutSystems Platform checks the database to see if a column with the same name already exists in the associated table. If there is no such column, OutSystems Platform creates it.

If the Entity had an attribute with this name but you deleted it at some point in time, the OutSystems Platform kept the associated database column.

In this case, OutSystems Platform tries to reuse the existing database column. If the data type of the new attribute is different than the one that exists on the database, OutSystems Platform converts it when deploying the application:

Check the Changing the Data Type of an Attribute section to learn more.

Renaming an Attribute

If you rename an Attribute, OutSystems Platform creates a new column with the new name in the database. The old column with all its data remains in the database untouched, but it won’t be available in the development environment.

If there’s already a column with the same name in the database, OutSystems Platform tries to map the attribute to the existing database column. OutSystems Platform tries to convert the column data type if necessary.

Changing the Data Type of an Attribute

If there is data stored in the database table, OutSystems Platform tries to convert the values into the new data type. If the conversion is not possible or would cause data loss, no change is made and OutSystems Platform displays the Database Upgrade Error.

Since the conversion is done by the database management system you are using, you need to check its documentation to see the supported type conversions.

Changing the Length Property of a Text Attribute

OutSystems Platform uses two different data types to store strings in the database. The data type used depends on the string size. Lean more about the Database Data Types.

When changing the length of a Text attribute from less than 2000 characters to more than 2000 characters, the data type of the column in the database is changed.

You cannot change the length from more than 2000 to less than 2000 characters. OutSystems Platform gives you an error when you try to deploy this modification, and doesn’t change your application, since it would cause data loss.

See Also

Database Data Types