"""empty message

Revision ID: 47bb57ce9f7d
Revises: 6c478d2fd92a
Create Date: 2023-08-05 08:00:57.289444

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '47bb57ce9f7d'
down_revision = '6c478d2fd92a'
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('mass_message_stats',
    sa.Column('id', sa.BigInteger(), autoincrement=False, nullable=False),
    sa.Column('media_count', sa.SmallInteger(), nullable=False),
    sa.Column('buyer_count', sa.SmallInteger(), nullable=False),
    sa.Column('sent_count', sa.Integer(), nullable=False),
    sa.Column('view_count', sa.Integer(), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    schema='fansly'
    )
    op.create_table('mass_message_stats',
    sa.Column('id', sa.BigInteger(), autoincrement=False, nullable=False),
    sa.Column('media_count', sa.SmallInteger(), nullable=False),
    sa.Column('buyer_count', sa.SmallInteger(), nullable=False),
    sa.Column('sent_count', sa.Integer(), nullable=False),
    sa.Column('view_count', sa.Integer(), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    schema='onlyfans'
    )
    op.create_table('x_mass_messages',
    sa.Column('id', sa.BigInteger(), autoincrement=False, nullable=False),
    sa.Column('user_id', sa.BigInteger(), nullable=False),
    sa.Column('statistic_id', sa.BigInteger(), nullable=True),
    sa.Column('text', sa.Text(), nullable=True),
    sa.Column('price', sa.Float(), nullable=False),
    sa.Column('expires_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('created_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.ForeignKeyConstraint(['statistic_id'], ['fansly.mass_message_stats.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['fansly.users.id'], ),
    sa.PrimaryKeyConstraint('id'),
    schema='fansly'
    )
    op.create_table('x_mass_messages',
    sa.Column('id', sa.BigInteger(), autoincrement=False, nullable=False),
    sa.Column('user_id', sa.BigInteger(), nullable=False),
    sa.Column('statistic_id', sa.BigInteger(), nullable=True),
    sa.Column('text', sa.Text(), nullable=True),
    sa.Column('price', sa.Float(), nullable=False),
    sa.Column('expires_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.Column('created_at', sa.TIMESTAMP(timezone=True), nullable=False),
    sa.ForeignKeyConstraint(['statistic_id'], ['onlyfans.mass_message_stats.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['onlyfans.users.id'], ),
    sa.PrimaryKeyConstraint('id'),
    schema='onlyfans'
    )
    op.add_column('remote_urls', sa.Column('exists', sa.Boolean(), server_default='False', nullable=False), schema='fansly')
    op.add_column('remote_urls', sa.Column('downloaded_at', sa.TIMESTAMP(timezone=True), nullable=True), schema='fansly')
    op.add_column('x_messages', sa.Column('queue_id', sa.BigInteger(), nullable=True), schema='fansly')
    op.create_foreign_key(None, 'x_messages', 'x_mass_messages', ['queue_id'], ['id'], source_schema='fansly', referent_schema='fansly')
    op.add_column('remote_urls', sa.Column('exists', sa.Boolean(), server_default='False', nullable=False), schema='onlyfans')
    op.add_column('remote_urls', sa.Column('downloaded_at', sa.TIMESTAMP(timezone=True), nullable=True), schema='onlyfans')
    op.add_column('x_messages', sa.Column('queue_id', sa.BigInteger(), nullable=True), schema='onlyfans')
    op.create_foreign_key(None, 'x_messages', 'x_mass_messages', ['queue_id'], ['id'], source_schema='onlyfans', referent_schema='onlyfans')
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'x_messages', schema='onlyfans', type_='foreignkey')
    op.drop_column('x_messages', 'queue_id', schema='onlyfans')
    op.drop_column('remote_urls', 'downloaded_at', schema='onlyfans')
    op.drop_column('remote_urls', 'exists', schema='onlyfans')
    op.drop_constraint(None, 'x_messages', schema='fansly', type_='foreignkey')
    op.drop_column('x_messages', 'queue_id', schema='fansly')
    op.drop_column('remote_urls', 'downloaded_at', schema='fansly')
    op.drop_column('remote_urls', 'exists', schema='fansly')
    op.drop_table('x_mass_messages', schema='onlyfans')
    op.drop_table('x_mass_messages', schema='fansly')
    op.drop_table('mass_message_stats', schema='onlyfans')
    op.drop_table('mass_message_stats', schema='fansly')
    # ### end Alembic commands ###
