-
-
Notifications
You must be signed in to change notification settings - Fork 776
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
54008e3
commit 7de89b2
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Generated by Django 2.2.24 on 2021-07-22 06:49 | ||
|
||
import django.contrib.postgres.indexes | ||
import django.contrib.postgres.search | ||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('grants', '0120_auto_20210622_1021'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='grant', | ||
name='vector_column', | ||
field=django.contrib.postgres.search.SearchVectorField(null=True), | ||
), | ||
migrations.AddIndex( | ||
model_name='grant', | ||
index=django.contrib.postgres.indexes.GinIndex(fields=['vector_column'], name='grants_gran_vector__534e95_gin'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Generated by Django 2.2.24 on 2021-07-22 06:51 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('grants', '0121_auto_20210722_0649'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunSQL( | ||
sql=''' | ||
CREATE TRIGGER vector_column_trigger | ||
BEFORE INSERT OR UPDATE OF title, description, vector_column | ||
ON grants_grant | ||
FOR EACH ROW EXECUTE PROCEDURE | ||
tsvector_update_trigger( | ||
vector_column, 'pg_catalog.english', title, description | ||
); | ||
UPDATE grants_grant SET vector_column = NULL; | ||
''', | ||
|
||
reverse_sql = ''' | ||
DROP TRIGGER IF EXISTS vector_column_trigger | ||
ON grants_grant; | ||
''' | ||
), | ||
] |