Schema update should dropped columns not available in entity
Description
Attachments
1
Activity
Show:

Christian Beikov May 5, 2022 at 1:30 PM
I changed this issue to be a feature because I think this is not something that we should do by default.

Barry Lafond October 26, 2021 at 3:25 PM
Also found that doing an update where column datatype or column properties (annotations) changed the columns weren’t updated.
Details
Details
Assignee
Unassigned
UnassignedReporter

Components
Priority
Created October 25, 2021 at 9:56 PM
Updated May 5, 2022 at 1:30 PM
Working on schema update corner test cases I wrote a test to drop a column from a simple entity using the schema update.
Looks like in https://github.com/hibernate/hibernate-orm/blob/91e29358be0a73d77ac00de45ddf56dd989fefd2/hibernate-core/src/main/java/org/hibernate/mapping/Table.java#L444 the column iterator is for the targeted new entity and there is no reconciliation on the original entity columns to create and add the drop SQL strings.
I ran the attached test locally and manually added *alter table if exists ColumnsUpdateTestEntity drop column columnThree to the result list and the test passed. Also tested it from my Hibernate Reactive.
Wasn't sure how to obtain the column names from the *TableInformation* object so I could create/test a fix.