ormbridge 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/README.md +186 -37
  2. package/dist/cliRunner.js +1 -1
  3. package/dist/cliRunner.js.map +1 -1
  4. package/dist/emitters/drizzle.d.ts +19 -0
  5. package/dist/emitters/drizzle.js +1337 -0
  6. package/dist/emitters/drizzle.js.map +1 -0
  7. package/dist/emitters/jsonSchema.d.ts +20 -0
  8. package/dist/emitters/jsonSchema.js +503 -0
  9. package/dist/emitters/jsonSchema.js.map +1 -0
  10. package/dist/emitters/sqlDdl.d.ts +29 -0
  11. package/dist/emitters/sqlDdl.js +1741 -0
  12. package/dist/emitters/sqlDdl.js.map +1 -0
  13. package/dist/emitters/typeorm.js +53 -1
  14. package/dist/emitters/typeorm.js.map +1 -1
  15. package/dist/emitters/zod.d.ts +40 -0
  16. package/dist/emitters/zod.js +498 -0
  17. package/dist/emitters/zod.js.map +1 -0
  18. package/dist/formats.d.ts +4 -1
  19. package/dist/formats.js +62 -0
  20. package/dist/formats.js.map +1 -1
  21. package/dist/index.d.ts +14 -0
  22. package/dist/index.js +7 -0
  23. package/dist/index.js.map +1 -1
  24. package/dist/io.js +56 -8
  25. package/dist/io.js.map +1 -1
  26. package/dist/parsers/drizzle.d.ts +12 -0
  27. package/dist/parsers/drizzle.js +2040 -0
  28. package/dist/parsers/drizzle.js.map +1 -0
  29. package/dist/parsers/jsonSchema.d.ts +21 -0
  30. package/dist/parsers/jsonSchema.js +1432 -0
  31. package/dist/parsers/jsonSchema.js.map +1 -0
  32. package/dist/parsers/sqlDdl.d.ts +18 -0
  33. package/dist/parsers/sqlDdl.js +2302 -0
  34. package/dist/parsers/sqlDdl.js.map +1 -0
  35. package/dist/parsers/sqlSyntax.d.ts +79 -0
  36. package/dist/parsers/sqlSyntax.js +698 -0
  37. package/dist/parsers/sqlSyntax.js.map +1 -0
  38. package/dist/parsers/sqlTypes.d.ts +53 -0
  39. package/dist/parsers/sqlTypes.js +742 -0
  40. package/dist/parsers/sqlTypes.js.map +1 -0
  41. package/dist/parsers/typeorm.js +22 -7
  42. package/dist/parsers/typeorm.js.map +1 -1
  43. package/dist/prismaOnlyConstructs.d.ts +2 -2
  44. package/dist/prismaOnlyConstructs.js +5 -5
  45. package/dist/prismaOnlyConstructs.js.map +1 -1
  46. package/package.json +2 -1
package/README.md CHANGED
@@ -2,16 +2,21 @@
2
2
 
3
3
  Convert ORM models between frameworks and languages, so one data model can be shared across your whole stack, from the command line or from code.
4
4
 
5
- | Format | Read | Write | Notes |
6
- | --------------------------- | :--: | :---: | ----------------------------------------------------------- |
7
- | Django models | ✔ | ✔ | `models.py` files or `models/` packages |
8
- | Prisma schema | ✔ | ✔ | All six providers; Prisma 7 header via `--prisma-version 7` |
9
- | TypeORM entities | ✔ | ✔ | Decorator-based entity classes |
10
- | Doctrine ORM entities (PHP) | ✔ | ✔ | PHP 8 attributes; writes one file per entity |
11
- | Laravel (PHP) | ✔ | ✔ | Reads migrations plus Eloquent models; writes both |
12
- | GORM (Go) | ✔ | ✔ | Structs with `gorm` tags; writes one file per model |
13
- | TypeScript interfaces | | ✔ | Plain interfaces and enums for front ends |
14
- | Graphene (graphene-django) | | ✔ | GraphQL types, queries and mutations that pair with Django |
5
+ | Format | Read | Write | Notes |
6
+ | --------------------------- | :--: | :---: | --------------------------------------------------------------------- |
7
+ | Django models | ✔ | ✔ | `models.py` files or `models/` packages |
8
+ | Prisma schema | ✔ | ✔ | All six providers; Prisma 7 header via `--prisma-version 7` |
9
+ | TypeORM entities | ✔ | ✔ | Decorator-based entity classes |
10
+ | Doctrine ORM entities (PHP) | ✔ | ✔ | PHP 8 attributes; writes one file per entity |
11
+ | Laravel (PHP) | ✔ | ✔ | Reads migrations plus Eloquent models; writes both |
12
+ | GORM (Go) | ✔ | ✔ | Structs with `gorm` tags; writes one file per model |
13
+ | Drizzle ORM (TypeScript) | ✔ | ✔ | `pgTable` / `mysqlTable` / `sqliteTable` plus `relations()` |
14
+ | JSON Schema / OpenAPI | ✔ | ✔ | Draft 2020-12, 2019-09 and 7, and OpenAPI `components.schemas` (JSON) |
15
+ | SQL DDL | ✔ | | `CREATE TABLE` and friends for PostgreSQL, MySQL, SQLite, SQL Server |
16
+ | TypeScript interfaces | | ✔ | Plain interfaces and enums for front ends |
17
+ | Graphene (graphene-django) | | ✔ | GraphQL types, queries and mutations that pair with Django |
18
+ | Zod schemas | | ✔ | Zod 4 schemas and inferred types for validation |
19
+ | SQL DDL | | ✔ | One `.sql` script for PostgreSQL, MySQL, SQLite or SQL Server |
15
20
 
