"""add chat_message table

Revision ID: 850c47d647ba
Revises: c41b790058ad
Create Date: 2023-08-27 13:34:34.601539+00:00

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '850c47d647ba'
down_revision = 'c41b790058ad'
branch_labels = None
depends_on = None


def upgrade():
	# ### commands auto generated by Alembic - please adjust! ###
    op.create_table('chat_message',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('author_id', sa.Integer(), nullable=False),
    sa.Column('quote_id', sa.Integer(), nullable=True),
    sa.Column('text', sa.String(), nullable=False),
    sa.Column('text_html', sa.String(), nullable=False),
    sa.Column('created_datetimez', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
    sa.ForeignKeyConstraint(['author_id'], ['users.id'], ),
    sa.ForeignKeyConstraint(['quote_id'], ['chat_message.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index('created_datetimez_index', 'chat_message', ['created_datetimez'], unique=False)
    # ### end Alembic commands ###


def downgrade():
	# ### commands auto generated by Alembic - please adjust! ###
    op.drop_index('created_datetimez_index', table_name='chat_message')
    op.drop_table('chat_message')
    # ### end Alembic commands ###
