schema.json entries (tables, etc.) should have a fromModuleVersion property that is set or updated whenever a change is made to that entry.
An entry cannot be removed, instead "tOps": "ADD" must be changed to "tOps": "DELETE".
This is error prone because it is a manual task.
Usability is bad because deleted entries have to stay in the schema.json forever.
Drop fromModuleVersion and tOps.
Save schema.json in the database. We already have the rmb_internal table that currently stores rmb and module version: https://github.com/folio-org/raml-module-builder/blob/v29.2.2/domain-models-runtime/src/main/resources/templates/db_scripts/main.ftl#L15
On upgrade compare the old schema.json and the new schema.json and create, update and delete accordingly.
Migration - How to initialize database schema.json entry
Module developers can provide any number of old schema.json version files alongside the current schema.json, adding the Edelweiss version is suggested. For example mod-inventory-storage should add schema.json-18.2.3 alongside schema.json in src/main/resources/templates/db_scripts.
If the database does not contain a schema.json then RMB upgrade will search for the schema.json-fromVersion file and initialize the database with it. If schema.json-fromVersion file is not found the old existing code for upgrading is used.
After upgrading the new schema.json file is saved in the database.