From a1b3f51b613c45330cf940c22541191b1e88af16 Mon Sep 17 00:00:00 2001 From: ninemine <1371605831@qq.com> Date: Fri, 7 Nov 2025 00:59:06 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E4=B8=8D=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E7=9A=84=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CoreModules/database.py | 12 +----------- CoreModules/plugin_interface.py | 5 ++--- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/CoreModules/database.py b/CoreModules/database.py index 74fb081..c564760 100644 --- a/CoreModules/database.py +++ b/CoreModules/database.py @@ -124,17 +124,7 @@ class Database: def init_tables(self): """初始化数据库表""" - cursor = self.conn.cursor() - - # 用户表 - cursor.execute(""" - CREATE TABLE IF NOT EXISTS users ( - user_id INTEGER PRIMARY KEY, - username TEXT, - created_at INTEGER NOT NULL, - last_active INTEGER NOT NULL - ) - """) + pass def close(self): """关闭数据库连接""" diff --git a/CoreModules/plugin_interface.py b/CoreModules/plugin_interface.py index e1f24e0..aaad3b1 100644 --- a/CoreModules/plugin_interface.py +++ b/CoreModules/plugin_interface.py @@ -16,7 +16,6 @@ config = ProjectConfig() class DatabaseModel(BaseModel): table_name: str = Field(default="main_table") - column_names: List[str] = Field(default=[]) column_defs: Dict[str, str] = Field(default={}) class PluginInterface(ABC): @@ -47,8 +46,8 @@ class PluginInterface(ABC): db_model = self.register_db_model() if db_model: db.define_table(db_model.table_name) - for field in db_model.column_names: - db.define_column(db_model.table_name, field, db_model.column_defs[field]) + for name, field_def in db_model.column_defs.items(): + db.define_column(db_model.table_name, name, field_def) return router