コード例 #1
0
ファイル: db_schema.py プロジェクト: wicastchen/Flexget
def after_table_create(event, target, bind, tables=None, **kw):
    """Sets the schema version to most recent for a plugin when it's tables are freshly created."""
    from flexget.manager import manager
    if tables:
        # TODO: Detect if any database upgrading is needed and acquire the lock only in one place
        with manager.acquire_lock(event=False):
            tables = [table.name for table in tables]
            for plugin, info in plugin_schemas.iteritems():
                # Only set the version if all tables for a given plugin are being created
                if all(table in tables for table in info['tables']):
                    set_version(plugin, info['version'])
コード例 #2
0
ファイル: db_schema.py プロジェクト: MikeyCanuck/Flexget
def after_table_create(event, target, bind, tables=None, **kw):
    """Sets the schema version to most recent for a plugin when it's tables are freshly created."""
    from flexget.manager import manager
    if tables:
        # TODO: Detect if any database upgrading is needed and acquire the lock only in one place
        with manager.acquire_lock(event=False):
            tables = [table.name for table in tables]
            for plugin, info in plugin_schemas.iteritems():
                # Only set the version if all tables for a given plugin are being created
                if all(table in tables for table in info['tables']):
                    set_version(plugin, info['version'])