"""initial commit

Revision ID: c12b19e59531
Revises: bb972e06e6f7
Create Date: 2020-01-22 23:27:19.143073

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = 'c12b19e59531'
down_revision = 'bb972e06e6f7'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('app_tokens',
    sa.Column('id', postgresql.UUID(), nullable=False),
    sa.Column('username', sa.String(), nullable=False),
    sa.Column('expiration_date', sa.Integer(), nullable=False),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_tb_app_tokens'))
    )
    op.create_table('persons',
    sa.Column('creation_date', sa.Integer(), nullable=False),
    sa.Column('modification_date', sa.Integer(), nullable=True),
    sa.Column('id', postgresql.UUID(), nullable=False),
    sa.Column('version', sa.Integer(), nullable=True),
    sa.Column('tags', postgresql.ARRAY(sa.String()), nullable=True),
    sa.Column('creator', sa.String(), nullable=True),
    sa.Column('modifier', sa.String(), nullable=True),
    sa.Column('name', sa.String(), nullable=False),
    sa.Column('last_name', sa.String(), nullable=True),
    sa.Column('full_name', sa.String(), nullable=True),
    sa.Column('address', sa.String(), nullable=True),
    sa.Column('phone', sa.String(), nullable=True),
    sa.Column('image', postgresql.UUID(), nullable=True),
    sa.Column('email', sa.String(), nullable=True),
    sa.Column('cell_no', sa.String(), nullable=True),
    sa.Column('bio', sa.String(), nullable=True),
    sa.Column('is_legal', sa.Boolean(), nullable=True),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_tb_persons')),
    sa.UniqueConstraint('cell_no', name=op.f('persons_id_key')),
    sa.UniqueConstraint('id', name=op.f('persons_id_key'))
    )
    op.create_table('users',
    sa.Column('creation_date', sa.Integer(), nullable=False),
    sa.Column('modification_date', sa.Integer(), nullable=True),
    sa.Column('id', postgresql.UUID(), nullable=False),
    sa.Column('version', sa.Integer(), nullable=True),
    sa.Column('tags', postgresql.ARRAY(sa.String()), nullable=True),
    sa.Column('creator', sa.String(), nullable=True),
    sa.Column('modifier', sa.String(), nullable=True),
    sa.Column('username', sa.String(), nullable=False),
    sa.Column('password', sa.String(), nullable=False),
    sa.Column('person_id', postgresql.UUID(), nullable=True),
    sa.ForeignKeyConstraint(['person_id'], ['persons.id'], name=op.f('fk_tb_users_col_person_id')),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_tb_users')),
    sa.UniqueConstraint('id', name=op.f('users_id_key')),
    sa.UniqueConstraint('username', name=op.f('users_id_key'))
    )
    # ### end Alembic commands ###


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