"""initial models

Revision ID: 2e0be9d77682
Revises: 
Create Date: 2015-07-13 06:15:18.675688

"""

# revision identifiers, used by Alembic.
revision = '2e0be9d77682'
down_revision = None
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('groups',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(), nullable=True),
    sa.Column('shared_computer', sa.Boolean(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('simulations',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=100), nullable=True),
    sa.Column('folder_name', sa.String(length=50), nullable=True),
    sa.Column('preview_image_filename', sa.String(length=50), nullable=True),
    sa.Column('preview_image_credit', sa.String(length=200), nullable=True),
    sa.Column('desc', sa.String(length=500), nullable=True),
    sa.Column('first_page_id', sa.Integer(), nullable=True),
    sa.Column('order', sa.Integer(), nullable=True),
    sa.Column('password', sa.String(length=50), nullable=True),
    sa.Column('enabled', sa.Boolean(), nullable=True),
    sa.Column('show_library', sa.Boolean(), nullable=True),
    sa.Column('library', sa.String(length=5000), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('pages',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=100), nullable=True),
    sa.Column('sim_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['sim_id'], ['simulations.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('actions',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=200), nullable=True),
    sa.Column('value', sa.String(length=200), nullable=True),
    sa.Column('page_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['page_id'], ['pages.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('choices',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('type', sa.String(length=200), nullable=True),
    sa.Column('text', sa.String(length=200), nullable=True),
    sa.Column('destination', sa.String(length=200), nullable=True),
    sa.Column('tag', sa.String(length=200), nullable=True),
    sa.Column('page_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['page_id'], ['pages.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('links',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('order', sa.Integer(), nullable=True),
    sa.Column('show', sa.String(length=1000), nullable=True),
    sa.Column('button_text', sa.String(length=200), nullable=True),
    sa.Column('top_text', sa.String(length=100), nullable=True),
    sa.Column('show_well', sa.Boolean(), nullable=True),
    sa.Column('page_src_id', sa.Integer(), nullable=True),
    sa.Column('page_dest_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['page_dest_id'], ['pages.id'], ),
    sa.ForeignKeyConstraint(['page_src_id'], ['pages.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('page_modifiers',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=200), nullable=True),
    sa.Column('value', sa.String(length=200), nullable=True),
    sa.Column('page_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['page_id'], ['pages.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('sections',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('content', sa.String(length=10000), nullable=True),
    sa.Column('order', sa.Integer(), nullable=True),
    sa.Column('show', sa.String(length=1000), nullable=True),
    sa.Column('page_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['page_id'], ['pages.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=100), nullable=True),
    sa.Column('last_page', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['last_page'], ['pages.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('name')
    )
    op.create_table('group_users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('group_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['group_id'], ['groups.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('linkactions',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('type', sa.Integer(), nullable=True),
    sa.Column('icon', sa.String(length=50), nullable=True),
    sa.Column('action_string', sa.String(length=5000), nullable=True),
    sa.Column('link_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['link_id'], ['links.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('logged_in_users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('logs',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('content', sa.String(length=2000), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('notes',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('content', sa.String(length=2000), nullable=True),
    sa.Column('icon', sa.String(length=20), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('tag', sa.String(length=200), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('prompts',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('order', sa.Integer(), nullable=True),
    sa.Column('prompt', sa.String(length=300), nullable=True),
    sa.Column('required', sa.Boolean(), nullable=True),
    sa.Column('text_area', sa.Boolean(), nullable=True),
    sa.Column('var_name', sa.String(length=50), nullable=True),
    sa.Column('link_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['link_id'], ['links.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('sim_users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('sim_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['sim_id'], ['simulations.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('sim_users')
    op.drop_table('prompts')
    op.drop_table('notes')
    op.drop_table('logs')
    op.drop_table('logged_in_users')
    op.drop_table('linkactions')
    op.drop_table('group_users')
    op.drop_table('users')
    op.drop_table('sections')
    op.drop_table('page_modifiers')
    op.drop_table('links')
    op.drop_table('choices')
    op.drop_table('actions')
    op.drop_table('pages')
    op.drop_table('simulations')
    op.drop_table('groups')
    ### end Alembic commands ###
