<commit_before>"""Add apscheduler_jobs table to store background jobs

Revision ID: 0f6042416884
Revises: 001
Create Date: 2017-03-24 11:21:29.036532

"""
from alembic import op
import sqlalchemy as sa

from watcher.db.sqlalchemy import models

# revision identifiers, used by Alembic.
revision = '0f6042416884'
down_revision = '001'


def upgrade():
    op.create_table(
        'apscheduler_jobs',
        sa.Column('id', sa.Unicode(191, _warn_on_bytestring=False),
                  nullable=False),<commit_msg>Watcher DB upgrde compatibility consideration for add_apscheduler_jobs<commit_after>"""Add apscheduler_jobs table to store background jobs

Revision ID: 0f6042416884
Revises: 001
Create Date: 2017-03-24 11:21:29.036532

"""
from alembic import op
from sqlalchemy import inspect
import sqlalchemy as sa

from watcher.db.sqlalchemy import models

# revision identifiers, used by Alembic.
revision = '0f6042416884'
down_revision = '001'

def _table_exists(table_name):
    bind = op.get_context().bind
    insp = inspect(bind)
    names = insp.get_table_names()
    return any(t == table_name for t in names)


def upgrade():
    if _table_exists('apscheduler_jobs'):
        return

    op.create_table(
        'apscheduler_jobs',
        sa.Column('id', sa.Unicode(191, _warn_on_bytestring=False),
                  nullable=False),
{'fraction_non_alphanumeric': 0.09212481426448738, 'fraction_numerical': 0.07578008915304606, 'mean_word_length': 4.026119402985074, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5046413', 'n_tokens_mistral': 522, 'n_tokens_neox': 444, 'n_words': 117}