@@ -0,0 +1,1940 @@
+%22%22%22Add eventhandler tables%0A%0ARevision ID: 50adc980d625%0ARevises: 239995464c48%0ACreate Date: 2016-05-04 17:11:51.776440%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '50adc980d625'%0Adown_revision = '239995464c48'%0A%0Afrom alembic import op%0Aimport sqlalchemy as sa%0Afrom sqlalchemy.exc import OperationalError, ProgrammingError, InternalError%0A%0A%0Adef upgrade():%0A    try:%0A        op.create_table('eventhandler',%0A        sa.Column('id', sa.Integer(), nullable=False),%0A        sa.Column('ordering', sa.Integer(), nullable=False),%0A        sa.Column('event', sa.Unicode(length=255), nullable=False),%0A        sa.Column('handlermodule', sa.Unicode(length=255), nullable=False),%0A        sa.Column('condition', sa.Unicode(length=1024), nullable=True),%0A        sa.Column('action', sa.Unicode(length=1024), nullable=True),%0A        sa.PrimaryKeyConstraint('id')%0A        )%0A        op.create_table('eventhandleroption',%0A        sa.Column('id', sa.Integer(), nullable=False),%0A        sa.Column('eventhandler_id', sa.Integer(), nullable=True),%0A        sa.Column('Key', sa.Unicode(length=255), nullable=False),%0A        sa.Column('Value', sa.Unicode(length=2000), nullable=True),%0A        sa.Column('Type', sa.Unicode(length=2000), nullable=True),%0A        sa.Column('Description', sa.Unicode(length=2000), nullable=True),%0A        sa.ForeignKeyConstraint(%5B'eventhandler_id'%5D, %5B'eventhandler.id'%5D, ),%0A        sa.PrimaryKeyConstraint('id'),%0A        sa.UniqueConstraint('eventhandler_id', 'Key', name='ehoix_1')%0A        )%0A    except (OperationalError, ProgrammingError, InternalError) as exx:%0A        if exx.orig.message.lower().startswith(%22duplicate column name%22):%0A            print(%22Good. Table 'eventhandler' already exists.%22)%0A        else:%0A            print(exx)%0A    except Exception as exx:%0A        print (%22Could not add table 'eventhandler'%22)%0A        print (exx)%0A%0A%0Adef downgrade():%0A    op.drop_table('eventhandleroption')%0A    op.drop_table('eventhandler')%0A%0A

add eventhandler DB table