Skip to content

Fix instruction order for Sequelize in README.md #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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