Exemplo n.º 1
0
from flask.ext.alembic import FlaskAlembicConfig

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = FlaskAlembicConfig("alembic.ini")

# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)

# add your model's MetaData object here
# for 'autogenerate' support
from flask import current_app
with current_app.app_context():
    # set the database url
    config.set_main_option('sqlalchemy.url', current_app.config.get('SQLALCHEMY_DATABASE_URI'))
    flask_app = __import__('%s' % (current_app.name), fromlist=[current_app.name])

db_obj_name = config.get_main_option("flask_sqlalchemy")
db_obj = getattr(flask_app, db_obj_name)
target_metadata = db_obj.metadata

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

def run_migrations_offline():
    """Run migrations in 'offline' mode.

    This configures the context with just a URL
Exemplo n.º 2
0
from flask.ext.alembic import FlaskAlembicConfig

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = FlaskAlembicConfig("alembic.ini")

# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)

# add your model's MetaData object here
# for 'autogenerate' support
from flask import current_app
with current_app.app_context():
    # set the database url
    config.set_main_option('sqlalchemy.url',
                           current_app.config.get('SQLALCHEMY_DATABASE_URI'))
    flask_app = __import__('%s' % (current_app.name),
                           fromlist=[current_app.name])

db_obj_name = config.get_main_option("flask_sqlalchemy")
db_obj = getattr(flask_app, db_obj_name)
target_metadata = db_obj.metadata

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


def run_migrations_offline():
    """Run migrations in 'offline' mode.
Exemplo n.º 3
0
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = FlaskAlembicConfig("alembic.ini")

# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)

# add your model's MetaData object here
# for 'autogenerate' support
from flask import current_app
with current_app.app_context():
    # set the database url
    config.set_main_option(
        'sqlalchemy.url',
        current_app.config.get('SQLALCHEMY_BINDS', {}).get('lastuser', None))
    flask_app = __import__('%s' % (current_app.name),
                           fromlist=[current_app.name])

db_obj_name = config.get_main_option("flask_sqlalchemy")
db_obj = getattr(flask_app, db_obj_name)
target_metadata = db_obj.metadata

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


def run_migrations_offline():
Exemplo n.º 4
0
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = FlaskAlembicConfig("alembic.ini")

# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)

# add your model's MetaData object here
# for 'autogenerate' support
from flask import current_app

with current_app.app_context():
    # set the database url
    config.set_main_option("sqlalchemy.url", current_app.config.get("SQLALCHEMY_DATABASE_URI"))
    flask_app = __import__("%s" % (current_app.name), fromlist=[current_app.name])

db_obj_name = config.get_main_option("flask_sqlalchemy")
db_obj = getattr(flask_app, db_obj_name)
target_metadata = db_obj.metadata

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


def run_migrations_offline():
    """Run migrations in 'offline' mode.
Exemplo n.º 5
0
from flask.ext.alembic import FlaskAlembicConfig

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = FlaskAlembicConfig("alembic.ini")

# Interpret the config file for Python logging.
# This line sets up loggers basically.
fileConfig(config.config_file_name)

# add your model's MetaData object here
# for 'autogenerate' support
from flask import current_app
with current_app.app_context():
    # set the database url
    config.set_main_option('sqlalchemy.url', current_app.config.get('SQLALCHEMY_BINDS', {}).get('lastuser', None))
    flask_app = __import__('%s' % (current_app.name), fromlist=[current_app.name])

db_obj_name = config.get_main_option("flask_sqlalchemy")
db_obj = getattr(flask_app, db_obj_name)
target_metadata = db_obj.metadata

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

def run_migrations_offline():
    """Run migrations in 'offline' mode.

    This configures the context with just a URL