-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify database triggers for unaccented full text search
- Loading branch information
1 parent
8875804
commit 678bbbc
Showing
7 changed files
with
239 additions
and
135 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
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
35 changes: 35 additions & 0 deletions
35
resolwe/flow/migrations/0024_use_unaccent_full_text_search.py
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,35 @@ | ||
# Generated by Django 4.2.9 on 2024-02-13 07:33 | ||
|
||
import os | ||
|
||
from django.db import connection, migrations | ||
|
||
|
||
def load_triggers(apps, schema_editor): | ||
file_names = [ | ||
"utils.sql", | ||
"triggers_collection.sql", | ||
"triggers_entity.sql", | ||
"triggers_data.sql", | ||
] | ||
with connection.cursor() as c: | ||
for file_name in file_names: | ||
file_path = os.path.join(os.path.dirname(__file__), file_name) | ||
with open(file_path) as fh: | ||
sql_statement = fh.read() | ||
c.execute(sql_statement) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("flow", "0023_create_unaccent_full_text_search_config"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(load_triggers), | ||
# Update existing entries. | ||
migrations.RunSQL("UPDATE flow_entity SET id=id;", migrations.RunSQL.noop), | ||
migrations.RunSQL("UPDATE flow_collection SET id=id;", migrations.RunSQL.noop), | ||
migrations.RunSQL("UPDATE flow_data SET id=id;", migrations.RunSQL.noop), | ||
] |
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
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
Oops, something went wrong.