mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-02 05:56:47 +08:00
54 lines
1.3 KiB
Python
54 lines
1.3 KiB
Python
"""2.1.7
|
|
|
|
Revision ID: 3891a5e722a1
|
|
Revises: 3df653756eec
|
|
Create Date: 2025-06-28 08:40:14.516836
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
from sqlalchemy.dialects import sqlite
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '3891a5e722a1'
|
|
down_revision = '3df653756eec'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
# rename AList存储
|
|
systemconfig = sa.table(
|
|
"systemconfig",
|
|
sa.column("key", sa.String()),
|
|
sa.column("value", sa.JSON()),
|
|
)
|
|
connection = op.get_bind()
|
|
key = "Storages"
|
|
row = connection.execute(
|
|
sa.select(systemconfig.c.value).where(systemconfig.c.key == key)
|
|
).first()
|
|
_storages = row[0] if row else None
|
|
if _storages:
|
|
changed = False
|
|
for storage in _storages:
|
|
if storage["type"] == "alist":
|
|
if storage.get("name") != "OpenList":
|
|
storage["name"] = "OpenList"
|
|
changed = True
|
|
break
|
|
if changed:
|
|
connection.execute(
|
|
systemconfig.update().where(systemconfig.c.key == key).values(
|
|
value=_storages
|
|
)
|
|
)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
pass
|