"""Add GroupRequest table.

Revision ID: 39a5823a808
Revises: a364e6e9c14
Create Date: 2013-09-21 15:40:31.274287

"""

# revision identifiers, used by Alembic.
revision = '39a5823a808'
down_revision = 'a364e6e9c14'

from alembic import op
import sqlalchemy as sa


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('grouprequest',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created_at', sa.DateTime(timezone=True), nullable=False),
    sa.Column('from_user_id', sa.Integer(), nullable=True),
    sa.Column('project_id', sa.Integer(), nullable=True),
    sa.Column('to_user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['from_user_id'], [u'user.id'], ),
    sa.ForeignKeyConstraint(['project_id'], [u'project.id'], ),
    sa.ForeignKeyConstraint(['to_user_id'], [u'user.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('from_user_id','project_id')
    )
    ### end Alembic commands ###


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