Coverage for app/venv/lib/python3.14/site-packages/weblate/memory/migrations/0003_drop_hash_index.py: 92%

10 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 07:15 +0000

1# Copyright © Michal Čihař <michal@weblate.org> 

2# 

3# SPDX-License-Identifier: GPL-3.0-or-later 

4 

5# Generated by Django 4.2.9 on 2024-01-26 14:17 

6 

7from django.db import migrations 

8 

9 

10def drop_index(apps, schema_editor) -> None: 

11 """Drop indexes created manually in Weblate 5.3 and older.""" 

12 vendor = schema_editor.connection.vendor 

13 if vendor == "postgresql": 13 ↛ exitline 13 didn't return from function 'drop_index' because the condition on line 13 was always true

14 schema_editor.execute("DROP INDEX IF EXISTS memory_source_index") 

15 schema_editor.execute("DROP INDEX IF EXISTS memory_target_index") 

16 schema_editor.execute("DROP INDEX IF EXISTS memory_origin_index") 

17 

18 

19class Migration(migrations.Migration): 

20 dependencies = [ 

21 ("memory", "0002_memory_memory_md5_index"), 

22 ] 

23 

24 operations = [ 

25 migrations.RunPython( 

26 code=drop_index, 

27 reverse_code=migrations.RunPython.noop, 

28 elidable=True, 

29 ), 

30 ]