"""Initial

Revision ID: 9<PASSWORD>2e<PASSWORD>b
Revises: 
Create Date: 2018-06-06 17:04:23.868383

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '9<PASSWORD>'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('activo',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('ticker', sa.String(length=64), nullable=True),
    sa.Column('nombre', sa.String(length=64), nullable=True),
    sa.Column('tipo', sa.Integer(), nullable=True),
    sa.Column('url', sa.String(length=256), nullable=True),
    sa.Column('moneda', sa.String(length=3), nullable=True),
    sa.Column('descargar', sa.Boolean(), nullable=True),
    sa.Column('clase', sa.String(length=1), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('nombre'),
    sa.UniqueConstraint('ticker')
    )
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('email', sa.String(length=120), nullable=True),
    sa.Column('password_hash', sa.String(length=128), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
    op.create_index(op.f('ix_user_timestamp'), 'user', ['timestamp'], unique=False)
    op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True)
    op.create_table('cotizacion',
    sa.Column('activo_id', sa.Integer(), nullable=False),
    sa.Column('fecha', sa.DateTime(), nullable=False),
    sa.Column('VL', sa.Float(), nullable=True),
    sa.ForeignKeyConstraint(['activo_id'], ['activo.id'], ),
    sa.PrimaryKeyConstraint('activo_id', 'fecha')
    )
    op.create_table('movimiento_activo',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('fecha', sa.DateTime(), nullable=True),
    sa.Column('unidades', sa.Float(), nullable=True),
    sa.Column('precio', sa.Float(), nullable=True),
    sa.Column('activo_id', sa.Integer(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['activo_id'], ['activo.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('movimiento_activo')
    op.drop_table('cotizacion')
    op.drop_index(op.f('ix_user_username'), table_name='user')
    op.drop_index(op.f('ix_user_timestamp'), table_name='user')
    op.drop_index(op.f('ix_user_email'), table_name='user')
    op.drop_table('user')
    op.drop_table('activo')
    # ### end Alembic commands ###

"""Initial

Revision ID: 9<PASSWORD>2e<PASSWORD>b
Revises: 
Create Date: 2018-06-06 17:04:23.868383

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '9<PASSWORD>'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('activo',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('ticker', sa.String(length=64), nullable=True),
    sa.Column('nombre', sa.String(length=64), nullable=True),
    sa.Column('tipo', sa.Integer(), nullable=True),
    sa.Column('url', sa.String(length=256), nullable=True),
    sa.Column('moneda', sa.String(length=3), nullable=True),
    sa.Column('descargar', sa.Boolean(), nullable=True),
    sa.Column('clase', sa.String(length=1), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('nombre'),
    sa.UniqueConstraint('ticker')
    )
    op.create_table('user',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=64), nullable=True),
    sa.Column('email', sa.String(length=120), nullable=True),
    sa.Column('password_hash', sa.String(length=128), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True)
    op.create_index(op.f('ix_user_timestamp'), 'user', ['timestamp'], unique=False)
    op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True)
    op.create_table('cotizacion',
    sa.Column('activo_id', sa.Integer(), nullable=False),
    sa.Column('fecha', sa.DateTime(), nullable=False),
    sa.Column('VL', sa.Float(), nullable=True),
    sa.ForeignKeyConstraint(['activo_id'], ['activo.id'], ),
    sa.PrimaryKeyConstraint('activo_id', 'fecha')
    )
    op.create_table('movimiento_activo',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('fecha', sa.DateTime(), nullable=True),
    sa.Column('unidades', sa.Float(), nullable=True),
    sa.Column('precio', sa.Float(), nullable=True),
    sa.Column('activo_id', sa.Integer(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['activo_id'], ['activo.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('movimiento_activo')
    op.drop_table('cotizacion')
    op.drop_index(op.f('ix_user_username'), table_name='user')
    op.drop_index(op.f('ix_user_timestamp'), table_name='user')
    op.drop_index(op.f('ix_user_email'), table_name='user')
    op.drop_table('user')
    op.drop_table('activo')
    # ### end Alembic commands ###

Initial  Revision ID: 9<PASSWORD>2e<PASSWORD>b Revises:  Create Date: 2018-06-06 17:04:23.868383 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###