Subir archivos a "/"

This commit is contained in:
2025-12-23 16:54:07 +00:00
commit b02694d9ff
222 changed files with 17869 additions and 0 deletions

View File

@@ -0,0 +1,124 @@
"""agregar tabla usuarios
Revision ID: a3113e7c1b12
Revises:
Create Date: 2025-12-15 19:24:37.318851
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'a3113e7c1b12'
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('clientes',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('nombre', sa.String(length=255), nullable=False),
sa.Column('email', sa.String(length=255), nullable=False),
sa.Column('rfc', sa.String(length=13), nullable=True),
sa.Column('telefono', sa.String(length=20), nullable=True),
sa.Column('timbres_consumidos', sa.Integer(), nullable=False),
sa.Column('estado', sa.Enum('ACTIVO', 'INACTIVO', 'SUSPENDIDO', name='estadocliente'), nullable=False),
sa.Column('permite_subclientes', sa.Boolean(), nullable=False),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_clientes_email'), 'clientes', ['email'], unique=True)
op.create_index(op.f('ix_clientes_id'), 'clientes', ['id'], unique=False)
op.create_index(op.f('ix_clientes_rfc'), 'clientes', ['rfc'], unique=True)
op.create_table('usuarios',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('username', sa.String(length=50), nullable=False),
sa.Column('email', sa.String(length=255), nullable=False),
sa.Column('hashed_password', sa.String(length=255), nullable=False),
sa.Column('nombre_completo', sa.String(length=255), nullable=True),
sa.Column('is_active', sa.Boolean(), nullable=False),
sa.Column('is_superuser', sa.Boolean(), nullable=False),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
sa.Column('last_login', sa.DateTime(timezone=True), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_usuarios_email'), 'usuarios', ['email'], unique=True)
op.create_index(op.f('ix_usuarios_id'), 'usuarios', ['id'], unique=False)
op.create_index(op.f('ix_usuarios_username'), 'usuarios', ['username'], unique=True)
op.create_table('limites_timbres',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('cliente_id', sa.Integer(), nullable=False),
sa.Column('tipo', sa.Enum('ASIGNACION_INICIAL', 'INCREMENTO', 'DECREMENTO', 'AJUSTE', name='tipolimite'), nullable=False),
sa.Column('cantidad', sa.Integer(), nullable=False),
sa.Column('descripcion', sa.String(length=500), nullable=True),
sa.Column('activo', sa.Integer(), nullable=False),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
sa.Column('inactivado_at', sa.DateTime(timezone=True), nullable=True),
sa.ForeignKeyConstraint(['cliente_id'], ['clientes.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_limites_timbres_id'), 'limites_timbres', ['id'], unique=False)
op.create_table('subclientes',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('cliente_id', sa.Integer(), nullable=False),
sa.Column('nombre', sa.String(length=255), nullable=False),
sa.Column('email', sa.String(length=255), nullable=False),
sa.Column('rfc', sa.String(length=13), nullable=True),
sa.Column('telefono', sa.String(length=20), nullable=True),
sa.Column('timbres_consumidos', sa.Integer(), nullable=False),
sa.Column('limite_propio', sa.Integer(), nullable=True),
sa.Column('estado', sa.Enum('ACTIVO', 'INACTIVO', 'SUSPENDIDO', name='estadocliente'), nullable=False),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
sa.Column('updated_at', sa.DateTime(timezone=True), nullable=True),
sa.ForeignKeyConstraint(['cliente_id'], ['clientes.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_subclientes_email'), 'subclientes', ['email'], unique=True)
op.create_index(op.f('ix_subclientes_id'), 'subclientes', ['id'], unique=False)
op.create_index(op.f('ix_subclientes_rfc'), 'subclientes', ['rfc'], unique=False)
op.create_table('movimientos_timbres',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('cliente_id', sa.Integer(), nullable=False),
sa.Column('subcliente_id', sa.Integer(), nullable=True),
sa.Column('tipo', sa.Enum('CONSUMO', 'RECARGA', 'AJUSTE', name='tipomovimiento'), nullable=False),
sa.Column('cantidad', sa.Integer(), nullable=False),
sa.Column('descripcion', sa.String(length=500), nullable=True),
sa.Column('referencia_externa', sa.String(length=255), nullable=True),
sa.Column('balance_cliente', sa.Integer(), nullable=False),
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
sa.ForeignKeyConstraint(['cliente_id'], ['clientes.id'], ),
sa.ForeignKeyConstraint(['subcliente_id'], ['subclientes.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_movimientos_timbres_id'), 'movimientos_timbres', ['id'], unique=False)
op.create_index(op.f('ix_movimientos_timbres_referencia_externa'), 'movimientos_timbres', ['referencia_externa'], unique=False)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f('ix_movimientos_timbres_referencia_externa'), table_name='movimientos_timbres')
op.drop_index(op.f('ix_movimientos_timbres_id'), table_name='movimientos_timbres')
op.drop_table('movimientos_timbres')
op.drop_index(op.f('ix_subclientes_rfc'), table_name='subclientes')
op.drop_index(op.f('ix_subclientes_id'), table_name='subclientes')
op.drop_index(op.f('ix_subclientes_email'), table_name='subclientes')
op.drop_table('subclientes')
op.drop_index(op.f('ix_limites_timbres_id'), table_name='limites_timbres')
op.drop_table('limites_timbres')
op.drop_index(op.f('ix_usuarios_username'), table_name='usuarios')
op.drop_index(op.f('ix_usuarios_id'), table_name='usuarios')
op.drop_index(op.f('ix_usuarios_email'), table_name='usuarios')
op.drop_table('usuarios')
op.drop_index(op.f('ix_clientes_rfc'), table_name='clientes')
op.drop_index(op.f('ix_clientes_id'), table_name='clientes')
op.drop_index(op.f('ix_clientes_email'), table_name='clientes')
op.drop_table('clientes')
# ### end Alembic commands ###