"""empty message

Revision ID: 60512480e67a
Revises: 639edaccc099
Create Date: 2023-06-28 02:06:33.051473

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '60512480e67a'
down_revision = '639edaccc099'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('emails',
    sa.Column('id', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('sender_address', sa.String(length=255), nullable=False),
    sa.Column('sender_name', sa.String(length=80), nullable=True),
    sa.Column('subject', sa.String(length=80), nullable=False),
    sa.Column('recipient', sa.String(length=255), nullable=False),
    sa.Column('recipient_id', sa.Integer(), nullable=True),
    sa.Column('type', sa.String(), nullable=True),
    sa.Column('message_txt', sa.Text(), nullable=True),
    sa.Column('message_html', sa.Text(), nullable=True),
    sa.Column('sent_at', sa.DateTime(), nullable=True),
    sa.Column('error', sa.Text(), nullable=True),
    sa.ForeignKeyConstraint(['recipient_id'], ['users.id'], name=op.f('fk_emails_recipient_id_users')),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_emails'))
    )
    with op.batch_alter_table('emails', schema=None) as batch_op:
        batch_op.create_index(batch_op.f('ix_emails_recipient'), ['recipient'], unique=False)
        batch_op.create_index(batch_op.f('ix_emails_sender_address'), ['sender_address'], unique=False)
        batch_op.create_index(batch_op.f('ix_emails_sent_at'), ['sent_at'], unique=False)
        batch_op.create_index(batch_op.f('ix_emails_subject'), ['subject'], unique=False)

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('emails', schema=None) as batch_op:
        batch_op.drop_index(batch_op.f('ix_emails_subject'))
        batch_op.drop_index(batch_op.f('ix_emails_sent_at'))
        batch_op.drop_index(batch_op.f('ix_emails_sender_address'))
        batch_op.drop_index(batch_op.f('ix_emails_recipient'))

    op.drop_table('emails')
    # ### end Alembic commands ###
