export_ddl
Generates the SQL DDL (CREATE TABLE + CHECK constraints + foreign keys with their ON DELETE/ON UPDATE actions) from the ERD, for postgres (default), mysql or sqlite. Exporting an inconsistent ERD produces broken SQL: analyze_data_model checks it upstream. ⚠️ warnings lists what the target dialect CANNOT express (each entry carries a code and names the table.column concerned). These losses are meant for the user, in plain words: a script exported without mentioning its losses suggests a faithful conversion. An empty list really means "nothing lost".
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dialect | No | Target SQL dialect (default 'postgres') | |
| ifNotExists | No | Add IF NOT EXISTS to the CREATE TABLEs (default true) | |
| expectedProjectId | No | UUID of the project targeted by THIS call. ACTUALLY targets this project instead of the session project. Refused without changing anything if access is not granted. | |
| inlineForeignKeys | No | Inline the FK constraints in the CREATE TABLE rather than in separate ALTER TABLEs (default false). IGNORED for sqlite, which does not know ALTER TABLE ADD FOREIGN KEY: keys are inlined there in every case, and the script emits `PRAGMA foreign_keys = ON`, without which sqlite does not enforce them. |