Bin
2025-12-17 bc6aa38242b0a7dea4b18bc90e2d78740436a58b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Generated by Django 3.1.13 on 2021-09-13 07:39
import logging
 
from django.db import migrations
from core.utils.common import trigram_migration_operations
 
logger = logging.getLogger(__name__)
 
 
def forwards(apps, schema_editor):
    if not schema_editor.connection.vendor.startswith('postgres'):
        logger.info('Database vendor: {}'.format(schema_editor.connection.vendor))
        logger.info('Skipping migration without attempting to CREATE INDEX')
        return
 
    schema_editor.execute(
        'create index concurrently tasks_annotations_result_idx2 '
        'on task_completion using gin (cast(result as text) gin_trgm_ops);'
    )
 
 
def backwards(apps, schema_editor):
    if not schema_editor.connection.vendor.startswith('postgres'):
        logger.info('Database vendor: {}'.format(schema_editor.connection.vendor))
        logger.info('Skipping migration without attempting to DROP INDEX')
        return
 
    schema_editor.execute('drop index tasks_annotations_result_idx2;')
    
 
class Migration(migrations.Migration):
    atomic = False
 
    dependencies = [('tasks', '0016_auto_20220414_1408')]
 
    operations = trigram_migration_operations(migrations.RunPython(forwards, backwards))