<s> from __future__ import with_statement <EOL> from alembic import context <EOL> from logging . config import fileConfig <EOL> config = context . config <EOL> fileConfig ( config . config_file_name ) <EOL> import sqlalchemy as sa <EOL> from changes . db . types . enum import Enum <EOL> from changes . db . types . filestorage import FileStorage <EOL> from changes . db . types . guid import GUID <EOL> from changes . db . types . json import JSONEncodedDict <EOL> sa . Enum = Enum <EOL> sa . FileStorage = FileStorage <EOL> sa . GUID = GUID <EOL> sa . JSONEncodedDict = JSONEncodedDict <EOL> from flask import current_app <EOL> from changes . config import create_app , db <EOL> import warnings <EOL> from sqlalchemy . exc import SAWarning <EOL> warnings . simplefilter ( "<STR_LIT:ignore>" , SAWarning ) <EOL> if not current_app : <EOL> app = create_app ( ) <EOL> else : <EOL> app = current_app <EOL> app . app_context ( ) . push ( ) <EOL> target_metadata = db . metadata <EOL> import changes . models <EOL> def run_migrations ( ) : <EOL> """<STR_LIT>""" <EOL> connection = db . engine . connect ( ) <EOL> context . configure ( <EOL> connection = connection , <EOL> target_metadata = target_metadata , <EOL> ) <EOL> try : <EOL> with context . begin_transaction ( ) : <EOL> context . run_migrations ( ) <EOL> finally : <EOL> connection . close ( ) <EOL> run_migrations ( ) </s>
