# Sequelize.sync() method · @imqueue/pg-sequelize

Source: https://imqueue.org/api/pg-sequelize/latest/pg-sequelize.sequelize.sync/
Published: 2026-08-01
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/pg-sequelize 4.2.0 — generated reference, not hand-written

Creates every table, then every view, then every column index.

**Signature:**

```typescript
sync(options?: SyncOptions): Promise<any>;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| options | [SyncOptions](https://imqueue.org/api/pg-sequelize/latest/pg-sequelize.syncoptions/) | _(Optional)_ Sequelize's own sync options, plus `withNoViews` and `withoutDrop`. |


**Returns:**

Promise<any>

The connection, once every pass has finished.

## Remarks

Sequelize's own sync knows about tables only. This one runs it first, then replaces the views declared with `View` or `DynamicView`, then creates the indices declared with `ColumnIndex` or `NullableIndex`. Views come before indices so an index declared on a materialized view has something to attach to, and both come after the tables a view selects from.

The three passes used to overlap. The index pass was started but never waited for and its result was discarded, so this resolved while indices were still being created, and a failure in that pass became an unhandled rejection — fatal on any current Node — instead of rejecting here. The options were not forwarded to the view pass either, which left `withoutDrop` doing nothing. All three are fixed.

