[**Documentation**](../../../../README)

***

[Documentation](../../../../README) / [@zerotal/orm](../../README) / [index](../README) / SchemaInspector

# Variable: SchemaInspector

> `const` **SchemaInspector**: `object`

Defined in: [packages/orm/src/schema/SchemaInspector.ts:42](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/orm/src/schema/SchemaInspector.ts#L42)

Queries the live database to enumerate tables and their column definitions.
Used by `migrate:generate` to compute what has changed since the last migration.

## Type Declaration

### tables()

> **tables**(): `Promise`\<`string`[]\>

Return all user-defined table names in the current DB.

#### Returns

`Promise`\<`string`[]\>

### columns()

> **columns**(`table`): `Promise`\<[`LiveColumn`](../interfaces/LiveColumn)[] \| `null`\>

Return column details for a single table, or null if the table doesn't exist.
Table name is sanitised before use — safe against injection even for SQLite PRAGMAs.

#### Parameters

##### table

`string`

#### Returns

`Promise`\<[`LiveColumn`](../interfaces/LiveColumn)[] \| `null`\>

### describe()

> **describe**(`table`): `Promise`\<[`LiveTable`](../interfaces/LiveTable) \| `null`\>

Return a fully described LiveTable, or null if the table doesn't exist.

#### Parameters

##### table

`string`

#### Returns

`Promise`\<[`LiveTable`](../interfaces/LiveTable) \| `null`\>
