"""New user model

Revision ID: ca77a3430b2
Revises: 69423a89666
Create Date: 2014-10-24 15:46:16.070648

"""

# revision identifiers, used by Alembic.
revision = 'ca77a3430b2'
down_revision = '69423a89666'

from alembic import op
import sqlalchemy as sa


def upgrade():
  ### commands auto generated by Alembic - please adjust! ###
  op.create_table('user',
  sa.Column('id', sa.Integer(), nullable=False),
  sa.Column('email', sa.String(), nullable=True),
  sa.Column('name', sa.String(), nullable=True),
  sa.Column('picture', sa.String(), nullable=True),
  sa.Column('locale', sa.String(), nullable=True),
  sa.Column('hd', sa.String(), nullable=True),
  sa.PrimaryKeyConstraint('id')
  )
  op.create_table('ownership_permissions',
  sa.Column('user_id', sa.Integer(), nullable=True),
  sa.Column('board_id', sa.String(), nullable=True),
  sa.ForeignKeyConstraint(['board_id'], ['board.id'], ),
  sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
  )
  op.create_table('write_permissions',
  sa.Column('user_id', sa.Integer(), nullable=True),
  sa.Column('board_id', sa.String(), nullable=True),
  sa.ForeignKeyConstraint(['board_id'], ['board.id'], ),
  sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
  )
  op.create_table('read_permissions',
  sa.Column('user_id', sa.Integer(), nullable=True),
  sa.Column('board_id', sa.String(), nullable=True),
  sa.ForeignKeyConstraint(['board_id'], ['board.id'], ),
  sa.ForeignKeyConstraint(['user_id'], ['user.id'], )
  )
  op.add_column(u'board', sa.Column('public_can_read', sa.Boolean(), nullable=True))
  op.add_column(u'board', sa.Column('public_can_write', sa.Boolean(), nullable=True))
  ### end Alembic commands ###


def downgrade():
  ### commands auto generated by Alembic - please adjust! ###
  op.drop_column(u'board', 'public_can_write')
  op.drop_column(u'board', 'public_can_read')
  op.drop_table('read_permissions')
  op.drop_table('write_permissions')
  op.drop_table('ownership_permissions')
  op.drop_table('user')
  ### end Alembic commands ###
