BUG: Renaming an Entity Attribute Deletes existing values from the database

BUG: Renaming an Entity Attribute Deletes existing values from the database

  

When renaming a field on an entity, the data in the field is deleted. I thought the form had disconnected from the field, but when I investigated further, I found all the data in the database had been deleted in that field.

This really, really bad behavior. There's no reason for a developer to know data will be deleted by simply renaming a field.

Oh well, it isn't really deleted, the platform actually creates another field on the database, if you change back to the original field name you can see that the data is all still there.



You can read more about it here https://www.outsystems.com/forums/discussion/13670/why-a-new-database-attribute-is-created-when-you-rename-it-in-service-studio/

Deleting all my data is not the way this BUG should be discovered. It's a bug. There are no consumers of my module. There's no reason not to simply rename the field in the database.

Your data wasn't deleted, it's still in the database, you can get it by renaming back your field to the original name.
The reasoning behind this decision is in that post.

Let me know if you need help in recovering your data.

If you want to pass your feedback please show your support in https://www.outsystems.com/ideas/71/rename-entity-attributes-without-loosing-the-database-content?Unfollow= .

Thank you Frederico. I see this issue has been debated for quite some time. I'm clearly on the side of OutSystems is doing this wrong and I'll leave it at that and hope they fix it.

Hi PJ,

When you are renaming an Attribute of an Entity, the Platform creates a new database column. The old data is still in the old column, but you can't access it via OutSystems directly. I agree this is something to be aware of, and like you, I consider this unfortunate behaviour (though I wouldn't call it a bug, as it is by design). It would be better if the Platform, like with Entity names, created an internal mapping from "OutSystems name" to "database name" and applied that. In fact, there's an Idea for that, so I'd encourage you to upvote it.

@Frederico: Please read questions thourghly, and don't supply wrong information. PJ is clearly asking about renaming an Attribute, you reply with "the platform actually creates another table, if you change back to the original entity name you can see that the data is all still there". This is 1) not what PJ asked, but furthermore, 2) completely untrue! When you rename an Entity, the Platform simply maps it to the same database table, and no data is "lost"! And in your second reply, you're still talking about an "Entity". Perhaps you are confused about terms, but either way it isn't very helpful!

Kilian Hekhuis wrote:

Hi PJ,

When you are renaming an Attribute of an Entity, the Platform creates a new database column. The old data is still in the old column, but you can't access it via OutSystems directly. I agree this is something to be aware of, and like you, I consider this unfortunate behaviour (though I wouldn't call it a bug, as it is by design). It would be better if the Platform, like with Entity names, created an internal mapping from "OutSystems name" to "database name" and applied that. In fact, there's an Idea for that, so I'd encourage you to upvote it.

@Frederico: Please read questions thourghly, and don't supply wrong information. PJ is clearly asking about renaming an Attribute, you reply with "the platform actually creates another table, if you change back to the original entity name you can see that the data is all still there". This is 1) not what PJ asked, but furthermore, 2) completely untrue! When you rename an Entity, the Platform simply maps it to the same database table, and no data is "lost"! And in your second reply, you're still talking about an "Entity". Perhaps you are confused about terms, but either way it isn't very helpful!


True story, sorry about that, at least the link that i posted was correct :P

What is the rationale for not copying the values from the original field that is now renamed into the new field with the new name? It's one SQL Statement "update {table} set newfieldname = oldfieldname".

If OutSystems did that update, I never would have known this issue existed and the world would be a better place.

I wouldn't like the fact that the system would handle or change data without an action from my side. What I would like in this case, is a function that allows you to 'import' data from another column to the new column. (Or move entity data from one espace to another ;-) )

Furthermore, if you know the query, it isn't much work to create a timer action that is executed on publication. This way it's clear what happens with your data.

I can see that happening with like a wizard that asks you if you want to create a timer to do that on publish , but if it just made it without any warning that could lead to dangerous mistakes, also problems when deploying from one environment to another.

Asking if you want that timer and making it if you want could be a valuable improvement, I don't know if there's any of that on Ideas.

Lennart Kraak wrote:

I wouldn't like the fact that the system would handle or change data without an action from my side. 

Therein lies the problem, because OutSystems exactly is changing my data without an action from my side, because instead of "1) renaming a field" they are "1) renaming a field and 2) setting all existing values in the field to NullIdentifier()". I didn't ask them to do that second step.


Outsystems creates a new field, it doesn't rename the old field, the old field is still there, with the same name. with all the data untouched.

You are showing up years late for an argument that's been had many, many times before.

I don't think ANYONE likes this behavior as a developer using the system to get their job done. As an engineer, I understand why this behavior exists (bottom line: a deployment with that "copy data to a new column" would take forever, and rollbacks would lead to extremely unstable situations, especially if you then rolled forwards again).

But no, it's very unfriendly for day-to-day use, the first time it happens to you it surprises you and you get angry, and there's no super duper clean workarounds.

J.Ja

Thanks Justin for making it clear , As a developer we need to keep it in our mind to avoid surprises.


Regards

-SK-