"""add certification and invoice Revision ID: ecab04cc0e1d Revises: 93a81b22bd80 Create Date: 2026-05-22 09:20:37.807327 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql revision: str = 'ecab04cc0e1d' down_revision: Union[str, None] = '93a81b22bd80' 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('certifications', sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False), sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=False), sa.Column('cert_type', sa.Enum('individual', 'enterprise', name='certtype'), nullable=False), sa.Column('personal_name', sa.String(length=100), nullable=True), sa.Column('personal_id', sa.String(length=30), nullable=True), sa.Column('company_name', sa.String(length=255), nullable=True), sa.Column('tax_id', sa.String(length=30), nullable=True), sa.Column('business_license_url', sa.String(length=500), nullable=True), sa.Column('status', sa.Enum('pending', 'approved', 'rejected', name='certstatus'), nullable=True), sa.Column('reject_reason', sa.Text(), nullable=True), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_certifications_user_id'), 'certifications', ['user_id'], unique=False) op.create_table('invoices', sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False), sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=False), sa.Column('certification_id', postgresql.UUID(as_uuid=True), nullable=True), sa.Column('invoice_type', sa.Enum('individual', 'enterprise', name='invoicetype'), nullable=False), sa.Column('title', sa.String(length=255), nullable=False), sa.Column('tax_id', sa.String(length=30), nullable=True), sa.Column('amount', sa.Float(), nullable=False), sa.Column('status', sa.Enum('pending', 'issued', 'rejected', name='invoicestatus'), nullable=True), sa.Column('reject_reason', sa.Text(), nullable=True), sa.Column('issued_at', sa.DateTime(), nullable=True), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint(['certification_id'], ['certifications.id'], ), sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_invoices_user_id'), 'invoices', ['user_id'], unique=False) op.drop_index('ix_preference_analyses_user_id', table_name='preference_analyses') op.create_index(op.f('ix_preference_analyses_user_id'), 'preference_analyses', ['user_id'], unique=True) op.drop_constraint('system_configs_key_key', 'system_configs', type_='unique') op.drop_index('ix_system_configs_key', table_name='system_configs') op.create_index(op.f('ix_system_configs_key'), 'system_configs', ['key'], unique=True) # ### end Alembic commands ### def downgrade() -> None: # ### commands auto generated by Alembic - please adjust! ### op.drop_index(op.f('ix_system_configs_key'), table_name='system_configs') op.create_index('ix_system_configs_key', 'system_configs', ['key'], unique=False) op.create_unique_constraint('system_configs_key_key', 'system_configs', ['key']) op.drop_index(op.f('ix_preference_analyses_user_id'), table_name='preference_analyses') op.create_index('ix_preference_analyses_user_id', 'preference_analyses', ['user_id'], unique=False) op.drop_index(op.f('ix_invoices_user_id'), table_name='invoices') op.drop_table('invoices') op.drop_index(op.f('ix_certifications_user_id'), table_name='certifications') op.drop_table('certifications') # ### end Alembic commands ###