Removing FK Columns used in Links in Ontology as Code Repos Breaks Install

I am attempting to install a new version of my ontology as code repo via markeplace. I am all the way through to the final checks and got 47 errors that prevent install similar to:
“The foreign key specified by a link type doesn’t exist as a property on the specified object type.”

These error appear to point at RIDs in the existing ontology, but they are hard to make out. I opened a seperate ticket on that topic here.

These FK relationships have been removed in my `mts` file and I have remapped the entire ontology to the new dataset schemas as part of the install process. This seems like a valid developer path as database schemas evolve over time. The behavior I could expect is the existing link types would be removed upon install, not that I am blocked on upgrade.

Is there a workaround or fix for this that can be issued? It’s currently blocking deployment to our customer’s dev environment. We were hoping to get through UAT this week as well with a production deployment next week.

One thing that would be really helpful is we could get a better understanding of the types of schema changes we can make and still install the ontology using marketplace. I found this document on the migration assistant here. But it doesn’t really mention link type of orphaned links. Something definitive can help us create data migration plans that can reject breaking changes that are unsupported and will result in a broken installation. Hopefully this is something that can be added natively to the checks at the repo layer. In the interim we’'ll try and create something.

My recommendation here would be, if you can, delete the existing link types from your ontology and then attempt the upgrade. We don’t yet have an auto-cleanup mechanism of dropped entities.

We have a prototype internally of an ontology as code break detector that should eventually catch errors like this. But timelines are a little long on that as we are rolling out over the next few months an improved ontology as code experience (which should be drop in replaceable with your current code and products) which is our teams main focus.

Understood. Do you know of a way to automate deleting the existing links? The OSDK does not appear to list any API operations for deleting link types either in Maker or in the APIs. Here is what I found in the docs related to links:

Existing API operations for link types:
- List Outgoing Link Types
- Get Outgoing Link Type
- Get Outgoing Link Types By Object Type Rid Batch

Existing API operations for linked objects:
- List Linked Objects
- Get Linked Object

Delete operations for link types / linked objects:
- None listed

Is my only option to reverse engineer the APIs via Chrome Dev Tools? That is generally again the license I think. The issue is there are 47 links to delete and doing it manually could take a while.

I wrote a script that is very hacky but worked. In two cases I had to delete by hand I did notice there is a bug in Ontology Manager. To delete a link you have to set the link type to experimental. If you do not save than change first, then proceed to delete and save changes again, you will get an error. So deleting links must be two steps if the link type is active:

  1. Set to experimental and save changes
  2. Delete the link and save.