From eae534af2ede4eb7c2805874b8c7f8db7e3ad0b3 Mon Sep 17 00:00:00 2001 From: guopengfa Date: Sat, 17 Jan 2026 19:35:19 +0800 Subject: [PATCH] =?UTF-8?q?make=20manual=20positions=20can=20add=20same=20?= =?UTF-8?q?stock=20and=20symbal=20to=20difference=20group=20(=E4=BD=BF?= =?UTF-8?q?=E8=B5=84=E9=87=91=E7=9B=91=E6=8E=A7=E5=8F=AF=E4=BB=A5=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=9B=B8=E5=90=8C=E8=82=A1=E7=A5=A8=E5=88=B0=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E5=88=86=E7=BB=84)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend_api_python/app/routes/portfolio.py | 2 +- backend_api_python/migrations/init.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend_api_python/app/routes/portfolio.py b/backend_api_python/app/routes/portfolio.py index d21e3bf..210dd2b 100644 --- a/backend_api_python/app/routes/portfolio.py +++ b/backend_api_python/app/routes/portfolio.py @@ -255,7 +255,7 @@ def add_position(): INSERT INTO qd_manual_positions (user_id, market, symbol, name, side, quantity, entry_price, entry_time, notes, tags, group_name, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW(), NOW()) - ON CONFLICT(user_id, market, symbol, side) DO UPDATE SET + ON CONFLICT(user_id, market, symbol, side, group_name) DO UPDATE SET name = excluded.name, quantity = excluded.quantity, entry_price = excluded.entry_price, diff --git a/backend_api_python/migrations/init.sql b/backend_api_python/migrations/init.sql index 10bd86d..9ad6771 100644 --- a/backend_api_python/migrations/init.sql +++ b/backend_api_python/migrations/init.sql @@ -438,7 +438,7 @@ CREATE TABLE IF NOT EXISTS qd_manual_positions ( group_name VARCHAR(100) DEFAULT '', created_at TIMESTAMP DEFAULT NOW(), updated_at TIMESTAMP DEFAULT NOW(), - UNIQUE(user_id, market, symbol, side) + UNIQUE(user_id, market, symbol, side, group_name) ); CREATE INDEX IF NOT EXISTS idx_manual_positions_user_id ON qd_manual_positions(user_id);