61 lines
2.6 KiB
Python
61 lines
2.6 KiB
Python
"""merge ergo and 3m
|
|
|
|
Revision ID: 0b60fdc8c114
|
|
Revises: aa17ed273170
|
|
Create Date: 2024-12-28 00:52:00.841444
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import mysql
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = '0b60fdc8c114'
|
|
down_revision: Union[str, None] = 'aa17ed273170'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('account_messages',
|
|
sa.Column('history_id', mysql.BIGINT(display_width=20, unsigned=True), nullable=False),
|
|
sa.Column('account', sa.VARBINARY(length=64), nullable=False),
|
|
sa.PrimaryKeyConstraint('history_id')
|
|
)
|
|
op.create_index('account', 'account_messages', ['account', 'history_id'], unique=False)
|
|
op.create_table('forget',
|
|
sa.Column('id', mysql.BIGINT(display_width=20, unsigned=True), nullable=False),
|
|
sa.Column('account', sa.VARBINARY(length=64), nullable=False),
|
|
sa.PrimaryKeyConstraint('id')
|
|
)
|
|
op.create_table('history',
|
|
sa.Column('msgid', mysql.BIGINT(display_width=20, unsigned=True), nullable=False),
|
|
sa.Column('data', sa.LargeBinary(), nullable=False),
|
|
sa.Column('target', sa.VARBINARY(length=64), nullable=False),
|
|
sa.Column('sender', sa.VARBINARY(length=64), nullable=False),
|
|
sa.Column('nanotime', mysql.BIGINT(display_width=20), nullable=False),
|
|
sa.Column('pm', mysql.TINYINT(display_width=1),
|
|
sa.Computed("(substr(`target`,1,1) <> '#')", persisted=True), nullable=True),
|
|
sa.PrimaryKeyConstraint('msgid')
|
|
)
|
|
op.create_index('msgid', 'history', ['msgid'], unique=False)
|
|
op.create_table('metadata',
|
|
sa.Column('key_name', sa.String(length=32), nullable=False),
|
|
sa.Column('value', sa.String(length=32), nullable=False),
|
|
sa.PrimaryKeyConstraint('key_name')
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_table('metadata')
|
|
op.drop_index('msgid', table_name='history')
|
|
op.drop_table('history')
|
|
op.drop_table('forget')
|
|
op.drop_index('account', table_name='account_messages')
|
|
op.drop_table('account_messages')
|
|
# ### end Alembic commands ###
|