Coverage for app/venv/lib/python3.14/site-packages/weblate/utils/migrations/0001_alter_role.py: 85%
11 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-07 07:15 +0000
« 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
5# Generated by Django 3.1.1 on 2020-10-19 12:16
7import os
9from django.db import migrations
12def alter_role(apps, schema_editor) -> None:
13 if ( 13 ↛ 17line 13 didn't jump to line 17 because the condition on line 13 was never true
14 schema_editor.connection.vendor != "postgresql"
15 or "PYTEST_XDIST_TESTRUNUID" in os.environ
16 ):
17 return
19 settings = schema_editor.connection.settings_dict
21 template = "ALTER ROLE {} SET {{}} = {{}}".format(
22 schema_editor.quote_name(settings.get("ALTER_ROLE", settings["USER"]))
23 )
25 schema_editor.execute(template.format("timezone", "UTC"))
28class Migration(migrations.Migration):
29 dependencies = []
31 operations = [
32 migrations.RunPython(alter_role, migrations.RunPython.noop, elidable=False)
33 ]