Drop constraints when an entity attribute is removed from the model
936
Views
3
Comments
On our RadarOn our Radar
Database

When i drop an attribute in the model i get a Database Integrity Suggestion
"Inconsistent database table and entity definitions: column 'OSUSR_8o1_xxx.yyy' exists in database, but there is no corresponding attribute in entity 'xxx'."

But when do an alter table to drop the column i get an error:

The object 'DF__OSUSR_8H1__xxx__753F8AB0' is dependent on column 'yyy'.

So i first have to drop the constraint before being able to drop the column. It would be nice if that was not necessary. 

I do understand why the columns aren't dropped, but i don't think the constraints serve a purpose when the column is no longer present in the model.

2016-04-21 20-09-55
J.
 
MVP

Also drop constraints if you delete the espace where the entity was.

Now I have a "ghost" entity with a FK to an active entity.. and I am unable to delete a record becaus ethere is a constraint on the ghost-entity.


Merged this idea with 'Drop constraints on deleted tables' (created on 05 Mar 2020 13:28:39 by Bispo)

When a table is deleted from Outsystems, the database scripts should also delete the FK constraints that table may have to other ones.


Let's take the example:

- Table STAFF

- Table LICENSE, contains a FK to STAFF (with delete rule ignore)


Let's say I delete table LICENSE from the eSpace and publish it.


If I attempt to delete records from the STAFF table, some might fail because of the constraint on the FK when the LICENSE table is even no longer in use.


In case a publish a previous version of the eSpace then the constraint needs to be enabled again.






This comment was:
- originally posted on idea 'Drop constraints on deleted tables' (created on 05 Mar 2020 by Bispo)
- merged to idea 'Drop constraints when an entity attribute is removed from the model' on 19 Jun 2021 14:29:37 by Justin James