From 74c45681579ebcb008e1a139c47b41e1180db6aa Mon Sep 17 00:00:00 2001 From: yumoqing Date: Mon, 24 Aug 2026 16:40:50 +0800 Subject: [PATCH] =?UTF-8?q?feat(db):=20=E6=96=B0=E5=A2=9E=20pipeline=5Fses?= =?UTF-8?q?sion=5Fsettings=20=E4=BC=9A=E8=AF=9D=E7=BA=A7=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 多tab独立会话的项目上下文按 (user_id, session_id) 存储,UNIQUE(user_id,session_id) --- scripts/create_tables.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/create_tables.py b/scripts/create_tables.py index df09aaf..078f452 100644 --- a/scripts/create_tables.py +++ b/scripts/create_tables.py @@ -120,6 +120,20 @@ CREATE TABLE IF NOT EXISTS sd_work_envs ( UNIQUE KEY `uk_owner` (`owner_type`,`owner_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; """, +""" +CREATE TABLE IF NOT EXISTS pipeline_session_settings ( + `id` varchar(32) NOT NULL, + `session_id` varchar(64) NOT NULL, + `user_id` varchar(32) NOT NULL, + `current_project_id` varchar(32) NOT NULL DEFAULT '', + `current_iteration_id` varchar(32) NOT NULL DEFAULT '', + `created_at` datetime NOT NULL DEFAULT current_timestamp(), + `updated_at` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + PRIMARY KEY (`id`), + UNIQUE KEY `uk_user_session` (`user_id`,`session_id`), + KEY `idx_session` (`session_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +""", ] # v2 引擎列迁移(原 init.py::_init_v2_tables 启动时 ALTER 迁移,现迁到部署期,information_schema 幂等)