Recently our pipelines fail, because removed fields cannot be removed on SQL side.
This concerns our legacy product which is on BC18.16 OnPrem.
The field we are trying to remove looks like this in code:
field(904; "Print Loan detailed"; Boolean)
{
Caption = 'Print Loan detailed';
}
The statement that gets run on sync (Mode ForceSync) is the following:
ALTER TABLE dbo."SKO_MV$Accounting Object$437dbf0e-84ff-417a-965d-ed2bb9650972" DROP COLUMN "Print Loan detailed"
And results in this error:
The object 'MDF_49CB3A659E879050D45A73CA5FF7670FF93B16D377C87234140C7B017BDD5D80' is dependent on column 'Print Loan detailed'.
ALTER TABLE DROP COLUMN Print Loan detailed failed because one or more objects access this column.
When I inspect the table in ssms I find the following constraint:
ALTER TABLE [dbo].[sko_mv$Accounting Object$437dbf0e-84ff-417a-965d-ed2bb9650972] ADD CONSTRAINT [MDF_49CB3A659E879050D45A73CA5FF7670FF93B16D377C87234140C7B017BDD5D80] DEFAULT ((0)) FOR [Print Loan detailed]
To me it seems like something is wrong with the metadata and the platform for some reaseon forgets to drop the contraint before dropping the field.
What I've tried so far:
- Repair-NavApp and try again --> Didn't work; same error on sync
- Set an explicit InitValue of "true" --> sync --> remove field --> sync --> doesn't work
- Change the type to integer --> sync --> remove field --> sync --> WORKS!
At first we thought it might be an issue with this field only, which would have been OK. But now we start getting the same issue on multiple different fields.
We recently upgraded from 18.5 to 18.16, could this have something to do with it?
I tried a Cronus-Db (18.16) --> install our modified base app with the field included --> remove field --> sync --> works!
That's why I'm relatively sure that there is some broken metadata in the database we are using. But how can we fix this?