zhaoqingang
2024-12-10 08c8e8c9a4d65677de6a493446a605d70efee631
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""menu table add 
 
Revision ID: 3845dc998475
Revises: abc6bb9129ed
Create Date: 2024-12-10 14:22:03.798597
 
"""
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 = '3845dc998475'
down_revision: Union[str, None] = 'abc6bb9129ed'
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('menu_capacity',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('menu_id', sa.Integer(), nullable=True),
    sa.Column('capacity_id', sa.String(length=36), nullable=True),
    sa.Column('capacity_type', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('menu_id', 'capacity_id', name='menu_capacity_id_ix')
    )
    op.create_index(op.f('ix_menu_capacity_id'), 'menu_capacity', ['id'], unique=False)
    op.create_table('web_menu',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('title', sa.String(length=128), nullable=True),
    sa.Column('dialog', sa.String(length=1000), nullable=True),
    sa.Column('desc', sa.String(length=1000), nullable=True),
    sa.Column('icon', sa.String(length=16), nullable=True),
    sa.Column('img', sa.String(length=255), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_web_menu_id'), 'web_menu', ['id'], unique=False)
    op.drop_column('knowledgebase', 'count')
    # ### end Alembic commands ###
 
 
def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('knowledgebase', sa.Column('count', mysql.VARCHAR(length=32), nullable=True))
    op.drop_index(op.f('ix_web_menu_id'), table_name='web_menu')
    op.drop_table('web_menu')
    op.drop_index(op.f('ix_menu_capacity_id'), table_name='menu_capacity')
    op.drop_table('menu_capacity')
    # ### end Alembic commands ###