mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-06-05 15:39:40 +08:00
44 lines
1.0 KiB
Python
44 lines
1.0 KiB
Python
"""2.1.6
|
|
|
|
Revision ID: 3df653756eec
|
|
Revises: 486e56a62dcb
|
|
Create Date: 2025-06-11 19:52:57.185355
|
|
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import sqlite
|
|
|
|
from app.db import SessionFactory
|
|
from app.db.models import User
|
|
from app.core.config import settings
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = '3df653756eec'
|
|
down_revision = '486e56a62dcb'
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with SessionFactory() as db:
|
|
# 所有用户
|
|
users = User.list(db)
|
|
for user in users:
|
|
if user.name == settings.SUPERUSER:
|
|
continue
|
|
if not user.permissions:
|
|
user.permissions = {
|
|
"discovery": True,
|
|
"search": True,
|
|
"subscribe": True,
|
|
"manage": False,
|
|
}
|
|
user.update(db)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
pass
|