Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/django/core/management/sql.py: 76%
22 statements
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
1import sys
3from django.apps import apps
4from django.db import models
7def sql_flush(style, connection, reset_sequences=True, allow_cascade=False):
8 """
9 Return a list of the SQL statements used to flush the database.
10 """
11 tables = connection.introspection.django_table_names(
12 only_existing=True, include_views=False
13 )
14 return connection.ops.sql_flush(
15 style,
16 tables,
17 reset_sequences=reset_sequences,
18 allow_cascade=allow_cascade,
19 )
22def emit_pre_migrate_signal(verbosity, interactive, db, **kwargs):
23 # Emit the pre_migrate signal for every application.
24 for app_config in apps.get_app_configs():
25 if app_config.models_module is None:
26 continue
27 if verbosity >= 2: 27 ↛ 28line 27 didn't jump to line 28, because the condition on line 27 was never true
28 stdout = kwargs.get("stdout", sys.stdout)
29 stdout.write(
30 "Running pre-migrate handlers for application %s" % app_config.label
31 )
32 models.signals.pre_migrate.send(
33 sender=app_config,
34 app_config=app_config,
35 verbosity=verbosity,
36 interactive=interactive,
37 using=db,
38 **kwargs,
39 )
42def emit_post_migrate_signal(verbosity, interactive, db, **kwargs):
43 # Emit the post_migrate signal for every application.
44 for app_config in apps.get_app_configs():
45 if app_config.models_module is None:
46 continue
47 if verbosity >= 2: 47 ↛ 48line 47 didn't jump to line 48, because the condition on line 47 was never true
48 stdout = kwargs.get("stdout", sys.stdout)
49 stdout.write(
50 "Running post-migrate handlers for application %s" % app_config.label
51 )
52 models.signals.post_migrate.send(
53 sender=app_config,
54 app_config=app_config,
55 verbosity=verbosity,
56 interactive=interactive,
57 using=db,
58 **kwargs,
59 )