16
21
  See [What is converted](#what-is-converted) for the field-level mapping and [docs/CONVERSION_MATRIX.md](docs/CONVERSION_MATRIX.md) for exactly what survives a round trip between the readable formats.
17
22
 
@@ -56,28 +61,39 @@ ormbridge convert -i ./my-laravel-app --from laravel -o ./prisma/schema.prisma
56
61
 
57
62
  # GORM (Go structs with gorm tags) -> Prisma (every .go file is read; vendor/, testdata/ and *_test.go are skipped)
58
63
  ormbridge convert -i ./internal/models --from gorm -o ./prisma/schema.prisma
64
+
65
+ # Drizzle ORM (pgTable / mysqlTable / sqliteTable) -> Prisma (every .ts file is read and the tables are picked out; node_modules/, *.d.ts and *.test.ts are skipped)
66
+ ormbridge convert -i ./src/db/schema --from drizzle -o ./prisma/schema.prisma
67
+
68
+ # JSON Schema or an OpenAPI document (JSON) -> Django (every .json file of a directory is read; several files may refer to each other)
69
+ ormbridge convert -i ./schemas --from json-schema -o ./blog/models.py
70
+ ormbridge convert -i ./openapi.json --from json-schema --to prisma -o ./prisma/schema.prisma
71
+
72
+ # SQL DDL (a pg_dump / mysqldump / sqlite .dump / SSMS script, or a folder of migrations) -> Prisma (every .sql file is read in name order; node_modules/, vendor/ and rollback scripts such as *.down.sql are skipped)
73
+ ormbridge convert -i ./schema.sql -o ./prisma/schema.prisma
74
+ ormbridge convert -i ./db/migrations --from sql --to django -o ./blog/models.py
59
75
  ```
60
76
 
61
- Formats are inferred from file extensions (`.py` = Django, `.prisma` = Prisma, `.ts` = TypeORM), or set explicitly with `--from` / `--to`. Passing a directory does not infer the format, so add `--from typeorm` (or `--from doctrine`, `--from laravel`, `--from gorm`) when reading a folder of entities; `.php` and `.go` are not inferred either. Run `ormbridge formats` to list every supported format, its file extensions, and whether it can be read, written, or both. Without `-o`, the result is printed to stdout. Warnings go to stderr.
62
-
63
- | Flag | Default | Description |
64
- | ------------------------- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
65
- | `-i, --input <paths...>` | required (or config) | Files or directories to read. Several files are merged into one schema, so abstract base classes can live in another file. |
66
- | `-o, --output <path>` | stdout | File to write. Parent directories are created. |
67
- | `-f, --from <format>` | inferred | `django`, `prisma`, `typeorm`, `doctrine`, `laravel` or `gorm` |
68
- | `-t, --to <format>` | inferred | `django`, `prisma`, `typeorm`, `doctrine`, `laravel` or `gorm` (the last three write a directory), `typescript` or `graphene` (output only) |
69
- | `--naming <mode>` | `preserve` | `preserve` or `normalize` (see below) |
70
- | `--provider <name>` | `postgresql` | Prisma datasource: `postgresql`, `mysql`, `sqlite`, `sqlserver`, `mongodb`, `cockroachdb`. Controls native types such as `@db.VarChar`. |
71
- | `--no-header` | off | Omit the Prisma `generator` / `datasource` blocks (useful when pasting models into an existing schema). |
72
- | `--app-label <name>` | directory name | Django app label used for default table names (`<app>_<model>`). |
73
- | `--auto-field <type>` | `int` | Key type for Django models without an explicit primary key: `int` or `bigint`. |
74
- | `--namespace <name>` | `App\Entity`, `App\Models` | PHP namespace of the Doctrine entities or Laravel models (`--to doctrine` / `--to laravel` only). Enums go in a sibling namespace. |
75
- | `--go-package <name>` | `models` | Go package name of the GORM models, also the output sub-directory (`--to gorm` only). Must be a valid Go identifier. |
76
- | `--prisma-version <6\|7>` | `6` | Prisma major version of the header (`--to prisma` only). `7` writes the `prisma-client` generator (with an `output`) and no datasource `url`. |
77
- | `--dry-run` | off | Run the whole conversion and report what would be written, without touching the filesystem. |
78
- | `--check` | off | Exit with code 3 if an output file is missing or differs from the conversion. Writes nothing. Needs an output path. |
79
- | `--config <path>` | searched | Read settings from this JSON config file instead of searching for one. |
80
- | `--no-config` | off | Ignore any config file. |
77
+ Formats are inferred from file extensions (`.py` = Django, `.prisma` = Prisma, `.ts` = TypeORM, `.sql` = SQL), or set explicitly with `--from` / `--to`. Passing a directory does not infer the format, so add `--from typeorm` (or `--from drizzle`, `--from json-schema`, `--from doctrine`, `--from laravel`, `--from gorm`) when reading a folder of entities (or `--from sql` for a folder of `.sql` files); `.php`, `.go` and `.json` are not inferred either, and `.ts` always means TypeORM, so Drizzle needs `--from drizzle`. Run `ormbridge formats` to list every supported format, its file extensions, and whether it can be read, written, or both. Without `-o`, the result is printed to stdout. Warnings go to stderr.
78
+
79
+ | Flag | Default | Description |
80
+ | ------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
81
+ | `-i, --input <paths...>` | required (or config) | Files or directories to read. Several files are merged into one schema, so abstract base classes can live in another file. |
82
+ | `-o, --output <path>` | stdout | File to write. Parent directories are created. |
83
+ | `-f, --from <format>` | inferred | `django`, `prisma`, `typeorm`, `drizzle`, `doctrine`, `laravel`, `gorm`, `json-schema` or `sql` |
84
+ | `-t, --to <format>` | inferred | `django`, `prisma`, `typeorm`, `drizzle`, `doctrine`, `laravel`, `gorm` or `json-schema` (`drizzle`, `doctrine`, `laravel` and `gorm` write a directory), `typescript`, `zod`, `sql` or `graphene` (output only) |
85
+ | `--naming <mode>` | `preserve` | `preserve` or `normalize` (see below) |
86
+ | `--provider <name>` | `postgresql` | Database: `postgresql`, `mysql`, `sqlite`, `sqlserver`, `mongodb`, `cockroachdb`. Controls Prisma native types such as `@db.VarChar`, the Drizzle and GORM dialect and the SQL dialect of `--to sql` (`postgresql`, `mysql`, `sqlite` or `sqlserver`). |
87
+ | `--no-header` | off | Omit the Prisma `generator` / `datasource` blocks (useful when pasting models into an existing schema). |
88
+ | `--app-label <name>` | directory name | Django app label used for default table names (`<app>_<model>`). |
89
+ | `--auto-field <type>` | `int` | Key type for Django models without an explicit primary key: `int` or `bigint`. |
90
+ | `--namespace <name>` | `App\Entity`, `App\Models` | PHP namespace of the Doctrine entities or Laravel models (`--to doctrine` / `--to laravel` only). Enums go in a sibling namespace. |
91
+ | `--go-package <name>` | `models` | Go package name of the GORM models, also the output sub-directory (`--to gorm` only). Must be a valid Go identifier. |
92
+ | `--prisma-version <6\|7>` | `6` | Prisma major version of the header (`--to prisma` only). `7` writes the `prisma-client` generator (with an `output`) and no datasource `url`. |
93
+ | `--dry-run` | off | Run the whole conversion and report what would be written, without touching the filesystem. |
94
+ | `--check` | off | Exit with code 3 if an output file is missing or differs from the conversion. Writes nothing. Needs an output path. |
95
+ | `--config <path>` | searched | Read settings from this JSON config file instead of searching for one. |
96
+ | `--no-config` | off | Ignore any config file. |
81
97
 
82
98
  ### Dry run and check
83
99
 
@@ -152,7 +168,7 @@ To fail CI when generated files are stale:
152
168
 
153
169
  ### Multi-file output
154
170
 
155
- Most formats produce one text, written to the `-o` file. A format can instead return several files (a map of relative path to text; the Doctrine, Laravel and GORM formats do this). Then `-o` must be a directory (for example `ormbridge convert -i ./models.py --to doctrine -o ./`, or `--to laravel -o ./` to write `app/` and `database/migrations/` into a Laravel project): every file is written beneath it, creating folders as needed, and `--dry-run` and `--check` cover each file. If `-o` is an existing file or looks like a file path (it has an extension), ormbridge fails with a message listing the files and asking for a directory. See "Emitter output" under [Format registry](#format-registry) for the adapter side.
171
+ Most formats produce one text, written to the `-o` file. A format can instead return several files (a map of relative path to text; the Doctrine, Laravel, GORM and Drizzle formats do this). Then `-o` must be a directory (for example `ormbridge convert -i ./models.py --to doctrine -o ./`, or `--to laravel -o ./` to write `app/` and `database/migrations/` into a Laravel project): every file is written beneath it, creating folders as needed, and `--dry-run` and `--check` cover each file. If `-o` is an existing file or looks like a file path (it has an extension), ormbridge fails with a message listing the files and asking for a directory. See "Emitter output" under [Format registry](#format-registry) for the adapter side.
156
172
 
157
173
  [Back to Table of Contents](#table-of-contents)
158
174
 
@@ -251,7 +267,18 @@ GORM output (`--to gorm`) is write-only and writes a directory, so pass `-o <dir
251
267
  - **Naming.** `preserve` keeps the source's table and column names (explicit `TableName()` / `column:` wherever GORM's convention would differ). `normalize` applies GORM's conventions: plural snake_case tables (`posts`, join tables keep their names), snake_case columns, and `created_at` / `updated_at` where missing; primary keys keep their type (unlike Prisma output, no UUID keys are introduced).
252
268
  - **Lossy or unsupported.** Integers are signed `int32` / `int64` (the IR has no unsigned types). Arrays become `datatypes.JSONSlice[T]`, HStore `datatypes.JSON`, durations `time.Duration` (nanoseconds in a bigint), ranges strings; generated columns, views, composite foreign keys, `Unsupported(...)` columns (written as `string` with `type:<name>`), full-text indexes and index options, `@@schema` and other Prisma-only constructs are written as plain tables and columns; a relation to a model without a single-column primary key is skipped; each case warns with the model and field. The IR has no check constraints, column comments or polymorphic relations, so no `check:`, `comment:` or `polymorphic:` tags are written. GORM is relational, so `--provider mongodb` only warns. The output needs `gorm.io/gorm`, plus `github.com/google/uuid`, `github.com/shopspring/decimal` and `gorm.io/datatypes` for the types that use them (`go get` them in your module).
253
269
 
