<commit_before>"""merge_rule_tables

Revision ID: 3a79d7a4d1c1
Revises: d<PASSWORD>
Create Date: 2016-05-24 11:59:31.472000

"""

# revision identifiers, used by Alembic.
revision = '3a79d7a4d1c1'
down_revision = '<KEY>'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

def upgrade(engine_name):
    globals()["upgrade_%s" % engine_name]()


def downgrade(engine_name):
    globals()["downgrade_%s" % engine_name]()





def upgrade_error_data():
    ### commands auto generated by Alembic - please adjust! ###
    pass
    ### end Alembic commands ###


def downgrade_error_data():
    ### commands auto generated by Alembic - please adjust! ###
    pass
    ### end Alembic commands ###


def upgrade_job_tracker():
    ### commands auto generated by Alembic - please adjust! ###
    pass
    ### end Alembic commands ###


def downgrade_job_tracker():
    ### commands auto generated by Alembic - please adjust! ###
    pass
    ### end Alembic commands ###


def upgrade_user_manager():
    ### commands auto generated by Alembic - please adjust! ###
    pass
    ### end Alembic commands ###


def downgrade_user_manager():
    ### commands auto generated by Alembic - please adjust! ###
    pass
    ### end Alembic commands ###


def upgrade_validation():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('multi_field_rule')
    op.drop_table('multi_field_rule_type')
    op.add_column('rule', sa.Column('file_id', sa.Integer(), nullable=True))
    op.add_column('rule', sa.Column('target_file_id', sa.Integer(), nullable=True))
    op.create_foreign_key('fk_file_id', 'rule', 'file_type', ['file_id'], ['file_id'])
    op.create_foreign_key('fk_target_file_id', 'rule', 'file_type', ['target_file_id'], ['file_id'])
    ### end Alembic commands ###


def downgrade_validation():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint('fk_target_file_id', 'rule', type_='foreignkey')
    #op.drop_constraint('fk_file_id', 'rule', type_='foreignkey')
    op.drop_column('rule', 'target_file_id')
    op.drop_column('rule', 'file_id')
    op.create_table('multi_field_rule_type',
    sa.Column('multi_field_rule_type_id', sa.INTEGER(), server_default=sa.text(u"nextval('multi_field_rule_type_multi_field_rule_type_id_seq'::regclass)"), nullable=False),
    sa.Column('name', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('description', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.Column('updated_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('multi_field_rule_type_id', name=u'multi_field_rule_type_pkey'),
    postgresql_ignore_search_path=False
    )
    op.create_table('multi_field_rule',
    sa.Column('multi_field_rule_id', sa.INTEGER(), nullable=False),
    sa.Column('file_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('multi_field_rule_type_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('rule_text_1', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('rule_text_2', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('description', sa.TEXT(), autoincrement=False, nullable=True),<commit_msg>Uncommented drop constraint line for fk_file_id<commit_after>"""merge_rule_tables

Revision ID: 3a79d7a4d1c1
Revises: d<PASSWORD>
Create Date: 2016-05-24 11:59:31.472000

"""

# revision identifiers, used by Alembic.
revision = '3a79d7a4d1c1'
down_revision = '<KEY>'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

def upgrade(engine_name):
    globals()["upgrade_%s" % engine_name]()


def downgrade(engine_name):
    globals()["downgrade_%s" % engine_name]()





def upgrade_error_data():
    ### commands auto generated by Alembic - please adjust! ###
    pass
    ### end Alembic commands ###


def downgrade_error_data():
    ### commands auto generated by Alembic - please adjust! ###
    pass
    ### end Alembic commands ###


def upgrade_job_tracker():
    ### commands auto generated by Alembic - please adjust! ###
    pass
    ### end Alembic commands ###


def downgrade_job_tracker():
    ### commands auto generated by Alembic - please adjust! ###
    pass
    ### end Alembic commands ###


def upgrade_user_manager():
    ### commands auto generated by Alembic - please adjust! ###
    pass
    ### end Alembic commands ###


def downgrade_user_manager():
    ### commands auto generated by Alembic - please adjust! ###
    pass
    ### end Alembic commands ###


def upgrade_validation():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('multi_field_rule')
    op.drop_table('multi_field_rule_type')
    op.add_column('rule', sa.Column('file_id', sa.Integer(), nullable=True))
    op.add_column('rule', sa.Column('target_file_id', sa.Integer(), nullable=True))
    op.create_foreign_key('fk_file_id', 'rule', 'file_type', ['file_id'], ['file_id'])
    op.create_foreign_key('fk_target_file_id', 'rule', 'file_type', ['target_file_id'], ['file_id'])
    ### end Alembic commands ###


def downgrade_validation():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint('fk_target_file_id', 'rule', type_='foreignkey')
    op.drop_constraint('fk_file_id', 'rule', type_='foreignkey')
    op.drop_column('rule', 'target_file_id')
    op.drop_column('rule', 'file_id')
    op.create_table('multi_field_rule_type',
    sa.Column('multi_field_rule_type_id', sa.INTEGER(), server_default=sa.text(u"nextval('multi_field_rule_type_multi_field_rule_type_id_seq'::regclass)"), nullable=False),
    sa.Column('name', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('description', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('created_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.Column('updated_at', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('multi_field_rule_type_id', name=u'multi_field_rule_type_pkey'),
    postgresql_ignore_search_path=False
    )
    op.create_table('multi_field_rule',
    sa.Column('multi_field_rule_id', sa.INTEGER(), nullable=False),
    sa.Column('file_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('multi_field_rule_type_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('rule_text_1', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('rule_text_2', sa.TEXT(), autoincrement=False, nullable=True),
    sa.Column('description', sa.TEXT(), autoincrement=False, nullable=True),
{'fraction_non_alphanumeric': 0.1470113085621971, 'fraction_numerical': 0.01057423997650169, 'mean_word_length': 5.259191176470588, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '6720256', 'n_tokens_mistral': 2322, 'n_tokens_neox': 2275, 'n_words': 444}