"""empty message

Revision ID: 3cc37d580442
Revises: None
Create Date: 2017-01-31 21:29:51.283969

"""

# revision identifiers, used by Alembic.
revision = '3cc37d580442'
down_revision = None

from alembic import op
import sqlalchemy as sa
import app.models_types


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('tags',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('email', sa.String(length=64), nullable=True),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('password_hash', sa.String(length=128), nullable=True),
    sa.Column('public', app.models_types.BooleanString(), nullable=True),
    sa.Column('timezone', sa.String(length=64), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_users_email'), 'users', ['email'], unique=True)
    op.create_index(op.f('ix_users_username'), 'users', ['username'], unique=True)
    op.create_table('bookmarks',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(), nullable=True),
    sa.Column('created', sa.DateTime(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('title')
    )
    op.create_table('events',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(), nullable=True),
    sa.Column('allDay', app.models_types.BooleanString(), nullable=True),
    sa.Column('start', app.models_types.DateTimeString(), nullable=True),
    sa.Column('end', app.models_types.DateTimeString(), nullable=True),
    sa.Column('editable', app.models_types.BooleanString(), nullable=True),
    sa.Column('url', sa.String(), nullable=True),
    sa.Column('className', sa.String(), nullable=True),
    sa.Column('color', sa.String(), nullable=True),
    sa.Column('textColor', sa.String(), nullable=True),
    sa.Column('backgroundColor', sa.String(), nullable=True),
    sa.Column('borderColor', sa.String(), nullable=True),
    sa.Column('desc', sa.String(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('items',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('created', sa.DateTime(), nullable=True),
    sa.Column('bookmark_id', sa.Integer(), nullable=True),
    sa.Column('desc', sa.String(), nullable=True),
    sa.Column('value', sa.String(), nullable=True),
    sa.ForeignKeyConstraint(['bookmark_id'], ['bookmarks.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('projects',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=32), nullable=True),
    sa.Column('desc', sa.Text(), nullable=True),
    sa.Column('deadline', app.models_types.DateTimeString(), nullable=True),
    sa.Column('created', sa.DateTime(), nullable=True),
    sa.Column('modified', app.models_types.DateTimeString(), nullable=True),
    sa.Column('active', app.models_types.BooleanString(), nullable=True),
    sa.Column('complete', app.models_types.BooleanString(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('deadline_event_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['deadline_event_id'], ['events.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('milestones',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=64), nullable=True),
    sa.Column('desc', sa.Text(), nullable=True),
    sa.Column('position', sa.Integer(), nullable=True),
    sa.Column('project_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('notes',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.Text(), nullable=True),
    sa.Column('body', sa.Text(), nullable=True),
    sa.Column('timestamp', app.models_types.DateTimeString(), nullable=True),
    sa.Column('project_id', sa.Integer(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['project_id'], ['projects.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_notes_timestamp'), 'notes', ['timestamp'], unique=False)
    op.create_table('notestags',
    sa.Column('note_id', sa.Integer(), nullable=True),
    sa.Column('tag_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['note_id'], ['notes.id'], ),
    sa.ForeignKeyConstraint(['tag_id'], ['tags.id'], )
    )
    op.create_table('tasks',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=256), nullable=True),
    sa.Column('created', sa.DateTime(), nullable=True),
    sa.Column('deadline', app.models_types.DateTimeString(), nullable=True),
    sa.Column('notes', sa.String(), nullable=True),
    sa.Column('body', sa.String(), nullable=True),
    sa.Column('importance', sa.Integer(), nullable=True),
    sa.Column('urgency', sa.Integer(), nullable=True),
    sa.Column('active', app.models_types.BooleanString(), nullable=True),
    sa.Column('complete', app.models_types.BooleanString(), nullable=True),
    sa.Column('responsible', sa.String(length=256), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('milestone_id', sa.Integer(), nullable=True),
    sa.Column('deadline_event_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['deadline_event_id'], ['events.id'], ),
    sa.ForeignKeyConstraint(['milestone_id'], ['milestones.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('taskstags',
    sa.Column('task_id', sa.Integer(), nullable=True),
    sa.Column('tag_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['tag_id'], ['tags.id'], ),
    sa.ForeignKeyConstraint(['task_id'], ['tasks.id'], )
    )
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('taskstags')
    op.drop_table('tasks')
    op.drop_table('notestags')
    op.drop_index(op.f('ix_notes_timestamp'), table_name='notes')
    op.drop_table('notes')
    op.drop_table('milestones')
    op.drop_table('projects')
    op.drop_table('items')
    op.drop_table('events')
    op.drop_table('bookmarks')
    op.drop_index(op.f('ix_users_username'), table_name='users')
    op.drop_index(op.f('ix_users_email'), table_name='users')
    op.drop_table('users')
    op.drop_table('tags')
    ### end Alembic commands ###
