<filename>api/migrations/versions/6fa47605c615_.py
"""empty message

Revision ID: 6fa47605c615
Revises: <PASSWORD>
Create Date: 2019-02-05 07:33:03.706172

"""

# revision identifiers, used by Alembic.
revision = '6fa47605c615'
down_revision = '<PASSWORD>'

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

def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('response',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('application_form_id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=False),
    sa.Column('is_submitted', sa.Boolean(), nullable=False),
    sa.Column('submitted_timestamp', sa.DateTime(), nullable=True),
    sa.Column('is_withdrawn', sa.Boolean(), nullable=False),
    sa.Column('withdrawn_timestamp', sa.DateTime(), nullable=True),
    sa.Column('started_timestamp', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['app_user.id'] ),
    sa.ForeignKeyConstraint(['application_form_id'], ['application_form.id'] ),
    sa.PrimaryKeyConstraint('id')
    )

    op.create_table('answer',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('response_id', sa.Integer(), nullable=False),
    sa.Column('question_id', sa.Integer(), nullable=False),
    sa.Column('value', sa.String(), nullable=False),
    sa.ForeignKeyConstraint(['response_id'], ['response.id'] ),
    sa.ForeignKeyConstraint(['question_id'], ['question.id'] ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('answer')    
    op.drop_table('response')
    # ### end Alembic commands ###
