fossasia/open-event-orga-server

View on GitHub
migrations/versions/f63b9b9b645b_.py

Summary

Maintainability
C
7 hrs
Test Coverage
"""empty message

Revision ID: f63b9b9b645b
Revises: 4defe72abed3
Create Date: 2017-07-27 15:13:51.728518

"""

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

# revision identifiers, used by Alembic.
revision = 'f63b9b9b645b'
down_revision = '4defe72abed3'


def upgrade():
    # commands auto generated by Alembic - please adjust! #
    op.execute("ALTER TABLE email_notifications ALTER after_ticket_purchase TYPE boolean USING CASE after_ticket_purchase WHEN 1 THEN TRUE\
                ELSE FALSE END", execution_options=None)
    op.execute("ALTER TABLE email_notifications ALTER new_paper TYPE boolean USING CASE new_paper WHEN 1 THEN TRUE\
                ELSE FALSE END", execution_options=None)
    op.execute("ALTER TABLE email_notifications ALTER next_event TYPE boolean USING CASE next_event WHEN 1 THEN TRUE\
                ELSE FALSE END", execution_options=None)
    op.execute("ALTER TABLE email_notifications ALTER session_accept_reject TYPE boolean USING CASE session_accept_reject WHEN 1 THEN TRUE\
                ELSE FALSE END", execution_options=None)
    op.execute("ALTER TABLE email_notifications ALTER session_schedule TYPE boolean USING CASE session_schedule WHEN 1 THEN TRUE\
                ELSE FALSE END", execution_options=None)
    # end Alembic commands #


def downgrade():
    # commands auto generated by Alembic - please adjust! #
    op.execute("ALTER TABLE image_sizes ALTER after_ticket_purchase TYPE integer USING CASE after_ticket_purchase WHEN TRUE THEN 1\
                ELSE 0 END", execution_options=None)
    op.execute("ALTER TABLE image_sizes ALTER new_paper TYPE integer USING CASE new_paper WHEN TRUE THEN 1\
                ELSE 0 END", execution_options=None)
    op.execute("ALTER TABLE image_sizes ALTER next_event TYPE integer USING CASE next_event WHEN TRUE THEN 1\
                ELSE 0 END", execution_options=None)
    op.execute("ALTER TABLE image_sizes ALTER session_accept_reject TYPE integer USING CASE session_accept_reject WHEN TRUE THEN 1\
                ELSE 0 END", execution_options=None)
    op.execute("ALTER TABLE image_sizes ALTER session_schedule TYPE integer USING CASE session_schedule WHEN TRUE THEN 1\
                ELSE 0 END", execution_options=None)
    # end Alembic commands #