env Namespace Reference


Functions

def run_migrations_offline
def run_migrations_online

Variables

 config = context.config
 target_metadata = None


Function Documentation

def run_migrations_offline (  ) 

Run migrations in 'offline' mode.

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

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

Definition at line 28 of file cdr/env.py.

00028                             :
00029     """Run migrations in 'offline' mode.
00030 
00031     This configures the context with just a URL
00032     and not an Engine, though an Engine is acceptable
00033     here as well.  By skipping the Engine creation
00034     we don't even need a DBAPI to be available.
00035 
00036     Calls to context.execute() here emit the given string to the
00037     script output.
00038 
00039     """
00040     url = config.get_main_option("sqlalchemy.url")
00041     context.configure(url=url)
00042 
00043     with context.begin_transaction():
00044         context.run_migrations()
00045 
def run_migrations_online():

def run_migrations_online (  ) 

Run migrations in 'online' mode.

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

Definition at line 46 of file cdr/env.py.

00046                            :
00047     """Run migrations in 'online' mode.
00048 
00049     In this scenario we need to create an Engine
00050     and associate a connection with the context.
00051 
00052     """
00053     engine = engine_from_config(
00054                 config.get_section(config.config_ini_section),
00055                 prefix='sqlalchemy.',
00056                 poolclass=pool.NullPool)
00057 
00058     connection = engine.connect()
00059     context.configure(
00060                 connection=connection,
00061                 target_metadata=target_metadata
00062                 )
00063 
00064     try:
00065         with context.begin_transaction():
00066             context.run_migrations()
00067     finally:
00068         connection.close()
00069 
if context.is_offline_mode():


Variable Documentation

Definition at line 8 of file cdr/env.py.

Definition at line 21 of file cdr/env.py.


Generated on Thu Apr 16 06:41:38 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6