File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
5157from 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
6275from 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+
6888Also supports ` HalfVectorField ` , ` BitField ` , and ` SparseVectorField `
6989
7090Insert a vector
You can’t perform that action at this time.
0 commit comments