Skip to content

A data model reverse engineered from DDL

What this example shows

What the AI assistants produce when you point them at an existing system: a complete logical data model derived from a SQL schema and its written documentation, including a diagram.

It is the end state of Use the AI Assistants.

Branch: examplesai-assistantsuse

The input

The BrightGreen base ships a Wms-files/ folder containing a warehouse management system:

  • wms-schema.sql - the DDL: tables, columns, datatypes and foreign keys
  • wms-doc.pdf - the written documentation: what the tables mean in business terms

Neither is a CrossModel model. The DDL supplies the structure; the PDF supplies the meaning. That split matters - a reverse engineering pass driven by DDL alone produces technically correct entities with unhelpful names, and this example exists to show the difference.

The output

A Sources/WMS data model containing:

Object Notes
Warehouse Physical storage locations
Product Products held in stock
StockLevel Current stock per product per warehouse
StockTransaction Movements in and out
WarehouseStockLevel, ProductStockLevel Relationships into the stock level entity
WarehouseStockTransaction, ProductStockTransaction Relationships into the transaction entity
WMSDiagram A generated diagram of the whole model

What to look at

  • Names and descriptions. Entity and attribute descriptions come from the PDF, not the DDL. This is the clearest evidence that the assistant used both inputs rather than just parsing SQL.
  • Inferred relationships. The relationships were derived from the foreign keys and column naming in the schema. Check whether you agree with each one - reviewing inferred relationships is the main human step after a reverse engineering run.
  • The diagram. The assistant laid this out as part of the same request. It is a normal diagram: move nodes, add entities, or delete it and it changes nothing about the model itself.

Treat the output as a first draft

Reverse engineering gets you most of the way in minutes, but the result reflects what was in the DDL and the documentation. Names, cardinality and anything the source system left implicit are worth reviewing before you build on the model.

Where to go next