> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sqd.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeORM model generation

> Generate TypeORM models from a Squid SDK schema.graphql file

TypeORM entities can be automatically generated from the [schema file](./schema-files/schema-files-codegen) defined in `schema.graphql`.
The tool is called [`squid-typeorm-codegen(1)`](https://github.com/subsquid/squid-sdk/tree/master/typeorm/typeorm-codegen) and has no additional options.

Install with

```bash theme={"system"}
npm i @subsquid/typeorm-codegen --save-dev
```

Invoke with

```bash theme={"system"}
npx squid-typeorm-codegen
```

The input can be `schema.graphql` or a `schema/` directory containing multiple
`.graphql` files. Models are written to `src/model/generated` as
`<entity>.model.ts` files and import the column decorators they need from
`@subsquid/typeorm-store`. Generated index names are deterministic and are
shortened when needed to stay within PostgreSQL's identifier limit.
