Skip to content

Commit 62b0be3

Browse files
authored
Update README.md
1 parent dbc44f4 commit 62b0be3

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@ Or check out some examples:
4545

4646
## Django
4747

48-
Create a migration to enable the extension
48+
Create an empty migration file
49+
50+
```python
51+
python manage.py makemigrations <your-app-name> --name enable_pgvector --empty
52+
```
53+
54+
Add a migration in that file to enable the extension
4955

5056
```python
5157
from pgvector.django import VectorExtension
@@ -56,7 +62,14 @@ class Migration(migrations.Migration):
5662
]
5763
```
5864

59-
Add a vector field to your model
65+
Migrate
66+
67+
```sh
68+
python3 manage.py makemigrations
69+
python3 manage.py migrate
70+
```
71+
72+
Add a vector field in the model.py
6073

6174
```python
6275
from pgvector.django import VectorField
@@ -65,6 +78,13 @@ class Item(models.Model):
6578
embedding = VectorField(dimensions=3)
6679
```
6780

81+
Migrate
82+
83+
```sh
84+
python3 manage.py makemigrations
85+
python3 manage.py migrate
86+
```
87+
6888
Also supports `HalfVectorField`, `BitField`, and `SparseVectorField`
6989

7090
Insert a vector

0 commit comments

Comments
 (0)