Paste table definitions and choose your ORM. Copy the model draft and adapt the mappings and application-specific behavior before using it.
Runs locally in your browserPaste CREATE TABLE statements, choose Prisma, Drizzle, TypeORM or SQLAlchemy, and press Generate models. Every table in the paste is read — columns, types, NOT NULL, primary keys, defaults and foreign keys — and one model block per table is returned, ready to copy or download.
The work happens in the page: generating the models sent no network request in testing, so the schema text never leaves the browser and the tool keeps working after the connection drops.
Table names, with or without a schema prefix (app.accounts is emitted as accounts), column names in backticks, double quotes or brackets, and the type of every column. NOT NULL makes a field required and a nullable column becomes optional. Primary keys are taken from a column-level PRIMARY KEY and from a table-level PRIMARY KEY (a, b), composite keys included.
Auto-increment comes from the DDL rather than from the column name: SERIAL, BIGSERIAL, AUTO_INCREMENT, GENERATED … AS IDENTITY and a nextval(…) default are recognised, while a plain PRIMARY KEY is left as an ordinary key. DEFAULT CURRENT_TIMESTAMP and now() become each target’s own “now” default. Foreign keys are read from column-level REFERENCES and from table-level CONSTRAINT … FOREIGN KEY clauses. Line comments (-- and MySQL #) and block comments are removed before parsing.
Prisma: one model per table with @id, @@id([...]) when the key spans several columns, @default(autoincrement()) only where the DDL declares it, @default(now()) for current timestamps, @db.Uuid for UUID columns, and @map / @@map so the generated names still point at the original SQL names.
Drizzle ORM: pgTable declarations written for the Postgres dialect, with primaryKey({ columns: [...] }) for composite keys. TypeORM: @PrimaryGeneratedColumn only for auto-increment columns and @PrimaryColumn for every other key, so the decorators match the schema. SQLAlchemy: 2.0-style DeclarativeBase classes with Mapped[...] annotations, mapped_column() and ForeignKey('table.column') for both foreign-key syntaxes; the import list contains only the names the models use.
Type mapping is deliberately coarse. varchar, char, text and citext all become the target’s string type, DECIMAL and NUMERIC become a decimal column annotated as Decimal, JSON, JSONB and XML use the generic JSON type, and any type the mapping does not know falls back to string. Compare one representative table against the real schema before you generate migrations from the output.
Anything that is not a column stays in the database: CHECK, UNIQUE, indexes, views, triggers, sequences, collations and storage clauses are not converted, and no target gets relation or navigation properties — a foreign key stays a plain column everywhere except SQLAlchemy, which adds ForeignKey. Drizzle output is Postgres-flavoured whatever the dialect of the pasted DDL.