43
Views
9
Comments
Rename static entity record identifier

Hello,

I need to rename the identifier of a static entity record and I am wondering what would happen when I deploy it to the next environment.

Example:

Static entity record has the identifier Home and then we rename it to House.

What will happen to the entities that reference the Home identifier on the upper environments when I deploy? Will they be updated to House or will this lead to some kind of data inconsistency?


Thank you for your attention.

Best regards

Hey @Rodrigo Marques ,

If you just rename the record name, then it won't create any problem. Although it is critical decision with respect to your project. So, take the advises from Our MVPs .

Thanks & Regards,

Sudip Pal 

Champion

Hi Rodrigo,

What happens when you change a name of field:

- The name in Physical table will keep the same (No change the name in real Database, only in OS side). You will have no issues!

You can have issues if you delete a record from static table that is referenced as a foreignKey in an other table.

Regards, Paulo Torres


Champion

Hello

As far as you are changing just the name it won't effect, make sure you have not hardcoded it somewhere at filters or somewhere.

If we change the Name of Identifier it will change the label as well, however you can edit it later.

If you just change the record Identifier that won't effect, because the thing is Id which is here as auto number, if you change that and it is been referenced that it will be a problem.

Thanks
Tousif Khan

Hello Rodrigo,

As other suggested, changing name will not lead to data inconsistency if followed best practices. Just want to add here, you must check reference of that particular attribute used everywhere, if you have hardcoded to check value like SomeAttribute = "Home", it should be replaced with Entities.StaticEntityName.House.


Champion

Hi @Rodrigo Marques ,

I would suggest to take advice to MVP's as my one of project changes in static entity is not reflected in other environment after code push.

But as you are only changing the name so I don't think it will impact after push.

Regards,

Arun 

Over the course of multiple hours the same reply is being added by multiple people. If you have no additional information to share don't repeat replies oleaee.

If you change the identifier value of something, in this case a static , and it is used in a foreign key constraint somewhere else, you are in trouble. You will encounter an error during deployment.

Some solutions:

1) You can set the IsActive of the static entry to false and create a new one that meets your needs. 

2) You disable the foreign key constraint  and deploy. Then and migrate the data to the new identifier value, change the identifier of the static and enable the foreign key again and deploy.


What @Erwin van Rijsewijk  says, that is the way we perform such a change in our project.

When you don't use this old static entity anymore, you can remove it later (in next deploy)

In addition to the replies. Here is the official documentation regarding database model changes

The following in this documentation is of interest to you:

Renaming an Entity or Attribute

If you rename an Entity, OutSystems renames the association in the database but the physical name stays the same. The table with all its data remains in the database untouched.

If you rename an Attribute, OutSystems 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 will try to map the attribute to the existing database column. OutSystems tries to convert the column data type if necessary.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.