254
- Graphene output (`--to graphene`) is write-only and pairs with Django models: it writes one Python file that imports every model from `.models` (generate it with `--to django`, or use your own models) and defines a `DjangoObjectType` per model with an explicit `Meta.fields` list (forward and reverse relations included), a `Query` with a single-item field (`post(id)`) and a list field (`post_list`) per model, `Create`/`Update`/`Delete` mutations built on `graphene.Mutation`, and a final `schema = graphene.Schema(query=Query, mutation=Mutation)`. Inputs map the scalar types to `String`, `Int`, `BigInt`, `Float`, `Decimal`, `Boolean`, `DateTime`, `Date`, `Time`, `UUID` and `JSONString`; a field is required when it is not nullable and has no default, and relations are `ID` inputs (`author_id`, many-to-many `tags_ids`). Enum-backed fields rely on graphene-django's choice conversion for output and are `String` inputs validated by the model. Binary columns and relations to models outside the schema are left out, and models with a composite primary key get only a list query and a create mutation; each case produces a warning naming the model and field. Field names are snake_case like the Django output, `.py` stays owned by Django so pass `--to graphene`, and the naming mode has no effect. Requires graphene-django 3.x at runtime. The tests import the generated schema next to the generated Django models with the real Django and graphene-django when they are installed (`DJANGO_PYTHON`), build it, run the introspection query and create, read, update and delete rows through it.
270
+ Drizzle output (`--to drizzle`) is write-only and writes a directory, so pass `-o <directory>`: `schema.ts` (every enum, table and `relations()` in one file) and `drizzle.config.ts` (`defineConfig` with the matching `dialect`, `schema: './schema.ts'` and `out: './drizzle'`, so `npx drizzle-kit generate` works next to it). One file keeps every table in reach of the others and is what `drizzle-kit` reads without a glob; the tables are ordered so a table follows the tables it references, which keeps circular references compiling without splitting them across modules. `.ts` is not inferred, so pass `--to drizzle`. `drizzle-orm` 0.36 or newer is needed (the table callback returns an array), and `drizzle-kit` for the config.
271
+
272
+ - **Dialects.** `--provider` picks `drizzle-orm/pg-core` (`postgresql`, `cockroachdb`), `mysql-core` (`mysql`) or `sqlite-core` (`sqlite`); each gets its own table function (`pgTable`, `mysqlTable`, `sqliteTable`) and only the builders it uses are imported. Drizzle has no SQL Server or MongoDB dialect, so those two write PostgreSQL tables and warn.
273
+ - **Columns.** Typed builders with the database name as the first argument: `varchar({ length })` (`text` when the source has no length; MySQL needs a length and gets 255), `text`, `integer` / `int`, `bigint({ mode: 'number' })`, `doublePrecision` / `double` / `real`, `numeric` / `decimal({ precision, scale })`, `boolean`, `timestamp({ withTimezone: true })` / `datetime`, `date`, `time`, `uuid` / `char(36)`, `jsonb` / `json`, `inet`, `interval`. On SQLite dates are `integer({ mode: 'timestamp' })`, booleans `integer({ mode: 'boolean' })`, JSON `text({ mode: 'json' })`, decimals `numeric` and UUIDs `text`. `.notNull()` on required columns, `.unique()` (with the constraint name when the source has one), `.array()` for PostgreSQL arrays, and `customType` declarations at the top of the file for the PostgreSQL types Drizzle has no builder for (`bytea`, `hstore`, ranges).
274
+ - **Keys and defaults.** An auto-increment key is `serial` / `bigserial` (PostgreSQL), `.autoincrement()` (MySQL) or `.primaryKey({ autoIncrement: true })` (SQLite). A UUID key is `uuid().defaultRandom()`, `.default(sql`(UUID())`)` on MySQL and `$defaultFn(() => crypto.randomUUID())` on SQLite (with a warning: that default only runs for rows inserted through Drizzle). `now` is `.defaultNow()`, `CURRENT_TIMESTAMP` or `(unixepoch())`; literals are `.default(...)` (JSON as an object literal, decimals as strings, date-times as `new Date(...)`); an auto-updated column is `.$onUpdate(() => new Date())`.
275
+ - **Enums.** Every enum exports its values (`export const postStatusValues = [...] as const`) and a union type. PostgreSQL adds `pgEnum('name', values)`, MySQL uses `mysqlEnum('column', values)` on the column, SQLite uses `text('column', { enum: values })` (TypeScript only; SQLite gets no check constraint).
276
+ - **Relations.** A foreign key is `.references(() => table.id, { onDelete, onUpdate })` (the NO ACTION default is left out; MySQL has no SET DEFAULT and warns), typed after the column it points at (a UUID key gives a `uuid` foreign key). A reference to a table declared later, and a self reference, is annotated `(): AnyPgColumn =>` (`AnyMySqlColumn`, `AnySQLiteColumn`) so TypeScript does not report a circular initializer. `relations()` is written for both sides of every relation: `one()` with `fields` and `references` on the owner, `many()` (`one()` for a one-to-one) on the target, named after `related_name` or the plural of the model; `relationName` is added to both sides when two relations join the same tables or a table points at itself. A many-to-many relation becomes the explicit join table Django creates (a surrogate `id`, two cascading foreign keys, a unique pair) in both naming modes.
277
+ - **Indexes and keys.** `index('name').on(table.a, table.b)`, `uniqueIndex(...)` and `primaryKey({ columns: [...] })` (composite keys) in the table callback; unnamed indexes are named `<table>_<columns>_idx` / `_key`, shortened to 63 characters.
278
+ - **Names.** TypeScript keys are camelCase in both modes (`createdAt`); tables are camelCase variables of the model name with `export type Post` / `NewPost` row types. `preserve` keeps the source's table, column and enum names as the string arguments; `normalize` applies the fresh-schema style (singular snake_case tables, UUID keys, `created_at` / `updated_at`, snake_case columns).
279
+ - **Lossy or unsupported.** Arrays, hstore and ranges outside PostgreSQL become JSON, text or varchar columns and durations integers (microseconds); generated columns (Python), composite foreign keys, views (written as tables), index types, sort orders and operator classes, full-text indexes, `Unsupported(...)` columns and `@@schema` are written as plain tables and columns; client-generated (`cuid()`) and database-expression defaults are dropped; each case warns with the model and field. The IR has no check constraints or column comments, so none are written. The tests compile the output with `tsc --strict`, run `drizzle-kit generate` for all three dialects, `drizzle-kit push` into SQLite and compare the result (and Drizzle's relational configuration) with the schema when Drizzle is installed (`DRIZZLE_DIR`, see `test/README.md`).
280
+
281
+ Graphene output (`--to graphene`) is write-only and pairs with Django models: it writes one Python file that imports every model from `.models` (generate it with `--to django`, or use your own models) and defines a `DjangoObjectType` per model with an explicit `Meta.fields` list (forward and reverse relations included), a `Query` with a single-item field (`post(id)`) and a list field (`post_list`) per model, `Create`/`Update`/`Delete` mutations built on `graphene.Mutation`, and a final `schema = graphene.Schema(query=Query, mutation=Mutation)`. Inputs map the scalar types to `String`, `Int`, `BigInt`, `Float`, `Decimal`, `Boolean`, `DateTime`, `Date`, `Time`, `UUID` and `JSONString`; a field is required when it is not nullable and has no default, and relations are `ID` inputs (`author_id`, many-to-many `tags_ids`). Enum-backed fields rely on graphene-django's choice conversion for output and are `String` inputs validated by the model. Binary columns and relations to models outside the schema are left out, and models with a composite primary key get only a list query and a create mutation; each case produces a warning naming the model and field. Field names are snake_case like the Django output, `.py` stays owned by Django so pass `--to graphene`, and the naming mode has no effect. Requires graphene-django 3.x at runtime. The tests import the generated schema next to the generated Django models (or, for a Django source, the source models with `django.contrib.auth` installed as the user model) with the real Django and graphene-django when they are installed (`DJANGO_PYTHON`), build it, run the introspection query and create, read, update and delete rows through it.
255
282
 
256
283
  Django-only constructs: a proxy model (`Meta.proxy = True`) has no table of its own, so it is merged into its concrete model (chains of proxies are followed) and relations that target it are pointed at the concrete model, with a warning. A model with `Meta.swappable = "AUTH_USER_MODEL"` is used as the target of `settings.AUTH_USER_MODEL` and `get_user_model()` instead of an assumed `User`. Custom managers (`objects = MyManager()`, `Manager.from_queryset(...)()`, `QuerySet.as_manager()`) and the classes behind them are ignored without warnings. `django.contrib.postgres` arrays, HStore and range fields, and `GeneratedField` / `db_default` (Django 5.0+), round-trip through `--to django`; the Django emitter writes the `django.contrib.postgres.fields` import and notes the required Django version in a warning.
257
284
 
@@ -317,6 +344,82 @@ Names follow GORM's own conventions, so the database names are reproduced exactl
317
344
  | `type Status string` with typed constants | an enum (`StatusDraft` is the member `Draft`); the column keeps its length and an enum default |
318
345
  | `TableName()` returning a literal or a constant | the table name |
319
346
 
347
+ ### Drizzle ORM (`--from drizzle`)
348
+
349
+ Drizzle's schema is TypeScript code, so `--from drizzle` reads it with the tree-sitter TypeScript grammar (no Node project, `drizzle-orm` install or database is needed, and none of your code is run). Pass the folder that holds the schema, or the files; every `.ts` file is read (not `*.d.ts`, `*.test.ts`, `*.spec.ts` or anything below `node_modules/`) and only the tables, enums and `relations()` in them are used. `.ts` is TypeORM's extension, so Drizzle is never inferred. The dialect comes from the table function: `pgTable`, `mysqlTable` and `sqliteTable`, `pgSchema('x').table(...)` and `mysqlSchema(...)`, and tables made with `pgTableCreator((name) => `app_${name}`)` (a plain template prefix or suffix is applied). SingleStore, Gel, SQL Server and CockroachDB tables are reported and skipped. Drizzle has no table classes, so a model is named after the variable (`blogPosts` becomes `BlogPost`), the TS property key is the field name and the string argument of the column builder is the column name (when there is none, the key is used, so a `casing` option set when the database is opened is not seen).
350
+
351
+ | Drizzle | Read as |
352
+ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
353
+ | `integer`, `smallint`, `bigint({ mode })`, `int`, `tinyint`, `mediumint`, `year`, `serial`, `bigserial` | `int` or `bigInt` (PostgreSQL `serial` / `bigserial` are auto-increment and required; MySQL `serial` is an auto-increment, unique, required `bigInt`; `unsigned` is dropped with a warning) |
354
+ | `real`, `doublePrecision`, `float`, `double`, `numeric` / `decimal({ precision, scale })` | `float`, `decimal` with its digits and scale |
355
+ | `varchar`, `char`, `text`, `tinytext` to `longtext`, `boolean`, `uuid`, `json`, `jsonb`, `date`, `time`, `timestamp`, `datetime`, `interval`, `inet`, `binary`, `varbinary` | `string` (with `length`), `text`, `boolean`, `uuid`, `json`, `date`, `time`, `dateTime`, `duration`, `ipAddress`, `bytes`; `.array()` adds an array dimension |
356
+ | SQLite `integer`, `text`, `blob` with `{ mode }` | `integer`: `int`, `boolean` or `dateTime` (`'timestamp'`, with a warning that it is stored as Unix time); `text`: `text` or `json`; `blob`: `bytes`, `json` or `bigInt` |
357
+ | `point`, `line`, `geometry`, `vector`, `cidr`, `macaddr`, `bit`, custom types | an unsupported column with its SQL type, and a warning |
358
+ | `.notNull()`, `.primaryKey()`, `.unique(name?)`, `.autoincrement()`, `.generatedAlwaysAsIdentity()` | required (columns are nullable unless marked, as in Drizzle), primary key, unique (with its constraint name), auto-increment |
359
+ | `.default(...)`, `.defaultNow()`, `.defaultRandom()`, ``.default(sql`...`)`` | a literal, JSON text, enum member, `now`, generated UUID or SQL expression; a default that is not static is dropped with a warning |
360
+ | `.$defaultFn(...)`, `.$default(...)` | a client-side default: `new Date()` becomes `now` and `crypto.randomUUID()` a generated UUID (on date-time and UUID columns), anything else is dropped; always with a warning |
361
+ | `.$onUpdate(...)`, `.onUpdateNow()` | an auto-updated date-time column (a redundant `defaultNow()` is not kept, as for Prisma `@updatedAt`) |
362
+ | ``.generatedAlwaysAs(sql`...`, { mode })`` | a generated column (the expression is kept as written) |
363
+ | `pgEnum('name', [...])`, `schema.enum(...)`, `mysqlEnum('col', [...])` | an enum (member names are the upper-case snake spelling of the values; the database name and schema are kept); a `mysqlEnum` column gets an enum named after the table and column |
364
+ | `.references(() => users.id, { onDelete, onUpdate })`, single-column `foreignKey({ ... })` | a foreign key relation; the column is replaced by the relation (named by the `one(...)` entry of `relations()`, otherwise the column name without `Id`); a unique or primary key column makes it one-to-one |
365
+ | `relations(table, ({ one, many }) => ...)`, `relationName` | relation names and reverse sides: `one(target, { fields, references })` names the owning side, `many(target)` and a field-less `one(target)` name the reverse side, `relationName` tells several relations apart |
366
+ | composite `foreignKey({ columns, foreignColumns })`, composite `primaryKey({ columns, name })` | a composite foreign key (the columns stay plain fields) and a composite primary key |
367
+ | `index()`, `uniqueIndex()`, `unique()` with `.on(...)`, `.using('gin', ...)`, `.desc()`, `.op(...)` | indexes and unique constraints (a single unnamed unique becomes a unique field), with access method, sort order and operator class |
368
+ | a join table with two foreign keys and a composite key | stays a model, as for Prisma's explicit many-to-many; it is not folded into a many-to-many field |
369
+ | column objects shared with `...spread` (also from a function call), one-level column helpers | the columns are expanded in place |
370
+
371
+ ### JSON Schema and OpenAPI (`--from json-schema`)
372
+
373
+ `--from json-schema` reads JSON Schema (draft 2020-12, 2019-09 and 7) and the `components.schemas` of OpenAPI 3.x (and Swagger 2 `definitions`) documents. It is plain JSON, so nothing is installed or run. Only JSON is read: ormbridge has no YAML parser, so convert a YAML OpenAPI document to JSON first (the error says so). It is read only for now (there is no `--to json-schema` yet). `.json` is too generic to infer and `.schema.json` is not an extension the registry can match (it looks at the last extension only), so pass `--from json-schema`. A directory is read recursively: every `.json` file, except tool configuration (`package.json`, `tsconfig*.json`, ...) and anything below `node_modules/`, `vendor/`, `dist/`, `build/`, `coverage/` and `.git/`.
374
+
375
+ Every object schema with properties under `$defs`, `definitions` or `components.schemas` is a model (named after its key), and so is a root object schema (named after its `title`, `$id` or file name). Enums, aliases of scalar types and free-form objects are not models.
376
+
377
+ | JSON Schema | Read as |
378
+ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
379
+ | `properties`, `required` | the fields; a property that is not in `required`, has `type: [..., "null"]`, `nullable: true` (OpenAPI 3.0), an `anyOf` / `oneOf` with `{"type": "null"}` or an `enum` with `null` is nullable |
380
+ | `type: string` without `maxLength`; with `maxLength` | `text`; a `string` of that length |
381
+ | `format`: `date-time`, `date`, `time`, `uuid`, `duration`, `ipv4`, `ipv6`, `byte` / `binary` / `contentEncoding: base64` | `dateTime`, `date`, `time`, `uuid`, `duration`, `ipAddress`, `bytes`; other formats (`email`, `uri`, ...) stay strings |
382
+ | `type: integer`, `format: int32` / `int64`; `type: number`, `format: float` / `double` | `int` / `bigInt`; `float` |
383
+ | `format: decimal` (on a string or a number), `x-precision`, `x-scale`, `multipleOf: 0.01` | `decimal` with digits and places |
384
+ | `boolean`; `object`, an untyped schema, `{}` | `boolean`; `json` |
385
+ | `array` of scalars (nested arrays too) | an array column of that type |
386
+ | `enum` of strings, `oneOf` / `anyOf` of `{const, title}`, `x-enum-varnames` | an enum named after the `$defs` entry it is defined in, otherwise after the property (`account_state` becomes `AccountState`); member names are the upper-case value (`in-progress` becomes `IN_PROGRESS`), labels come from `title`. The same values share one enum, a clash gets the model name as a prefix |
387
+ | `default` | a literal default (a JSON default is stored as text, an enum default names the member); a date-time default of `now`, `now()` or `CURRENT_TIMESTAMP` is the current time |
388
+ | `readOnly: true` | generated by the database: an integer primary key counts up, a uuid is generated, a date-time is set on insert (`updated...` names are refreshed on every save) |
389
+ | `x-unique`, `x-index`, `x-indexes: [{fields, unique, name}]` (model), `x-table-name` (model) | a unique column, indexes, the table name (the model name otherwise) |
390
+ | a property named `id` or `<model>Id`, `x-primary-key` (property, several make a composite key, or a model-level array of names) | the primary key; a model without one gets an integer `id` and a warning |
391
+ | `$ref` to another model (also inside `allOf: [{...}]`, `anyOf` with null, or with sibling keywords) | a foreign key (required means not null; `x-on-delete`: `cascade`, `set null`, `restrict`, `no action`, `set default`; `x-related-name`) named `<property>_id`, or the declared `authorId` / `author_id` property next to it |
392
+ | an array of `$ref` to a model that references this one | the reverse side of that foreign key (its `relatedName`); with several candidates `x-related-name` on the foreign key picks one |
393
+ | arrays of each other on both models | a many-to-many field on the model defined first |
394
+ | single references that point at each other | a one-to-one relation; the required side holds the key (a warning when that decides nothing) |
395
+ | `$ref` pointers (`#/$defs/X`, `#/definitions/X`, `#/components/schemas/X`, `#`), `$id`-relative references and relative file references between the input files | followed; a remote reference that is not an input file, a missing target, a named anchor or a reference cycle that never reaches an object keeps the property as a `json` column and warns |
396
+ | `allOf` composition | the properties of every member are merged into the model (inheritance is flattened, with a warning) |
397
+
398
+ A property that is not in `required` is nullable unless it has a `default` or is `readOnly` (the database fills it in). The conventions of ormbridge's own JSON Schema output are read back: a foreign key scalar (`author_id`) next to an optional `$ref` property (`author`) is one relation whose nullability is the scalar's, reverse sides are arrays that are matched with the foreign keys that point at the model (by `x-related-name`, otherwise by position when the counts agree, with a warning), `readOnly` columns are generated, and `bigInt` and `decimal` columns written as patterned strings (`^-?[0-9]+$`, `^-?[0-9]{1,6}(\.[0-9]{1,2})?$`) are read as `bigInt` and `decimal(8, 2)`. Table names, unique constraints, indexes, referential actions, enum labels and the exact owner of a many-to-many field are not JSON Schema keywords, so they only survive through the `x-` conventions above.
399
+
400
+ Losses, each reported as a warning naming the model and property: `description` / `title` (the IR has no comments), validation keywords (`minimum`, `pattern`, ...), `oneOf` / `anyOf` unions (a property becomes `json`; a `oneOf` of models is not a model), `patternProperties`, maps (`additionalProperties` with a schema), `if` / `then` / `else`, type unions, tuple arrays, nested inline objects (a `json` column; define them under `$defs` to make them models), arrays of models inside other arrays and non-string enums (the plain type is kept). An array of models with no counterpart on the other model gets a nullable foreign key on that model (JSON Schema cannot say who holds the key). The `x-` keywords above are ormbridge's own conventions and are ignored by other tools. [docs/CONVERSION_MATRIX.md](docs/CONVERSION_MATRIX.md) lists what the reader cannot express.
401
+
402
+ ### SQL DDL (`--from sql`)
403
+
404
+ `--from sql` reads the SQL that creates a database: a `pg_dump --schema-only`, `mysqldump --no-data` or SQLite `.dump` script, an SSMS-generated script, hand-written DDL, or a folder of plain `.sql` migrations (read in file-name order, so later `ALTER TABLE` statements apply to earlier tables; `*.down.sql`, `*_rollback.sql`, `undo.sql` and similar rollback scripts are skipped). PostgreSQL, MySQL / MariaDB, SQLite and SQL Server are understood, each file in its own dialect, guessed from characteristic syntax (backticks and `ENGINE=`, `AUTOINCREMENT`, `[brackets]` and `GO`, `serial` and `::` casts) and read as PostgreSQL when nothing decides it; `parseSqlDdl` takes a `dialect` option to force one. `tree-sitter-wasms` has no SQL grammar, so a small static tokenizer and statement parser read the text (comments, every quoting style, string escapes, `$$` dollar quoting, `DELIMITER` and `GO` batches, `COPY ... FROM stdin` data and schema-qualified names); nothing is executed and no database is needed. `.sql` is claimed, so a single file infers the format.
405
+
406
+ | Statement | Read as |
407
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
408
+ | `CREATE TABLE [IF NOT EXISTS] [schema.]name (...)` | a model named after the table in singular PascalCase (`blog_posts` is `BlogPost`); the table name is kept as written, and a schema other than `public`, `dbo` or `main` is kept as the model schema |
409
+ | column types | `smallint` / `integer` / `tinyint` / `year` are `int`, `bigint` is `bigInt`, `real` / `float` / `double` are `float`, `numeric(p, s)` / `decimal` / `money` (SQL Server) are `decimal` with their digits and places, `varchar(n)` / `char(n)` a string of that length, the `text` family, an unbounded `varchar` and `varchar(max)` are `text`, `boolean` / `bit(1)` / `tinyint(1)` (MySQL) are `boolean`, `timestamp` / `timestamptz` / `datetime` / `datetime2` / `datetimeoffset` are `dateTime`, plus `date`, `time`, `interval`, `uuid` / `uniqueidentifier`, `json` / `jsonb`, `bytea` / `blob` / `varbinary`, `inet`, `hstore`, range types and arrays (`int[]`, `text ARRAY`); SQLite types follow its affinity rules; `UNSIGNED`, display widths and time zones are dropped, and a type with no equivalent (`geometry`, `tsvector`, `xml`, `rowversion`) is an `unsupported` column that keeps its type text |
410
+ | `NOT NULL`, `NULL`, `PRIMARY KEY`, `UNIQUE`, `CONSTRAINT name ...` | nullability, the primary key (several columns make a composite key), unique columns (a constraint name is kept) and unique indexes; a primary key column is never nullable |
411
+ | `DEFAULT` | literals, `true` / `false`, `now()` / `CURRENT_TIMESTAMP` / `getdate()` / `datetime('now')` (the current time), uuid generators (`gen_random_uuid()`, `uuid_generate_v4()`, `NEWID()`, `UUID()`), enum members and `nextval(...)`; any other expression is kept as a database expression |
412
+ | `serial`, `GENERATED ... AS IDENTITY`, `AUTO_INCREMENT`, `AUTOINCREMENT`, `IDENTITY(1,1)`, SQLite `INTEGER PRIMARY KEY` | an auto-incrementing key |
413
+ | `GENERATED ALWAYS AS (...) STORED` / `VIRTUAL`, SQL Server `AS (...) PERSISTED` | a generated column (the expression is kept as written) |
414
+ | MySQL `ON UPDATE CURRENT_TIMESTAMP` | an auto-updated date-time column |
415
+ | `CREATE TYPE ... AS ENUM`, `ALTER TYPE ... ADD VALUE`, MySQL `ENUM('a', 'b')`, a `CHECK (col IN ('a', 'b'))` (or `col = 'a' OR col = 'b'`, or PostgreSQL's `= ANY (ARRAY[...])`) on a text column | an enum (member names are the upper-case snake spelling of the values; a `CREATE TYPE` keeps its database name; an inline or `CHECK` enum is named after the table and column, `ForumThreadStatus`) |
416
+ | `REFERENCES`, `FOREIGN KEY`, `ALTER TABLE ... ADD CONSTRAINT ... FOREIGN KEY` | a foreign-key relation named after the column without its `_id` suffix (`author_id` is `author`), with `ON DELETE` / `ON UPDATE`, the constraint name, a target column other than the key (`toField`) and a reverse accessor named after the table that holds the key (`blog_posts`; `author_blog_posts` and `editor_blog_posts` when two keys point at the same table). A unique or primary-key foreign key is one-to-one. Several columns make a composite foreign key |
417
+ | a table of exactly two foreign-key columns that together are its primary key, with no other column, index or constraint and no foreign key pointing at it | a many-to-many relation on one side (the table is dropped from the models); the side whose table name starts the join table name owns it (`blog_post_tags` becomes `BlogPost.tags`) |
418
+ | `CREATE [UNIQUE] INDEX`, MySQL `KEY` / `FULLTEXT KEY`, SQL Server `CLUSTERED` | indexes with their names, column order, descending columns, `USING gin` / `hash` / ... methods, operator classes, prefix lengths, `FULLTEXT` and `CLUSTERED` |
419
+ | `ALTER TABLE ... ADD COLUMN`, `ADD CONSTRAINT`, `ADD PRIMARY KEY`, `ALTER COLUMN ... SET / DROP DEFAULT` and `SET / DROP NOT NULL`, SQL Server `ADD DEFAULT ... FOR`; `DROP TABLE`, `DROP TYPE` | applied in order, so a dump that adds keys after the tables (as `pg_dump` does) or a folder of migrations reads as the final schema |
420
+
421
+ Everything else is skipped, and each kind is reported once as a warning with a count and the first line (`Skipped 3 CREATE VIEW statements (first at schema.sql:40)`): views, functions, procedures, triggers, sequences, domains, composite types, row data (`INSERT`, `COPY`), temporary tables, `CREATE TABLE ... AS SELECT`, `PARTITION OF`, and the `ALTER TABLE` changes that are not replayed (`DROP COLUMN`, `RENAME`, a changed column type). `COMMENT ON`, `SET`, `GRANT`, transactions and extensions are skipped without a warning. A `CHECK` that is not an enum, an `EXCLUDE` constraint, an expression index, a partial unique index (a full one would reject rows the source accepts), the `WHERE` of a partial index, `INHERITS` and partitioning, a MySQL `SET` column, a table without a primary key and a foreign key to a table that is not in the input each warn and name the table. MySQL creates an index for every foreign key, so an index over exactly the foreign-key columns is not kept as a separate index.
422
+
320
423
  ### Prisma constructs
321
424
 
322
425
  The Prisma parser and emitter cover more than the Django mapping above. Constructs the shared model can carry survive a Prisma → Prisma round trip; the other formats get the closest equivalent and a warning naming the model and field.
@@ -350,6 +453,49 @@ Writes plain TypeScript interfaces and enums for sharing models with a front end
350
453
  - `--naming normalize` writes camelCase property names, `preserve` keeps the existing names. Names that are not valid identifiers are quoted.
351
454
  - Warnings name the model and field for relations to unknown models, composite-key targets (the foreign key becomes `unknown`), unknown enums or field types, and invalid or clashing type names.
352
455
 
456
+ ### JSON Schema (`--to json-schema`)
457
+
458
+ Writes one JSON Schema (draft 2020-12) document describing the rows of every model, for validating API payloads or generating forms and clients. It is output only, needs no parser, and `.json` is not claimed as an extension (the registry matches the last extension and `.json` is far too generic), so pass `--to json-schema` and name the file yourself (for example `-o schema.json`).
459
+
460
+ - The document has `$schema`, `$id` (`urn:ormbridge:schema`; programmatic callers can pass `id` to `emitJsonSchema`) and `$defs` with one entry per enum and per model. Every model is `type: "object"` with `additionalProperties: false`. Property names match the TypeScript interfaces output, so the two can be used together: `preserve` keeps names, `normalize` writes camelCase.
461
+ - **Types.** `string` / `text` are `string` (`maxLength` from the column length), `int` is `integer`, `float` is `number`, `boolean` is `boolean`, `dateTime` / `date` / `time` / `uuid` / `duration` are strings with `format` `date-time` / `date` / `time` / `uuid` / `duration` (a name such as `email` never adds `format: email`), `json` accepts any value, `bytes` is a base64 string (`contentEncoding`). `bigInt` and `decimal` are strings so no precision is lost: `bigInt` has the pattern `^-?[0-9]+$`, and `decimal` has `^-?[0-9]+(\.[0-9]+)?$`, narrowed to the allowed digits when the column has a precision and scale (`decimal(8,2)` is `^-?[0-9]{1,6}(\.[0-9]{1,2})?$`). The IR carries no integer sizes, so `minimum` / `maximum` are written only when a Prisma native type names the width (`@db.SmallInt`, `@db.TinyInt`, `@db.UnsignedInt`, ...). Arrays nest `type: "array"`, HStore is an object of nullable strings and ranges are `{ lower, upper, bounds }` objects.
462
+ - **Nullable columns** are `type: ["string", "null"]`. A nullable enum or relation is `anyOf` with `{ "type": "null" }`.
463
+ - **Required.** A property is in `required` when its column is not nullable, has no default and is not generated, and a foreign-key scalar is required when its relation is. Columns the database or ORM fills in (auto-increment, UUID, `now`, client-generated and database-expression defaults, auto-updated and generated columns) are `readOnly: true` and not required; a literal or enum default is written as `default` and makes the column optional. Relation and reverse properties are always optional.
464
+ - **Relations.** A foreign key keeps its scalar (`author_id`, typed from the referenced key) and gets an optional expanded property that is a `$ref` to the target (`anyOf` with null when nullable). Reverse sides and many-to-many relations are optional arrays of `$ref` (a one-to-one reverse side is nullable), exactly as in the TypeScript output.
465
+ - **Enums** are `{ "type": "string", "enum": [stored values] }`. The IR has no column comments, so `description` carries only enum labels (`draft: Draft`) and generated-column expressions.
466
+ - **OpenAPI.** An OpenAPI 3.1 document uses JSON Schema 2020-12, so the entries can be copied into `components.schemas`. References point at `#/$defs/<Name>` by default; pass `refPrefix: '#/components/schemas/'` to `emitJsonSchema` and copy the `$defs` entries over (or rewrite the prefix with a text replace). Generating an OpenAPI document itself (paths, `--to openapi`) is not part of this format.
467
+ - Warnings name the model and field for relations to unknown models, composite-key targets (the foreign key accepts any value), unknown enums or field types, duplicate enum values, and definition names that cannot be used in a `$ref` (they are renamed). Database constraints (unique, indexes, referential actions) have no JSON Schema form and are not written.
468
+ - The tests check every canonical fixture's output structurally and, when Ajv is installed (`AJV_DIR`, see `test/README.md`), load it with the real draft 2020-12 validator and validate IR-generated sample rows.
469
+
470
+ ### Zod schemas (`--to zod`)
471
+
472
+ Writes [Zod](https://zod.dev) 4 schemas and their inferred types, for validating the same data the TypeScript interfaces describe. It is output only, writes one `schemas.ts`-style file (`import { z } from 'zod'` first), and `.ts` is not inferred, so pass `--to zod`. Property names, enum names and the handling of relations follow the TypeScript interfaces emitter, so the two outputs can be used together.
473
+
474
+ - **Per model**: `<Model>Schema` (`z.object({...})`) and `export type <Model> = z.infer<typeof <Model>Schema>`; `<Model>CreateSchema` / `<Model>Create`; `<Model>UpdateSchema` / `<Model>Update`.
475
+ - **Create schema**: leaves out what the database generates (auto-increment keys, generated columns, auto-updated timestamps such as Django `auto_now` and Prisma `@updatedAt`), and makes columns with a default (or a database default) and nullable columns `.optional()`. The **update schema** is `<Model>CreateSchema.partial()`. A view gets neither.
476
+ - **Types**: `string` and `text` are `z.string()` with `.max(n)` from the length; `uuid` is `z.uuid()` (Zod's RFC 9562 check; use `z.guid()` if your data holds other UUID-shaped values); `int` is `z.number().int()`; `float` is `z.number()`; `boolean`; `json` is `z.unknown()`; `bytes` is `z.base64()`; IP addresses are `z.union([z.ipv4(), z.ipv6()])`; times and durations are `z.string()`. `bigInt` is a string of digits (`z.string().regex(/^-?\d+$/)`, like the TypeScript interfaces, because JSON cannot carry a bigint) and `decimal` is a string matching a number pattern sized from `max_digits` and `decimal_places`, to keep precision. Arrays wrap the element in `z.array(...)`, nullable columns get `.nullable()`, hstore is `z.record(z.string(), z.string().nullable())` and a range is an object with nullable `lower` and `upper` plus `bounds`. No `z.email()` or `z.url()` is ever inferred from a name.
477
+ - **Dates** are `z.coerce.date()`: they accept a `Date` or any value `new Date(value)` accepts (ISO text from JSON) and produce a `Date`. Coercion also turns `null` (and numbers) into a date, so a null in a required date column is not rejected; use a nullable column, or pass `dates: 'string'` to `emitZod` for strict ISO text (`z.iso.datetime({ offset: true })` / `z.iso.date()`, which matches the TypeScript interfaces' default). Pass `bigints: 'bigint'` for `z.coerce.bigint()`. The CLI always writes the defaults.
478
+ - **Enums** are a const object with the stored values (`export const Role = { ADMIN: 'admin' } as const;`, so `Role.ADMIN` works like the interface emitter's enum), `export const RoleSchema = z.enum(Role)` and `export type Role = z.infer<typeof RoleSchema>`. Labels become comments.
479
+ - **Relations** are not part of `<Model>Schema`: the foreign-key scalar stays a field (`categoryId`, typed from the referenced key) and relation fields are left out, so a row validates exactly what a table row holds. A model that takes part in a relation also gets `<Model>WithRelationsSchema` (and a hand-written `<Model>WithRelations` type, because mutually recursive schemas cannot be inferred), which extends the row with optional, lazily resolved related rows (`z.lazy`), reverse sides and many-to-many lists included.
480
+ - `--naming normalize` writes camelCase property names, `preserve` keeps the existing names. Warnings name the model and field for relations to unknown models, composite-key targets (the foreign key becomes `z.unknown()`), unknown enums or field types, and invalid or clashing type names.
481
+ - **Zod 3**: the output uses Zod 4 APIs (`z.uuid()`, `z.base64()`, `z.ipv4()`, `z.enum(constObject)`, `z.iso.*`). Zod 3.25 and later ship Zod 4 under `zod/v4`, so change the import to `import { z } from 'zod/v4'`; older Zod 3 releases are not supported.
482
+
483
+ [Back to Table of Contents](#table-of-contents)
484
+
485
+ ### SQL DDL (`--to sql`)
486
+
487
+ Writes one `.sql` script of dialect-specific DDL, so the schema can be created in a database directly (or reviewed before a migration is written). It is output only, `.sql` is inferred from the output path, and `--provider` picks the dialect: `postgresql` (also used for `cockroachdb`), `mysql`, `sqlite` or `sqlserver` (`mongodb` has no SQL and falls back to PostgreSQL with a warning). The script holds, in order, the extensions and enum types the dialect needs, one `CREATE TABLE` per model with the tables a table references created first, and the `CREATE [UNIQUE] INDEX` statements of each table. A foreign key that closes a reference cycle is added afterwards with `ALTER TABLE ... ADD CONSTRAINT` (SQLite cannot add a constraint later, but accepts a reference to a table created further down, so its keys stay inline).
488
+
489
+ - **Naming** follows the other emitters: `preserve` keeps the table and column names of the source, `normalize` writes singular snake_case tables with UUID keys, snake_case columns and `created_at` / `updated_at`. Identifiers are bare when they are lower-case words that are not reserved in any of the four dialects, otherwise quoted for the dialect (`"x"`, `` `x` `` or `[x]`, with the quote character doubled); quotes in string literals are doubled, and MySQL also doubles backslashes. Names longer than the dialect allows give a warning, and generated constraint and index names are shortened with a hash.
490
+ - **Types**: `string` is `VARCHAR(n)` (`TEXT` without a length on PostgreSQL and SQLite, `VARCHAR(255)` on MySQL, `NVARCHAR(n)` on SQL Server), `text` is `TEXT` / `LONGTEXT` / `NVARCHAR(MAX)`, `decimal` keeps its precision and scale, `uuid` is `UUID` / `CHAR(36)` / `UNIQUEIDENTIFIER`, `dateTime` is `TIMESTAMPTZ` / `DATETIME(6)` / `DATETIME` / `DATETIME2`, `json` is `JSONB` / `JSON` / `TEXT` with a `json_valid` check / `NVARCHAR(MAX)` with an `ISJSON` check, and booleans are `BOOLEAN` (`BIT` on SQL Server). A Prisma native type (`@db.VarChar`, `@db.Uuid`, `@db.UnsignedInt`, ...) is kept when the dialect has a type of that name and ignored otherwise. Arrays, ranges, hstore and `interval` are PostgreSQL types; the other dialects get JSON or text (an integer of microseconds for durations) with a warning.
491
+ - **Defaults**: literals are quoted and typed for the dialect (booleans are `TRUE` / `FALSE` or `1` / `0`), `now` is `now()`, `CURRENT_TIMESTAMP`, `CURRENT_TIMESTAMP(n)` or `SYSUTCDATETIME()`, and a UUID default is `gen_random_uuid()`, `(UUID())`, `NEWID()` or an expression over `randomblob` on SQLite. Well-known database expressions (`gen_random_uuid()`, `now()`, `uuid_generate_v4()`, `CURRENT_TIMESTAMP`) are translated to the dialect; any other expression is written as it is with a warning. Defaults generated by the ORM client (`cuid()`, `ulid()`) are dropped with a warning. A column the ORM refreshes on update gets `ON UPDATE CURRENT_TIMESTAMP` on MySQL; the other dialects need a trigger, which is not generated, so one warning lists those columns.
492
+ - **Keys**: auto-increment is `GENERATED BY DEFAULT AS IDENTITY`, `AUTO_INCREMENT`, `INTEGER PRIMARY KEY AUTOINCREMENT` or `IDENTITY(1,1)`; primary keys (also composite) are named `CONSTRAINT <table>_pkey`; unique fields are `UNIQUE` constraints and composite unique keys are `CREATE UNIQUE INDEX`; on SQL Server a unique key over a nullable column is a filtered unique index (`WHERE col IS NOT NULL`), so it allows many NULLs like the other databases. Foreign keys are named `<table>_<column>_fkey` and carry `ON DELETE` / `ON UPDATE` (`NO ACTION`, the default, is left out); composite foreign keys, `toField` targets and keys that are themselves relations (multi-table inheritance) are supported. MySQL has no `SET DEFAULT`, and SQL Server rejects cascading actions that form a cycle or a second cascade path: both are written as `NO ACTION` with a warning.
493
+ - **Indexes** carry their sort order, the PostgreSQL access method and operator class, MySQL prefix lengths and `USING`, SQL Server `CLUSTERED` / `NONCLUSTERED`, and full-text indexes (`FULLTEXT` on MySQL, a `gin` index over `to_tsvector` on PostgreSQL, an ordinary index with a warning elsewhere). An index or unique key on a column the dialect cannot index (a `JSON` column on MySQL, `NVARCHAR(MAX)` on SQL Server) is left out with a warning, and one on a MySQL `TEXT` or `BLOB` column covers its first 255 characters.
494
+ - **Enums**: PostgreSQL gets `CREATE TYPE ... AS ENUM` (renamed with an `_enum` suffix when a table has the same name), MySQL an inline `ENUM(...)`, SQLite and SQL Server a text column with a `CHECK (column IN (...))` constraint. Member names and labels are not kept.
495
+ - **Many-to-many** fields become the join tables the other formats create. **Views** have no query in the IR, so they are a commented placeholder (`-- CREATE VIEW ... AS SELECT ... ;`) and a warning.
496
+ - Warnings name the model and field for what the dialect cannot express: relations to unknown models, views or composite keys, unknown enums or field types, generated-column expressions (not SQL), database schemas (`@@schema`, ignored), unreferenceable targets, `SET NULL` on a required relation and every default or index option that was dropped.
497
+ - The tests execute the output: SQLite always (Node's built-in `node:sqlite`, or `better-sqlite3`), PostgreSQL when `SQL_POSTGRES_URL` is set and MySQL or MariaDB when `SQL_MYSQL_URL` is set (see `test/README.md`). After running the script they read the tables, columns, keys and indexes back and compare them with the schema, and insert rows to check defaults, identity, enums and referential actions. SQL Server has no server in the tests; its output is covered by the golden files and unit tests only.
498
+
353
499
  [Back to Table of Contents](#table-of-contents)
354
500
 
355
501
  ## Limitations and warnings
@@ -359,25 +505,28 @@ ormbridge never fails silently on something it cannot represent: each case produ
359
505
  - `settings.AUTH_USER_MODEL` and `get_user_model()` are assumed to be a model named `User`. Models referenced but not found in the input get a stub with an auto-increment id.
360
506
  - `GeneratedField` expressions are Python (`F`, `Concat`, ...), so they are carried only into Django output; Prisma and TypeORM get a regular column and a warning. Range fields are `Unsupported(...)` in Prisma and `string` in TypeORM and TypeScript objects (`{ lower, upper, bounds }`), nested arrays are `Json` in Prisma, `size=` on `ArrayField` is not kept, and `FileField` / `ImageField` / `FilePathField` / `GenericIPAddressField(protocol=...)` options are not kept (they come back as `CharField` or a plain IP field). `UniqueConstraint(condition=...)` (partial unique constraints), `GenericForeignKey` / `GenericRelation` and `CheckConstraint` are skipped with a warning.
361
507
  - Python is parsed statically, so computed defaults, custom field classes, and fields added dynamically are skipped or approximated.
362
- - Prisma composite primary keys become `models.CompositePrimaryKey` (Django 5.2+). Composite foreign keys, `Unsupported(...)` types, views, `@@fulltext`, `@@schema`, `@ignore` and client-generated defaults (`cuid()`, `ulid()`, `nanoid()`) have no direct Django, TypeORM, TypeScript or Graphene equivalent; the composite key columns stay as plain fields, a view becomes a table, and each case warns. Scalar lists become `ArrayField` (PostgreSQL only).
508
+ - Prisma composite primary keys become `models.CompositePrimaryKey` (Django 5.2+). Composite foreign keys, `Unsupported(...)` types, views, `@@fulltext`, `@@schema`, `@ignore` and client-generated defaults (`cuid()`, `ulid()`, `nanoid()`) have no direct Django, TypeORM, TypeScript or Graphene equivalent (except that TypeORM writes a view as a `@ViewEntity`, see below); the composite key columns stay as plain fields, a view becomes a table in Django, TypeScript and Graphene, and each case warns. Scalar lists become `ArrayField` (PostgreSQL only).
363
509
  - Not read from Prisma schemas: composite types (`type` blocks, MongoDB), `relationMode`, the client-side `name:` of `@@unique` / `@@id`, partial indexes (`where:`), `@default(..., map:)` constraint names (SQL Server), and sort / length options on `@@id`. Native types are matched to the target provider by name only (the table was built with `prisma validate`); arguments such as a `VarChar` length are passed through unchanged. MongoDB output warns about ids that are not `@map("_id") @db.ObjectId` and about `Decimal` and compound ids, which Prisma rejects there. SQL Server cannot index `NVarChar(Max)` and MySQL needs a prefix length to index `TEXT`; indexes on such columns warn.
364
510
  - Prisma's implicit many-to-many join table (`_AToB`) differs from Django's, so data needs migrating.
365
- - TypeORM: entities are read from decorators only. Not supported, each with a warning naming the entity and column: `EntitySchema`, `@ChildEntity` / `@TableInheritance` (single-table inheritance), `@ViewEntity`, `@Tree*`, `@ObjectIdColumn`, `@VirtualColumn`, array columns, partial and spatial indexes, `@Check` / `@Exclusion`, composite foreign keys, relations inside embedded entities, and column options such as `unsigned`, `collation` and `transformer`. Custom `@JoinTable` names are not preserved. Relations without `onDelete` become `NoAction` and relations are nullable unless `nullable: false`, as in TypeORM. Numeric enums become integers.
511
+ - TypeORM: entities are read from decorators only. Not supported, each with a warning naming the entity and column: `EntitySchema`, `@ChildEntity` / `@TableInheritance` (single-table inheritance), `@Tree*`, `@ObjectIdColumn`, `@VirtualColumn`, array columns, partial and spatial indexes, `@Check` / `@Exclusion`, composite foreign keys, relations inside embedded entities, and column options such as `unsigned`, `collation` and `transformer`. `@ViewEntity` classes are read as views (`isView`) with their `@ViewColumn` columns; the view's `expression` is not converted. A Prisma view is written as `@ViewEntity({ name, expression })` with `@ViewColumn()` columns and a placeholder `expression` (`SELECT * FROM <view>`, which selects from the view itself) plus a TODO comment and a warning: replace it with the query that defines the view, because a Prisma schema carries no view definition. Primary key, unique and index information on a view is dropped. Custom `@JoinTable` names are not preserved. Relations without `onDelete` become `NoAction` and relations are nullable unless `nullable: false`, as in TypeORM. Numeric enums become integers.
366
512
  - TypeORM many-to-many relations use TypeORM's join table (composite key), so Django's surrogate `id` column on the join table is not reproduced. SQL Server has no enum column, so enums become `varchar`. Database-side UUID defaults are not available on SQLite. MongoDB entities are not supported.
367
513
  - Doctrine: only PHP 8 attributes are read. Docblock annotations (`@ORM\Entity`) are detected and reported with a warning (or an error when nothing else is found), and XML / YAML mappings are not read; both are planned. Lifecycle callbacks other than a plain timestamp assignment, and constructor or initializer values that need to run PHP (method calls, constants other than enum cases), are ignored with a warning. Not supported, each with a warning naming the entity and property: attribute and association overrides, composite foreign keys (several `#[ORM\JoinColumn]`), `columnDefinition`, `unsigned` / `comment` / `collation` and other column `options`, `insertable: false` / `updatable: false`, partial and spatial indexes, table `schema` and `options`, custom id generators and `#[ORM\SequenceGenerator]`, `array` / `object` / `simple_array` / custom DBAL types, int-backed and non-backed enums, relations inside embeddables, and the `#[ORM\DiscriminatorMap]` values (the discriminator column is kept, the map is not). Nullability follows the attribute (`nullable: true`), never the PHP type: Doctrine does not infer it, so `?string` with a plain `#[ORM\Column]` is `NOT NULL`. Custom join table names, ORM-level `cascade` / `fetch` / `orphanRemoval` and other runtime-only settings are not part of the schema and are not converted; `cascade: ['remove']` and `orphanRemoval` warn. A custom naming strategy configured outside the attributes cannot be seen, so Doctrine's underscore naming is assumed. Classes the input does not contain (a vendor base class or trait, an enum in another package) produce a warning that names the missing class.
368
514
  - Laravel: the schema is rebuilt statically, so what Laravel decides at run time is not seen. A conditional or loop inside a migration is applied as if it always ran, and a dynamic table or column name is skipped; both warn and name the table. Raw SQL (`DB::statement`, `DB::unprepared`) is not interpreted, so a view, trigger, partial index or column created that way is missing, with a warning naming the table. Not represented, each with a warning naming the table and column: polymorphic relations (`morphs`, `morphTo`, `morphMany`, `morphToMany`; the `_type` and `_id` columns stay plain columns), derived relations (`hasManyThrough`, `hasOneThrough`, `*OfMany`), relation constraints (`->where(...)`), composite foreign keys, foreign keys to tables no migration creates, tables that migrations alter but never create (for example `users` from a package), `set`, geometry and `vector` columns, `macAddress` (kept as a string), identity columns, spatial indexes, custom pivot table and key names (the join table gets the name other formats derive: `blog_post_tags` survives, `post_tag` does not), pivot timestamps and non-cascading pivot keys, and `parentKey` / `relatedKey` that are not the primary key. Casts to custom cast classes and to int-backed enums are ignored. Mass-assignment and visibility properties (`$fillable`, `$guarded`, `$hidden`) are not part of the schema. Soft deletes have no IR equivalent beyond the nullable `deleted_at` column.
369
515
  - GORM: only struct tags are read and nothing is executed, so a `TableName()` that computes its result, a custom `NamingStrategy` (prefix, `SingularTable`, `NoLowerCase`) set when the database is opened, and `Scanner` / `Valuer` types are not seen: the default naming is assumed, and such a type is an unsupported column unless a `type:` tag names the column type. Not represented, each with a warning naming the struct and field: polymorphic associations (`polymorphic:`; the `<Name>ID` and `<Name>Type` columns stay plain fields), `check:` constraints, column `comment:`, partial (`where:`) and expression indexes, soft delete beyond the nullable `deleted_at` column, integer-backed constant types (a plain integer column), `autoCreateTime` / `autoUpdateTime` on integer fields (Unix time), custom join table and column names, and `serializer:` values other than `json`, `gob` and `unixtime`. GORM ignores a `constraint:` tag on a belongs-to field when the other side describes the same key, and so does the parser (with a warning). Slices and maps without a `type:` or `serializer:` tag, which GORM cannot migrate, are read as arrays and `json` with a warning. Unsigned integers need one more bit in the type mapping, as in GORM's PostgreSQL dialect (`uint32` is `bigInt`).
516
+ - Drizzle: only the TypeScript source is read and nothing is executed, so tables built in loops or by functions, column helpers that need run-time values and defaults computed at run time are not seen (each unresolvable table, column, spread, reference or default warns and names the file and table). Not represented, each with a warning: views, sequences, roles and policies, `check()` constraints, partial (`.where()`) indexes (a partial unique index is dropped because a full one would reject rows the source accepts; a partial plain index is read as a full one), expression indexes, index access methods Prisma does not have, `nullsNotDistinct`, `unsigned`, and relations v2 (`defineRelations`; the foreign keys are still read). SQLite `integer({ mode: 'timestamp' })` is read as a date-time column and warns that the database stores Unix time. A SQLite `integer().primaryKey()` is read as written: it is not auto-increment unless `{ autoIncrement: true }` is given, although SQLite assigns row ids anyway. Drizzle has no implicit many-to-many, so the explicit join table is a model and is written as one. Tables referenced but not found in the input get a stub with an auto-increment id. Drizzle can only be read for now; a writer is planned.
517
+ - JSON Schema: only JSON is read (no YAML), remote `$ref`s are never fetched and named anchors (`$anchor`, `$dynamicRef`) are not resolved. Relations are inferred from `$ref` properties and the `x-` conventions above, and a few guesses are warned about (a one-to-one pair with no required side, a lone array of models, a missing primary key). See "JSON Schema and OpenAPI" above and the conversion matrix for the full list of what is lost.
518
+ - SQL DDL: only the DDL text is read and nothing is run. The dialect is guessed per file, `UNSIGNED`, display widths, time zones and `jsonb` versus `json` are not kept, and names the database generated for constraints are not recorded. Relation names, reverse accessors, enum names and the many-to-many relation name are derived from table and column names, so they are guesses (the conversion matrix lists them). `ALTER TABLE` is replayed for added columns and constraints and a few column options only; renames, dropped columns and type changes are skipped with a warning, so a long migration history is best read from a schema dump. A composite foreign key that points at columns that are themselves single-column foreign keys cannot be expressed, and the Prisma writer reports it. Input is limited to 32 million characters; deeply nested or unterminated constructs are scanned in linear time and never overflow the stack.
370
519
  - Generated names for Django indexes are shortened to Django's 30-character limit.
371
520
 
372
521
  Always review the output and run your own migrations/`prisma validate` before applying it to a real database.
373
522
 
374
523
  ### Verified against real tools
375
524
 
376
- The emitters are not only compared with golden files. When the tools are installed, the tests also load the output with the real thing: Django (`manage.py check`, `makemigrations`, `sqlmigrate`, `migrate` and a comparison of the model metadata and the SQLite database with the schema), graphene-django (the generated schema is built, introspected and queried), TypeORM (`tsc` with decorator metadata, TypeORM's metadata validation for every provider and a `synchronize` into in-memory SQLite), Doctrine, Laravel, GORM and `prisma validate`. These checks are optional: each is skipped with a reason when its tool is missing, and `test/README.md` lists the environment variables (`DJANGO_PYTHON`, `TYPEORM_DIR`, `DOCTRINE_DIR`, `LARAVEL_DIR`, `PRISMA_BIN`) and `test/tools/setup-verification-tools.sh`, which installs the Django and TypeORM tools into a scratch directory.
525
+ The emitters are not only compared with golden files. When the tools are installed, the tests also load the output with the real thing: Django (`manage.py check`, `makemigrations`, `sqlmigrate`, `migrate` and a comparison of the model metadata and the SQLite database with the schema), graphene-django (the generated schema is built, introspected and queried), TypeORM (`tsc` with decorator metadata, TypeORM's metadata validation for every provider and a `synchronize` into in-memory SQLite), Drizzle ORM (`tsc --strict`, `drizzle-kit generate` for PostgreSQL, MySQL and SQLite, `drizzle-kit push` into SQLite, Drizzle's relational configuration and a persistence run on the blog schema), Doctrine, Laravel, GORM and `prisma validate`. These checks are optional: each is skipped with a reason when its tool is missing, and `test/README.md` lists the environment variables (`DJANGO_PYTHON`, `TYPEORM_DIR`, `DRIZZLE_DIR`, `DOCTRINE_DIR`, `LARAVEL_DIR`, `PRISMA_BIN`) and `test/tools/setup-verification-tools.sh`, which installs the Django, TypeORM and Drizzle tools into a scratch directory. The Drizzle parser is checked the other way round: the fixtures are type-checked against `drizzle-orm` and compared with the snapshot `drizzle-kit generate` builds from them. The JSON Schema and OpenAPI fixtures are checked with the real Ajv validator, and the Zod schemas with real Zod 4 (`ZOD_DIR`): they are compiled with `tsc --strict` and parse generated rows (valid ones pass, invalid ones fail). The SQL DDL is executed in SQLite (always), PostgreSQL (`SQL_POSTGRES_URL`) and MySQL or MariaDB (`SQL_MYSQL_URL`), and the tables, columns, keys and indexes the database reports are compared with the schema, and the SQL parser reads the SQLite fixtures back and is compared with what the database reports.
377
526
 
378
527
  ### Conversion matrix
379
528
 
380
- [docs/CONVERSION_MATRIX.md](./docs/CONVERSION_MATRIX.md) shows, for every pair of readable and writable formats (Django, Prisma, TypeORM, Doctrine, Laravel, GORM), whether the schema survives a round trip and exactly what is lost when it does not (for example enum labels and column lengths, and Prisma's explicit join model for many-to-many fields). It is generated from the test fixtures with `npm run docs:matrix`, and the tests fail if it is out of date.
529
+ [docs/CONVERSION_MATRIX.md](./docs/CONVERSION_MATRIX.md) shows, for every pair of readable and writable formats (Django, Prisma, TypeORM, Doctrine, Laravel, GORM, Drizzle, JSON Schema, SQL), whether the schema survives a round trip and exactly what is lost when it does not (for example enum labels and column lengths, and Prisma's explicit join model for many-to-many fields). Write-only targets (GORM, Drizzle, JSON Schema and Zod) get a structural check of the written files instead of an IR comparison. It is generated from the test fixtures with `npm run docs:matrix`, and the tests fail if it is out of date.
381
530
 
382
531
  Django models are read with a static [tree-sitter](https://tree-sitter.github.io/) parser, so **no Python, Django install, or database is needed**.
383
532
 
@@ -406,7 +555,7 @@ if (!result.ok) {
406
555
  }
407
556
  ```
408
557
 
409
- All functions return a `Result` (`{ ok: true, value } | { ok: false, error }`) instead of throwing, with a descriptive error code and message. Parsers and emitters are exported too (`parseDjango`, `parsePrisma`, `parseTypeorm`, `parseDoctrine`, `parseLaravel`, `emitPrisma`, `emitDjango`, `emitDoctrine`, `emitLaravel`, `emitGorm`), all built on a shared intermediate representation, which is how new formats plug in.
558
+ All functions return a `Result` (`{ ok: true, value } | { ok: false, error }`) instead of throwing, with a descriptive error code and message. Parsers and emitters are exported too (`parseDjango`, `parsePrisma`, `parseTypeorm`, `parseDrizzle`, `parseDoctrine`, `parseLaravel`, `parseGorm`, `parseJsonSchema`, `parseSqlDdl`, `emitPrisma`, `emitDjango`, `emitDoctrine`, `emitLaravel`, `emitGorm`, `emitDrizzle`, `emitJsonSchema`, `emitZod`, `emitSqlDdl`), all built on a shared intermediate representation, which is how new formats plug in.
410
559
 
411
560
  ### Format registry
412
561
 
package/dist/cliRunner.js CHANGED
@@ -318,7 +318,7 @@ export async function runCli(argv, env) {
318
318
  .option('-f, --from <format>', `source format (${listFormatNames().join(' | ')}); inferred from the input when omitted`)
319
319
  .option('-t, --to <format>', `target format (${listFormatNames().join(' | ')}); inferred from the output when omitted`)
320
320
  .option('--naming <mode>', 'preserve existing database names, or normalize to singular snake_case + UUID ids (default: preserve)')
321
- .option('--provider <name>', `Prisma datasource provider (${PRISMA_PROVIDERS.join(' | ')}) (default: postgresql)`)
321
+ .option('--provider <name>', `database provider (${PRISMA_PROVIDERS.join(' | ')}); the Prisma datasource, the Drizzle/GORM dialect and the SQL dialect of --to sql (postgresql | mysql | sqlite | sqlserver) (default: postgresql)`)
322
322
  .option('--no-header', 'omit the Prisma generator and datasource blocks')
323
323
  .option('--app-label <name>', 'Django app label used for default table names (default: derived from the directory)')
324
324
  .option('--auto-field <type>', 'primary key type for Django models without one (int | bigint) (default: int)')
@@ -1 +1 @@
1
- {"version":3,"file":"cliRunner.js","sourceRoot":"","sources":["../src/cliRunner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EACL,cAAc,EACd,cAAc,GAGf,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gBAAgB,GAGjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,eAAe,EACf,SAAS,EACT,oBAAoB,EACpB,eAAe,EACf,WAAW,GAGZ,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,UAAU,EACV,aAAa,GAId,MAAM,SAAS,CAAC;AAIjB,6CAA6C;AAC7C,MAAM,CAAC,MAAM,OAAO,GAAW,CAAC,CAAC;AACjC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,qBAAqB,GAAW,CAAC,CAAC;AAC/C,sDAAsD;AACtD,MAAM,CAAC,MAAM,gBAAgB,GAAW,CAAC,CAAC;AAC1C,+DAA+D;AAC/D,MAAM,CAAC,MAAM,iBAAiB,GAAW,CAAC,CAAC;AAqC3C,SAAS,kBAAkB;IACzB,MAAM,eAAe,GAAgB,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpE,M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MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEL,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IACnD,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,IAAI,MAAM,YAAY,cAAc,EAAE,CAAC;YACrC,4EAA4E;YAC5E,OAAO,MAAM,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC;QAC5D,CAAC;QACD,MAAM,MAAM,CAAC;IACf,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { IrSchema } from '../ir.js';
2
+ import { type NamingMode } from '../transforms.js';
3
+ import type { MultiFileEmitOutput } from '../formats.js';
4
+ import type { PrismaProvider } from './prisma.js';
5
+ export interface DrizzleEmitOptions {
6
+ /** Database provider; picks the Drizzle dialect (`pg-core`, `mysql-core` or `sqlite-core`). */
7
+ provider: PrismaProvider;
8
+ /**
9
+ * "preserve" keeps the database names of the source as the string argument of every builder;
10
+ * "normalize" applies the fresh-schema style of the other emitters. TypeScript keys are camelCase
11
+ * in both modes.
12
+ */
13
+ naming: NamingMode;
14
+ }
15
+ /** The generated Drizzle schema file. */
16
+ export declare const DRIZZLE_SCHEMA_FILE: string;
17
+ /** The generated drizzle-kit configuration, so `npx drizzle-kit generate` works next to the schema. */
18
+ export declare const DRIZZLE_CONFIG_FILE: string;
19
+ export declare function emitDrizzle(schema: IrSchema, options: DrizzleEmitOptions): MultiFileEmitOutput;