From 25aafd57c8b18300484dfefe9358372b946ef545 Mon Sep 17 00:00:00 2001 From: wangfq Date: Thu, 11 Jun 2026 09:00:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20V2.3.0=20role=20COMMENT=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=20manager=20=E8=A7=92=E8=89=B2=EF=BC=8CDDL=20+=20ALTE?= =?UTF-8?q?R=20TABLE=20=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/models.py b/src/models.py index 9fdacae..4e0e7aa 100644 --- a/src/models.py +++ b/src/models.py @@ -152,7 +152,7 @@ async def _create_tables(pool: aiomysql.Pool): `id` INT AUTO_INCREMENT PRIMARY KEY, `username` VARCHAR(45) UNIQUE NOT NULL, `password_hash` VARCHAR(256) NOT NULL, - `role` VARCHAR(20) DEFAULT 'operator' COMMENT 'admin/operator', + `role` VARCHAR(20) DEFAULT 'operator' COMMENT 'admin/manager/operator', `is_active` TINYINT DEFAULT 1, `create_time` DATETIME DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 @@ -344,6 +344,15 @@ async def _create_tables(pool: aiomysql.Pool): except Exception: pass + # V2.3.0 迁移:tb_user 角色增加 manager + try: + await cur.execute( + "ALTER TABLE tb_user MODIFY COLUMN `role` VARCHAR(20) DEFAULT 'operator' " + "COMMENT 'admin/manager/operator'" + ) + except Exception: + pass + logger.info("数据库表初始化完成")