WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,19 +277,25 @@ See a [full example](tests/kysely.test.mjs)

## Sequelize

Enable the extension
Register the types **before** establishing the database connection.

```javascript
await sequelize.query('CREATE EXTENSION IF NOT EXISTS vector');
import { Sequelize } from 'sequelize';
import pgvector from 'pgvector/sequelize';

pgvector.registerTypes(Sequelize);
```

Register the types
Initialize the connection to the database.

```javascript
import { Sequelize } from 'sequelize';
import pgvector from 'pgvector/sequelize';
let sequelize = new Sequelize(/* ... */);
```

pgvector.registerTypes(Sequelize);
Enable the extension

```javascript
await sequelize.query('CREATE EXTENSION IF NOT EXISTS vector');
```

Add a vector field
Expand Down