mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2025-06-06 20:06:12 +08:00
* ⬆️ auto update by pre-commit hooks updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.292 → v0.1.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.292...v0.1.9) - [github.com/pycqa/isort: 5.12.0 → 5.13.2](https://github.com/pycqa/isort/compare/5.12.0...5.13.2) - [github.com/psf/black: 23.9.1 → 23.12.1](https://github.com/psf/black/compare/23.9.1...23.12.1) - [github.com/pre-commit/mirrors-prettier: v3.0.3 → v4.0.0-alpha.8](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.3...v4.0.0-alpha.8) - [github.com/pre-commit/mirrors-eslint: v8.50.0 → v9.0.0-alpha.0](https://github.com/pre-commit/mirrors-eslint/compare/v8.50.0...v9.0.0-alpha.0) * 💄 auto fix by pre-commit hooks --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
35 lines
803 B
Python
35 lines
803 B
Python
"""remove_old_target
|
|
|
|
Revision ID: f9baef347cc8
|
|
Revises: 8d3863e9d74b
|
|
Create Date: 2023-08-25 00:20:51.511329
|
|
|
|
"""
|
|
|
|
import sqlalchemy as sa
|
|
from alembic import op
|
|
from sqlalchemy.orm import Session
|
|
from sqlalchemy.ext.automap import automap_base
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "f9baef347cc8"
|
|
down_revision = "8d3863e9d74b"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
Base = automap_base()
|
|
Base.prepare(op.get_bind())
|
|
User = Base.classes.nonebot_bison_user
|
|
with Session(op.get_bind()) as sess:
|
|
users = sess.scalars(sa.select(User)).all()
|
|
for user in users:
|
|
if user.user_target["platform_type"] == "Unknow Onebot 12 Platform":
|
|
sess.delete(user)
|
|
sess.commit()
|
|
|
|
|
|
def downgrade() -> None:
|
|
pass
|