From 62b0be3df914ffdecfc4ec5789518c98d8a11ab6 Mon Sep 17 00:00:00 2001 From: Razi Taj Mazinani Date: Fri, 15 Nov 2024 23:06:10 +0330 Subject: [PATCH 1/3] Update README.md --- README.md | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0dedce9..043fcd5 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,13 @@ Or check out some examples: ## Django -Create a migration to enable the extension +Create an empty migration file + +```python +python manage.py makemigrations --name enable_pgvector --empty +``` + +Add a migration in that file to enable the extension ```python from pgvector.django import VectorExtension @@ -56,7 +62,14 @@ class Migration(migrations.Migration): ] ``` -Add a vector field to your model +Migrate + +```sh +python3 manage.py makemigrations +python3 manage.py migrate +``` + +Add a vector field in the model.py ```python from pgvector.django import VectorField @@ -65,6 +78,13 @@ class Item(models.Model): embedding = VectorField(dimensions=3) ``` +Migrate + +```sh +python3 manage.py makemigrations +python3 manage.py migrate +``` + Also supports `HalfVectorField`, `BitField`, and `SparseVectorField` Insert a vector From be03f12ba54645ba9304bdf9117d065312bc0329 Mon Sep 17 00:00:00 2001 From: Razi Taj Mazinani Date: Fri, 15 Nov 2024 23:07:48 +0330 Subject: [PATCH 2/3] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 043fcd5..2a9ea6e 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,8 @@ class Item(models.Model): embedding = VectorField(dimensions=3) ``` +Also supports `HalfVectorField`, `BitField`, and `SparseVectorField` + Migrate ```sh @@ -85,8 +87,6 @@ python3 manage.py makemigrations python3 manage.py migrate ``` -Also supports `HalfVectorField`, `BitField`, and `SparseVectorField` - Insert a vector ```python From bd70e8a23571f6cd0a5256f72dadd9b130122233 Mon Sep 17 00:00:00 2001 From: Razi Taj Mazinani Date: Sat, 16 Nov 2024 09:52:35 +0330 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2a9ea6e..2f321fc 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ python3 manage.py makemigrations python3 manage.py migrate ``` -Add a vector field in the model.py +Add a vector field in the models.py ```python from pgvector.django import VectorField