This commit is contained in:
56
services/chat/alembic/versions/8cc8115aaf0e_init.py
Normal file
56
services/chat/alembic/versions/8cc8115aaf0e_init.py
Normal file
@@ -0,0 +1,56 @@
|
||||
"""init
|
||||
|
||||
Revision ID: 8cc8115aaf0e
|
||||
Revises:
|
||||
Create Date: 2025-08-08 11:20:07.718286+00:00
|
||||
"""
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '8cc8115aaf0e'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('chat_messages',
|
||||
sa.Column('id', sa.UUID(), nullable=False),
|
||||
sa.Column('room_id', sa.UUID(), nullable=False),
|
||||
sa.Column('sender_id', sa.UUID(), nullable=False),
|
||||
sa.Column('content', sa.Text(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_chat_messages_room_id'), 'chat_messages', ['room_id'], unique=False)
|
||||
op.create_index(op.f('ix_chat_messages_sender_id'), 'chat_messages', ['sender_id'], unique=False)
|
||||
op.create_table('chat_participants',
|
||||
sa.Column('id', sa.UUID(), nullable=False),
|
||||
sa.Column('room_id', sa.UUID(), nullable=False),
|
||||
sa.Column('user_id', sa.UUID(), nullable=False),
|
||||
sa.Column('is_admin', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_chat_participants_room_id'), 'chat_participants', ['room_id'], unique=False)
|
||||
op.create_index(op.f('ix_chat_participants_user_id'), 'chat_participants', ['user_id'], unique=False)
|
||||
op.create_table('chat_rooms',
|
||||
sa.Column('id', sa.UUID(), nullable=False),
|
||||
sa.Column('title', sa.String(length=255), nullable=True),
|
||||
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('chat_rooms')
|
||||
op.drop_index(op.f('ix_chat_participants_user_id'), table_name='chat_participants')
|
||||
op.drop_index(op.f('ix_chat_participants_room_id'), table_name='chat_participants')
|
||||
op.drop_table('chat_participants')
|
||||
op.drop_index(op.f('ix_chat_messages_sender_id'), table_name='chat_messages')
|
||||
op.drop_index(op.f('ix_chat_messages_room_id'), table_name='chat_messages')
|
||||
op.drop_table('chat_messages')
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user