GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

run_migrations_online()   B
last analyzed

Complexity

Conditions 2

Size

Total Lines 25

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
c 0
b 0
f 0
dl 0
loc 25
rs 8.8571
1
from __future__ import with_statement
2
3
from alembic import context
4
from sqlalchemy import engine_from_config, pool
5
6
# this is the Alembic Config object, which provides
7
# access to the values within the .ini file in use.
8
config = context.config
9
10
# Interpret the config file for Python logging.
11
# This line sets up loggers basically.
12
# from logging.config import fileConfig
13
# fileConfig(config.config_file_name)
14
15
# add your model's MetaData object here
16
# for 'autogenerate' support
17
# from myapp import mymodel
18
# target_metadata = mymodel.Base.metadata
19
from pyjobsweb import model
20
target_metadata = model.metadata
21
22
# other values from the config, defined by the needs of env.py,
23
# can be acquired:
24
# my_important_option = config.get_main_option("my_important_option")
25
# ... etc.
26
27
28
def run_migrations_offline():
29
    """Run migrations in 'offline' mode.
30
31
    This configures the context with just a URL
32
    and not an Engine, though an Engine is acceptable
33
    here as well.  By skipping the Engine creation
34
    we don't even need a DBAPI to be available.
35
36
    Calls to context.execute() here emit the given string to the
37
    script output.
38
39
    """
40
    url = config.get_main_option("sqlalchemy.url")
41
    context.configure(url=url, version_table='migrate_version')
42
43
    with context.begin_transaction():
44
        context.run_migrations()
45
46
47
def run_migrations_online():
48
    """Run migrations in 'online' mode.
49
50
    In this scenario we need to create an Engine
51
    and associate a connection with the context.
52
53
    """
54
    engine = engine_from_config(
55
        config.get_section(config.config_ini_section),
56
        prefix='sqlalchemy.',
57
        poolclass=pool.NullPool
58
    )
59
60
    connection = engine.connect()
61
    context.configure(
62
        connection=connection,
63
        target_metadata=target_metadata,
64
        version_table='migrate_version'
65
    )
66
67
    try:
68
        with context.begin_transaction():
69
            context.run_migrations()
70
    finally:
71
        connection.close()
72
73
74
if context.is_offline_mode():
75
    run_migrations_offline()
76
else:
77
    run_migrations_online()
78