51 lines
1.8 KiB
Python
51 lines
1.8 KiB
Python
"""empty message
|
|
|
|
Revision ID: 0df253550689
|
|
Revises: 1a574337293a
|
|
Create Date: 2023-04-22 10:33:01.833957
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import mysql
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '0df253550689'
|
|
down_revision = '1a574337293a'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('private_messages',
|
|
sa.Column('id', sa.Integer(), nullable=False),
|
|
sa.Column('sender_id', sa.Integer(), nullable=True),
|
|
sa.Column('recipient_id', sa.Integer(), nullable=True),
|
|
sa.Column('body', sa.Text(), nullable=True),
|
|
sa.Column('time', sa.DateTime(), nullable=True),
|
|
sa.ForeignKeyConstraint(['recipient_id'], ['users.id'], ),
|
|
sa.ForeignKeyConstraint(['sender_id'], ['users.id'], ),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.drop_table('messages')
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('messages',
|
|
sa.Column('id', mysql.INTEGER(display_width=11), autoincrement=True, nullable=False),
|
|
sa.Column('sender_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
|
|
sa.Column('recipient_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
|
|
sa.Column('body', mysql.TEXT(), nullable=True),
|
|
sa.Column('time', mysql.DATETIME(), nullable=True),
|
|
sa.ForeignKeyConstraint(['recipient_id'], ['users.id'], name='messages_ibfk_1'),
|
|
sa.ForeignKeyConstraint(['sender_id'], ['users.id'], name='messages_ibfk_2'),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
mysql_default_charset='utf8',
|
|
mysql_engine='InnoDB'
|
|
)
|
|
op.drop_table('private_messages')
|
|
# ### end Alembic commands ###
|