"""Create general schema tables

Revision ID: 5ddbaa686ea6
Revises: 
Create Date: 2025-06-19 14:13:34.907163

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '5ddbaa686ea6'
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('accounts',
    sa.Column('account_id', sa.UUID(), nullable=False),
    sa.Column('account_name', sa.String(length=255), nullable=True),
    sa.Column('is_team', sa.Boolean(), nullable=False),
    sa.Column('config_admin_email', sa.String(), nullable=True),
    sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.PrimaryKeyConstraint('account_id'),
    schema='general'
    )
    op.create_index('idx_accounts_created_at', 'accounts', ['created_at'], unique=False, schema='general')
    op.create_index(op.f('ix_general_accounts_is_team'), 'accounts', ['is_team'], unique=False, schema='general')
    op.create_table('account_data_connections',
    sa.Column('id', sa.UUID(), nullable=False),
    sa.Column('account_id', sa.UUID(), nullable=False),
    sa.Column('db_host', sa.String(), nullable=True),
    sa.Column('db_port', sa.Integer(), nullable=True),
    sa.Column('db_name', sa.String(), nullable=True),
    sa.Column('db_user', sa.String(), nullable=True),
    sa.Column('db_password', sa.String(), nullable=True),
    sa.Column('vector_store_url', sa.String(), nullable=True),
    sa.Column('vector_store_key', sa.String(), nullable=True),
    sa.ForeignKeyConstraint(['account_id'], ['general.accounts.account_id'], ),
    sa.PrimaryKeyConstraint('id'),
    schema='general'
    )
    op.create_index(op.f('ix_general_account_data_connections_account_id'), 'account_data_connections', ['account_id'], unique=False, schema='general')
    op.create_table('invoices',
    sa.Column('invoice_id', sa.UUID(), nullable=False),
    sa.Column('account_id', sa.UUID(), nullable=False),
    sa.Column('invoice_number', sa.String(length=50), nullable=False),
    sa.Column('date_from', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('date_to', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('invoice_date', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.Column('due_date', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('package', sa.String(length=20), nullable=False),
    sa.Column('plan_type', sa.String(length=20), nullable=False),
    sa.Column('nb_licences', sa.String(length=10), nullable=False),
    sa.Column('subtotal', sa.Numeric(precision=10, scale=2), nullable=False),
    sa.Column('tax1_rate', sa.Numeric(precision=5, scale=4), nullable=False),
    sa.Column('tax1_amount', sa.Numeric(precision=10, scale=2), nullable=False),
    sa.Column('tax2_rate', sa.Numeric(precision=5, scale=4), nullable=False),
    sa.Column('tax2_amount', sa.Numeric(precision=10, scale=2), nullable=False),
    sa.Column('total', sa.Numeric(precision=10, scale=2), nullable=False),
    sa.Column('currency', sa.String(length=3), nullable=False),
    sa.Column('payment_status', sa.String(length=20), nullable=False),
    sa.Column('payment_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('payment_confirmation_no', sa.String(length=100), nullable=True),
    sa.Column('payment_method_used', sa.String(length=50), nullable=True),
    sa.Column('notes', sa.String(length=1000), nullable=True),
    sa.Column('metadata', sa.JSON(), nullable=True),
    sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.CheckConstraint("package IN ('STANDARD', 'PRO', 'ELITE')", name='invoices_package_type_check'),
    sa.CheckConstraint("payment_status IN ('pending', 'paid', 'failed', 'cancelled', 'refunded')", name='invoices_payment_status_check'),
    sa.CheckConstraint("plan_type IN ('individual', 'team')", name='invoices_plan_type_check'),
    sa.CheckConstraint('date_to > date_from', name='invoices_date_range_check'),
    sa.CheckConstraint('due_date >= invoice_date', name='invoices_due_date_check'),
    sa.CheckConstraint('subtotal >= 0 AND total >= 0', name='invoices_amounts_positive_check'),
    sa.ForeignKeyConstraint(['account_id'], ['general.accounts.account_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('invoice_id'),
    schema='general'
    )
    op.create_index('idx_invoices_period', 'invoices', ['date_from', 'date_to'], unique=False, schema='general')
    op.create_index(op.f('ix_general_invoices_account_id'), 'invoices', ['account_id'], unique=False, schema='general')
    op.create_index(op.f('ix_general_invoices_date_from'), 'invoices', ['date_from'], unique=False, schema='general')
    op.create_index(op.f('ix_general_invoices_date_to'), 'invoices', ['date_to'], unique=False, schema='general')
    op.create_index(op.f('ix_general_invoices_due_date'), 'invoices', ['due_date'], unique=False, schema='general')
    op.create_index(op.f('ix_general_invoices_invoice_number'), 'invoices', ['invoice_number'], unique=True, schema='general')
    op.create_index(op.f('ix_general_invoices_payment_confirmation_no'), 'invoices', ['payment_confirmation_no'], unique=False, schema='general')
    op.create_index(op.f('ix_general_invoices_payment_date'), 'invoices', ['payment_date'], unique=False, schema='general')
    op.create_index(op.f('ix_general_invoices_payment_status'), 'invoices', ['payment_status'], unique=False, schema='general')
    op.create_table('packages',
    sa.Column('package_id', sa.UUID(), nullable=False),
    sa.Column('account_id', sa.UUID(), nullable=False),
    sa.Column('package', sa.String(length=20), nullable=False),
    sa.Column('begin_date', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.Column('end_date', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('is_active', sa.Boolean(), nullable=False),
    sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.CheckConstraint("package IN ('STANDARD', 'PRO', 'ELITE')", name='packages_package_type_check'),
    sa.CheckConstraint('end_date IS NULL OR end_date > begin_date', name='packages_date_range_check'),
    sa.ForeignKeyConstraint(['account_id'], ['general.accounts.account_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('package_id'),
    schema='general'
    )
    op.create_index(op.f('ix_general_packages_account_id'), 'packages', ['account_id'], unique=False, schema='general')
    op.create_index(op.f('ix_general_packages_begin_date'), 'packages', ['begin_date'], unique=False, schema='general')
    op.create_index(op.f('ix_general_packages_is_active'), 'packages', ['is_active'], unique=False, schema='general')
    op.create_index(op.f('ix_general_packages_package'), 'packages', ['package'], unique=False, schema='general')
    op.create_table('payment_methods',
    sa.Column('payment_method_id', sa.UUID(), nullable=False),
    sa.Column('account_id', sa.UUID(), nullable=False),
    sa.Column('stripe_account_id', sa.String(), nullable=True),
    sa.Column('stripe_payment_method_id', sa.String(), nullable=True),
    sa.Column('card_holder_name', sa.String(), nullable=True),
    sa.Column('card_last_four', sa.String(length=4), nullable=True),
    sa.Column('card_brand', sa.String(length=20), nullable=False),
    sa.Column('card_exp_month', sa.String(length=2), nullable=False),
    sa.Column('card_exp_year', sa.String(length=4), nullable=False),
    sa.Column('is_default', sa.Boolean(), nullable=False),
    sa.Column('is_active', sa.Boolean(), nullable=False),
    sa.Column('is_expired', sa.Boolean(), nullable=False),
    sa.Column('stripe_metadata', sa.JSON(), nullable=True),
    sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.Column('last_used_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.CheckConstraint("card_brand IN ('visa', 'mastercard', 'amex', 'discover', 'diners', 'jcb', 'unionpay', 'unknown')", name='payment_methods_card_brand_check'),
    sa.ForeignKeyConstraint(['account_id'], ['general.accounts.account_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('payment_method_id'),
    schema='general'
    )
    op.create_index('idx_payment_methods_is_expired', 'payment_methods', ['is_expired'], unique=False, schema='general')
    op.create_index(op.f('ix_general_payment_methods_account_id'), 'payment_methods', ['account_id'], unique=False, schema='general')
    op.create_index(op.f('ix_general_payment_methods_is_active'), 'payment_methods', ['is_active'], unique=False, schema='general')
    op.create_index(op.f('ix_general_payment_methods_is_default'), 'payment_methods', ['is_default'], unique=False, schema='general')
    op.create_index(op.f('ix_general_payment_methods_is_expired'), 'payment_methods', ['is_expired'], unique=False, schema='general')
    op.create_index(op.f('ix_general_payment_methods_last_used_at'), 'payment_methods', ['last_used_at'], unique=False, schema='general')
    op.create_table('users',
    sa.Column('user_id', sa.UUID(), nullable=False),
    sa.Column('entra_id', sa.String(length=255), nullable=False),
    sa.Column('tenant_id', sa.String(length=255), nullable=True),
    sa.Column('account_id', sa.UUID(), nullable=False),
    sa.Column('email', sa.String(), nullable=True),
    sa.Column('display_name', sa.String(), nullable=True),
    sa.Column('given_name', sa.String(), nullable=True),
    sa.Column('family_name', sa.String(), nullable=True),
    sa.Column('preferred_username', sa.String(), nullable=True),
    sa.Column('config_delegated_to_name', sa.String(), nullable=True),
    sa.Column('config_delegated_to_email', sa.String(), nullable=True),
    sa.Column('is_active', sa.Boolean(), nullable=False),
    sa.Column('is_team_admin', sa.Boolean(), nullable=False),
    sa.Column('status', sa.Enum('ACTIVE', 'PENDING_TEAM_INVITATION', 'INACTIVE', name='user_status_enum'), nullable=False),
    sa.Column('metadata', sa.JSON(), nullable=True),
    sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.Column('last_login_at', sa.TIMESTAMP(timezone=True), nullable=True),
    sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.ForeignKeyConstraint(['account_id'], ['general.accounts.account_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('user_id'),
    schema='general'
    )
    op.create_index('idx_users_last_login', 'users', ['last_login_at'], unique=False, schema='general')
    op.create_index(op.f('ix_general_users_account_id'), 'users', ['account_id'], unique=False, schema='general')
    op.create_index(op.f('ix_general_users_entra_id'), 'users', ['entra_id'], unique=True, schema='general')
    op.create_index(op.f('ix_general_users_is_active'), 'users', ['is_active'], unique=False, schema='general')
    op.create_index(op.f('ix_general_users_is_team_admin'), 'users', ['is_team_admin'], unique=False, schema='general')
    op.create_index(op.f('ix_general_users_last_login_at'), 'users', ['last_login_at'], unique=False, schema='general')
    op.create_index(op.f('ix_general_users_status'), 'users', ['status'], unique=False, schema='general')
    op.create_index(op.f('ix_general_users_tenant_id'), 'users', ['tenant_id'], unique=False, schema='general')
    op.create_table('user_invitations',
    sa.Column('invitation_id', sa.UUID(), nullable=False),
    sa.Column('invited_by_user_id', sa.UUID(), nullable=True),
    sa.Column('account_id', sa.UUID(), nullable=False),
    sa.Column('invited_user_email', sa.String(), nullable=False),
    sa.Column('invited_user_id', sa.UUID(), nullable=True),
    sa.Column('token_hash', sa.String(length=255), nullable=False),
    sa.Column('status', sa.Enum('PENDING', 'ACCEPTED', 'EXPIRED', 'CANCELLED', name='invitation_status_enum'), nullable=False),
    sa.Column('expires_at', sa.DateTime(timezone=True), nullable=False),
    sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
    sa.Column('updated_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
    sa.ForeignKeyConstraint(['account_id'], ['general.accounts.account_id'], ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['invited_by_user_id'], ['general.users.user_id'], ondelete='SET NULL'),
    sa.ForeignKeyConstraint(['invited_user_id'], ['general.users.user_id'], ondelete='SET NULL'),
    sa.PrimaryKeyConstraint('invitation_id'),
    sa.UniqueConstraint('token_hash'),
    schema='general'
    )
    op.create_index(op.f('ix_general_user_invitations_invited_user_email'), 'user_invitations', ['invited_user_email'], unique=False, schema='general')
    op.create_index(op.f('ix_general_user_invitations_invited_user_id'), 'user_invitations', ['invited_user_id'], unique=False, schema='general')
    op.create_table('user_preferences',
    sa.Column('preference_id', sa.UUID(), nullable=False),
    sa.Column('user_id', sa.UUID(), nullable=False),
    sa.Column('language', sa.String(length=5), nullable=False),
    sa.Column('leo_call_name', sa.String(), nullable=True),
    sa.Column('agent_tone', sa.String(length=20), nullable=False),
    sa.Column('default_currency', sa.String(length=3), nullable=False),
    sa.Column('notification_email_enabled', sa.Boolean(), nullable=False),
    sa.Column('notification_sms_enabled', sa.Boolean(), nullable=False),
    sa.Column('notification_email', sa.String(), nullable=True),
    sa.Column('notification_phone', sa.String(), nullable=True),
    sa.Column('custom_settings', sa.JSON(), nullable=True),
    sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.CheckConstraint("agent_tone IN ('friendly', 'professional', 'direct')", name='user_preferences_agent_tone_check'),
    sa.CheckConstraint("language IN ('fr', 'en')", name='user_preferences_language_check'),
    sa.ForeignKeyConstraint(['user_id'], ['general.users.user_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('preference_id'),
    schema='general'
    )
    op.create_index(op.f('ix_general_user_preferences_user_id'), 'user_preferences', ['user_id'], unique=True, schema='general')
    op.create_table('user_sessions',
    sa.Column('session_id', sa.UUID(), nullable=False),
    sa.Column('user_id', sa.UUID(), nullable=False),
    sa.Column('jwt_token_hash', sa.String(length=255), nullable=False),
    sa.Column('client_type', sa.String(length=50), nullable=False),
    sa.Column('client_version', sa.String(length=50), nullable=True),
    sa.Column('client_ip_address', sa.String(), nullable=True),
    sa.Column('user_agent', sa.Text(), nullable=True),
    sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.Column('expires_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('last_activity_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.Column('is_active', sa.Boolean(), nullable=False),
    sa.Column('metadata', sa.JSON(), nullable=True),
    sa.CheckConstraint("client_type IN ('WEB', 'TEAMS', 'MOBILE', 'API', 'OTHER')", name='user_sessions_client_type_check'),
    sa.ForeignKeyConstraint(['user_id'], ['general.users.user_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('session_id'),
    schema='general'
    )
    op.create_index('idx_user_sessions_jwt_hash', 'user_sessions', ['jwt_token_hash'], unique=False, schema='general')
    op.create_index(op.f('ix_general_user_sessions_expires_at'), 'user_sessions', ['expires_at'], unique=False, schema='general')
    op.create_index(op.f('ix_general_user_sessions_is_active'), 'user_sessions', ['is_active'], unique=False, schema='general')
    op.create_index(op.f('ix_general_user_sessions_jwt_token_hash'), 'user_sessions', ['jwt_token_hash'], unique=False, schema='general')
    op.create_index(op.f('ix_general_user_sessions_user_id'), 'user_sessions', ['user_id'], unique=False, schema='general')
    op.create_table('user_themes',
    sa.Column('id', sa.UUID(), nullable=False),
    sa.Column('user_id', sa.UUID(), nullable=False),
    sa.Column('theme_key', sa.String(length=50), nullable=False),
    sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.ForeignKeyConstraint(['user_id'], ['general.users.user_id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id'),
    schema='general'
    )
    op.create_index(op.f('ix_general_user_themes_user_id'), 'user_themes', ['user_id'], unique=False, schema='general')
    op.create_table('user_theme_indicators',
    sa.Column('id', sa.UUID(), nullable=False),
    sa.Column('user_theme_id', sa.UUID(), nullable=False),
    sa.Column('indicator_key', sa.String(length=50), nullable=False),
    sa.Column('created_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.Column('updated_at', sa.TIMESTAMP(timezone=True), server_default=sa.text('CURRENT_TIMESTAMP'), nullable=False),
    sa.ForeignKeyConstraint(['user_theme_id'], ['general.user_themes.id'], ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id'),
    schema='general'
    )
    op.create_index(op.f('ix_general_user_theme_indicators_user_theme_id'), 'user_theme_indicators', ['user_theme_id'], unique=False, schema='general')
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_general_user_theme_indicators_user_theme_id'), table_name='user_theme_indicators', schema='general')
    op.drop_table('user_theme_indicators', schema='general')
    op.drop_index(op.f('ix_general_user_themes_user_id'), table_name='user_themes', schema='general')
    op.drop_table('user_themes', schema='general')
    op.drop_index(op.f('ix_general_user_sessions_user_id'), table_name='user_sessions', schema='general')
    op.drop_index(op.f('ix_general_user_sessions_jwt_token_hash'), table_name='user_sessions', schema='general')
    op.drop_index(op.f('ix_general_user_sessions_is_active'), table_name='user_sessions', schema='general')
    op.drop_index(op.f('ix_general_user_sessions_expires_at'), table_name='user_sessions', schema='general')
    op.drop_index('idx_user_sessions_jwt_hash', table_name='user_sessions', schema='general')
    op.drop_table('user_sessions', schema='general')
    op.drop_index(op.f('ix_general_user_preferences_user_id'), table_name='user_preferences', schema='general')
    op.drop_table('user_preferences', schema='general')
    op.drop_index(op.f('ix_general_user_invitations_invited_user_id'), table_name='user_invitations', schema='general')
    op.drop_index(op.f('ix_general_user_invitations_invited_user_email'), table_name='user_invitations', schema='general')
    op.drop_table('user_invitations', schema='general')
    op.drop_index(op.f('ix_general_users_tenant_id'), table_name='users', schema='general')
    op.drop_index(op.f('ix_general_users_status'), table_name='users', schema='general')
    op.drop_index(op.f('ix_general_users_last_login_at'), table_name='users', schema='general')
    op.drop_index(op.f('ix_general_users_is_team_admin'), table_name='users', schema='general')
    op.drop_index(op.f('ix_general_users_is_active'), table_name='users', schema='general')
    op.drop_index(op.f('ix_general_users_entra_id'), table_name='users', schema='general')
    op.drop_index(op.f('ix_general_users_account_id'), table_name='users', schema='general')
    op.drop_index('idx_users_last_login', table_name='users', schema='general')
    op.drop_table('users', schema='general')
    op.drop_index(op.f('ix_general_payment_methods_last_used_at'), table_name='payment_methods', schema='general')
    op.drop_index(op.f('ix_general_payment_methods_is_expired'), table_name='payment_methods', schema='general')
    op.drop_index(op.f('ix_general_payment_methods_is_default'), table_name='payment_methods', schema='general')
    op.drop_index(op.f('ix_general_payment_methods_is_active'), table_name='payment_methods', schema='general')
    op.drop_index(op.f('ix_general_payment_methods_account_id'), table_name='payment_methods', schema='general')
    op.drop_index('idx_payment_methods_is_expired', table_name='payment_methods', schema='general')
    op.drop_table('payment_methods', schema='general')
    op.drop_index(op.f('ix_general_packages_package'), table_name='packages', schema='general')
    op.drop_index(op.f('ix_general_packages_is_active'), table_name='packages', schema='general')
    op.drop_index(op.f('ix_general_packages_begin_date'), table_name='packages', schema='general')
    op.drop_index(op.f('ix_general_packages_account_id'), table_name='packages', schema='general')
    op.drop_table('packages', schema='general')
    op.drop_index(op.f('ix_general_invoices_payment_status'), table_name='invoices', schema='general')
    op.drop_index(op.f('ix_general_invoices_payment_date'), table_name='invoices', schema='general')
    op.drop_index(op.f('ix_general_invoices_payment_confirmation_no'), table_name='invoices', schema='general')
    op.drop_index(op.f('ix_general_invoices_invoice_number'), table_name='invoices', schema='general')
    op.drop_index(op.f('ix_general_invoices_due_date'), table_name='invoices', schema='general')
    op.drop_index(op.f('ix_general_invoices_date_to'), table_name='invoices', schema='general')
    op.drop_index(op.f('ix_general_invoices_date_from'), table_name='invoices', schema='general')
    op.drop_index(op.f('ix_general_invoices_account_id'), table_name='invoices', schema='general')
    op.drop_index('idx_invoices_period', table_name='invoices', schema='general')
    op.drop_table('invoices', schema='general')
    op.drop_index(op.f('ix_general_account_data_connections_account_id'), table_name='account_data_connections', schema='general')
    op.drop_table('account_data_connections', schema='general')
    op.drop_index(op.f('ix_general_accounts_is_team'), table_name='accounts', schema='general')
    op.drop_index('idx_accounts_created_at', table_name='accounts', schema='general')
    op.drop_table('accounts', schema='general')
    # ### end Alembic commands ###
