Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
更新数据库字段信息
  • Loading branch information
4linuxfun committed Oct 31, 2022
commit f4d9d85e1ebf66c373f93d511c4934dab502f392
53 changes: 53 additions & 0 deletions server/alembic/versions/334040db4d77_delete_sysapi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
"""delete sysapi

Revision ID: 334040db4d77
Revises: a21539d7fbb7
Create Date: 2022-10-28 15:00:57.698249

"""
from alembic import op
import sqlalchemy as sa
import sqlmodel
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '334040db4d77'
down_revision = 'a21539d7fbb7'
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('menu_apis')
op.drop_table('sys_api')
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('menu_apis',
sa.Column('menu_id', mysql.INTEGER(), autoincrement=False, nullable=False),
sa.Column('api_id', mysql.INTEGER(), autoincrement=False, nullable=False),
sa.ForeignKeyConstraint(['api_id'], ['sys_api.id'], name='menu_apis_ibfk_2'),
sa.ForeignKeyConstraint(['menu_id'], ['menu.id'], name='menu_apis_ibfk_1'),
sa.PrimaryKeyConstraint('menu_id', 'api_id'),
mysql_collate='utf8mb4_general_ci',
mysql_default_charset='utf8mb4',
mysql_engine='InnoDB',
mysql_row_format='DYNAMIC'
)
op.create_table('sys_api',
sa.Column('id', mysql.INTEGER(), autoincrement=True, nullable=False),
sa.Column('tags', mysql.VARCHAR(collation='utf8mb4_general_ci', length=10), nullable=False, comment='标签'),
sa.Column('path', mysql.VARCHAR(collation='utf8mb4_general_ci', length=50), nullable=False, comment='API路径'),
sa.Column('method', mysql.VARCHAR(collation='utf8mb4_general_ci', length=10), nullable=False, comment='HTTP方法'),
sa.Column('summary', mysql.VARCHAR(collation='utf8mb4_general_ci', length=20), nullable=False, comment='描述'),
sa.Column('deprecated', mysql.TINYINT(display_width=1), server_default=sa.text("'0'"), autoincrement=False, nullable=True, comment='是否废弃'),
sa.PrimaryKeyConstraint('id'),
mysql_collate='utf8mb4_general_ci',
mysql_default_charset='utf8mb4',
mysql_engine='InnoDB',
mysql_row_format='DYNAMIC'
)
# ### end Alembic commands ###
35 changes: 35 additions & 0 deletions server/alembic/versions/a21539d7fbb7_init.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""init

Revision ID: a21539d7fbb7
Revises:
Create Date: 2022-10-28 10:38:17.100830

"""
from alembic import op
import sqlalchemy as sa
import sqlmodel
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = 'a21539d7fbb7'
down_revision = None
branch_labels = None
depends_on = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('user_roles',
sa.Column('user_id', sa.Integer(), nullable=False),
sa.Column('role_id', sa.Integer(), nullable=False),
sa.ForeignKeyConstraint(['role_id'], ['roles.id'], ),
sa.ForeignKeyConstraint(['user_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('user_id', 'role_id')
)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('user_roles')
# ### end Alembic commands ###
222 changes: 0 additions & 222 deletions server/alembic/versions/cc553c35453a_init.py

This file was deleted.