"""'init'

Revision ID: 0b556a5641b5
Revises: 
Create Date: 2019-06-11 12:24:52.291818

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '0b556a5641b5'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('users',
    sa.Column('uid', sa.Integer(), nullable=False),
    sa.Column('username', sa.Text(), nullable=True),
    sa.Column('email', sa.Text(), nullable=True),
    sa.Column('password_text', sa.Text(), nullable=True),
    sa.Column('reg_date', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('uid')
    )
    op.create_table('project',
    sa.Column('pid', sa.Integer(), nullable=False),
    sa.Column('project_name', sa.Text(), nullable=True),
    sa.Column('project_description', sa.Text(), nullable=True),
    sa.Column('project_starting_date', sa.Date(), nullable=True),
    sa.Column('project_releasing', sa.Date(), nullable=True),
    sa.Column('customer_name', sa.Text(), nullable=True),
    sa.Column('customer_contact', sa.Text(), nullable=True),
    sa.Column('customer_mail', sa.Text(), nullable=True),
    sa.Column('customer_company_name', sa.Text(), nullable=True),
    sa.Column('customer_site', sa.Text(), nullable=True),
    sa.Column('uid', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['uid'], ['users.uid'], ),
    sa.PrimaryKeyConstraint('pid')
    )
    op.create_table('share_project',
    sa.Column('uid', sa.Integer(), nullable=True),
    sa.Column('pid', sa.Integer(), nullable=True),
    sa.Column('share_date', sa.DateTime(), nullable=True),
    sa.ForeignKeyConstraint(['pid'], ['project.pid'], ),
    sa.ForeignKeyConstraint(['uid'], ['users.uid'], )
    )
    op.create_table('task_of_project',
    sa.Column('tid', sa.Integer(), nullable=False),
    sa.Column('title', sa.Text(), nullable=True),
    sa.Column('details', sa.Text(), nullable=True),
    sa.Column('start_date', sa.Date(), nullable=True),
    sa.Column('end_date', sa.Date(), nullable=True),
    sa.Column('state', sa.Integer(), nullable=True),
    sa.Column('uid', sa.Integer(), nullable=True),
    sa.Column('pid', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['pid'], ['project.pid'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['uid'], ['users.uid'], ),
    sa.PrimaryKeyConstraint('tid')
    )
    # ### end Alembic commands ###


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