From c5891a79f4566596a8e94a080ef5695dc575553d Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sun, 16 Aug 2026 19:19:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B9=82=E7=AD=89=E5=BB=BA=E8=A1=A8?= =?UTF-8?q?=E8=B7=B3=E8=BF=87=E7=B4=A2=E5=BC=95=E8=AF=AD=E5=8F=A5(?= =?UTF-8?q?=E9=81=BF=E5=85=8DDuplicate=20key=20name)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/create_tables.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/create_tables.py b/scripts/create_tables.py index 8f60728..85f5a44 100644 --- a/scripts/create_tables.py +++ b/scripts/create_tables.py @@ -90,6 +90,9 @@ async def main(): s = re.sub(r'(?i)CREATE\s+TABLE\s+(`?\w+`?)', r'CREATE TABLE IF NOT EXISTS \1', s) if not s.strip(): continue + # 跳过索引/约束语句(表已存在时索引也已存在,重复建会 Duplicate key name) + if re.match(r'(?i)\s*(CREATE\s+(UNIQUE\s+)?INDEX|ALTER\s+TABLE)', s): + continue await sor.execute(s, {}) n += 1 print(f' tables: {mod} ensured ({n} statements, idempotent)')