• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / relman-auto-nag / #4848

07 Dec 2023 02:35PM CUT coverage: 21.938%. Remained the same
#4848

push

coveralls-python

suhaibmujahid
Use `product::component` to refer to components in all emails

716 of 3588 branches covered (0.0%)

0 of 7 new or added lines in 7 files covered. (0.0%)

1924 of 8770 relevant lines covered (21.94%)

0.22 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/bugbot/db_migrations/env.py
1
from __future__ import with_statement
×
2

3
import os
×
4
import sys
×
5
from logging.config import fileConfig
×
6

7
from alembic import context
×
8
from sqlalchemy import engine_from_config, pool
×
9

10
sys.path.append(os.getcwd())
×
11

12
try:
×
13
    from bugbot.db import Base, db_url
×
14
except ModuleNotFoundError:
×
15
    raise
×
16

17
# this is the Alembic Config object, which provides
18
# access to the values within the .ini file in use.
19
config = context.config
×
20

21
# Interpret the config file for Python logging.
22
# This line sets up loggers basically.
23
fileConfig(config.config_file_name)
×
24

25
config.set_main_option("sqlalchemy.url", db_url)
×
26
# add your model's MetaData object here
27
# for 'autogenerate' support
28
# from myapp import mymodel
29
# target_metadata = mymodel.Base.metadata
30
target_metadata = Base.metadata
×
31

32
# other values from the config, defined by the needs of env.py,
33
# can be acquired:
34
# my_important_option = config.get_main_option("my_important_option")
35
# ... etc.
36

37

38
def run_migrations_offline():
×
39
    """Run migrations in 'offline' mode.
40

41
    This configures the context with just a URL
42
    and not an Engine, though an Engine is acceptable
43
    here as well.  By skipping the Engine creation
44
    we don't even need a DBAPI to be available.
45

46
    Calls to context.execute() here emit the given string to the
47
    script output.
48

49
    """
50
    url = config.get_main_option("sqlalchemy.url")
×
51
    context.configure(url=url, target_metadata=target_metadata, literal_binds=True)
×
52

53
    with context.begin_transaction():
×
54
        context.run_migrations()
×
55

56

57
def run_migrations_online():
×
58
    """Run migrations in 'online' mode.
59

60
    In this scenario we need to create an Engine
61
    and associate a connection with the context.
62

63
    """
64
    connectable = engine_from_config(
×
65
        config.get_section(config.config_ini_section),
66
        prefix="sqlalchemy.",
67
        poolclass=pool.NullPool,
68
    )
69

70
    with connectable.connect() as connection:
×
71
        context.configure(connection=connection, target_metadata=target_metadata)
×
72

73
        with context.begin_transaction():
×
74
            context.run_migrations()
×
75

76

77
if context.is_offline_mode():
×
78
    run_migrations_offline()
×
79
else:
80
    run_migrations_online()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc