mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-05-09 18:27:56 +08:00
🚧 remove User type
This commit is contained in:
@@ -18,6 +18,7 @@ depends_on = None
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table("nonebot_bison_user", schema=None) as batch_op:
|
||||
batch_op.drop_constraint("unique-user-constraint", type_="unique")
|
||||
batch_op.add_column(sa.Column("user_target", sa.JSON(), nullable=True))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
@@ -27,5 +28,6 @@ def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table("nonebot_bison_user", schema=None) as batch_op:
|
||||
batch_op.drop_column("user_target")
|
||||
batch_op.create_unique_constraint("unique-user-constraint", ["type", "uid"])
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
"""make user_target not nullable
|
||||
|
||||
Revision ID: 67c38b3f39c2
|
||||
Revises: a5466912fad0
|
||||
Create Date: 2023-03-20 11:08:42.883556
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
from sqlalchemy.dialects import sqlite
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "67c38b3f39c2"
|
||||
down_revision = "a5466912fad0"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table("nonebot_bison_user", schema=None) as batch_op:
|
||||
batch_op.alter_column(
|
||||
"user_target", existing_type=sqlite.JSON(), nullable=False
|
||||
)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table("nonebot_bison_user", schema=None) as batch_op:
|
||||
batch_op.alter_column("user_target", existing_type=sqlite.JSON(), nullable=True)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
@@ -0,0 +1,33 @@
|
||||
"""remove uid and type
|
||||
|
||||
Revision ID: 8d3863e9d74b
|
||||
Revises: 67c38b3f39c2
|
||||
Create Date: 2023-03-20 15:38:20.220599
|
||||
|
||||
"""
|
||||
import sqlalchemy as sa
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = "8d3863e9d74b"
|
||||
down_revision = "67c38b3f39c2"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table("nonebot_bison_user", schema=None) as batch_op:
|
||||
batch_op.drop_column("uid")
|
||||
batch_op.drop_column("type")
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table("nonebot_bison_user", schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column("type", sa.VARCHAR(length=20), nullable=False))
|
||||
batch_op.add_column(sa.Column("uid", sa.INTEGER(), nullable=False))
|
||||
|
||||
# ### end Alembic commands ###
|
||||
Reference in New Issue
Block a user