"""empty message

Revision ID: 2cc431e5815b
Revises: <KEY>
Create Date: 2014-01-07 15:00:06.769451

"""

# revision identifiers, used by Alembic.
revision = '2cc431e5815b'
down_revision = '<KEY>'

import json
import pickle

from alembic import op
import sqlalchemy as sa

from kozmic import db


def upgrade():
    try:
        from kozmic.models import HookCall
        pickled_gh_payloads = dict(list(
            db.session.execute(db.select(columns=['id', 'gh_payload'])
                      .select_from('hook_call'))))
        for call in HookCall.query:
            HookCall.query.filter_by(id=call.id).update({
                'gh_payload': json.dumps(pickle.loads(pickled_gh_payloads[call.id]))
            })
    finally:
        db.session.commit()


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

"""empty message

Revision ID: 2cc431e5815b
Revises: <KEY>
Create Date: 2014-01-07 15:00:06.769451

"""

# revision identifiers, used by Alembic.
revision = '2cc431e5815b'
down_revision = '<KEY>'

import json
import pickle

from alembic import op
import sqlalchemy as sa

from kozmic import db


def upgrade():
    try:
        from kozmic.models import HookCall
        pickled_gh_payloads = dict(list(
            db.session.execute(db.select(columns=['id', 'gh_payload'])
                      .select_from('hook_call'))))
        for call in HookCall.query:
            HookCall.query.filter_by(id=call.id).update({
                'gh_payload': json.dumps(pickle.loads(pickled_gh_payloads[call.id]))
            })
    finally:
        db.session.commit()


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

empty message  Revision ID: 2cc431e5815b Revises: <KEY> Create Date: 2014-01-07 15:00:06.769451 # revision identifiers, used by Alembic. ### commands auto generated by Alembic - please adjust! ### ### end Alembic commands ###