From 34e5b18a30453f08ae30e79b2d3ee7e8027f1edc Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 22 Jul 2026 17:43:48 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20=E4=BF=AE=E5=A4=8DCI=20rerun?= =?UTF-8?q?=E6=97=B6=E6=95=B0=E6=8D=AE=E5=BA=93=E5=91=BD=E5=90=8D=E5=86=B2?= =?UTF-8?q?=E7=AA=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在CREATE DATABASE前先执行DROP DATABASE IF EXISTS WITH (FORCE), 防止rerun同一run_id时因数据库已存在而失败。 影响:validate_migration.sh / run_integration_tests.sh / run_validate.sh --- scripts/ci/run_integration_tests.sh | 1 + scripts/ci/run_validate.sh | 1 + scripts/ci/validate_migration.sh | 1 + 3 files changed, 3 insertions(+) diff --git a/scripts/ci/run_integration_tests.sh b/scripts/ci/run_integration_tests.sh index 9f7975478..1fca1158f 100755 --- a/scripts/ci/run_integration_tests.sh +++ b/scripts/ci/run_integration_tests.sh @@ -196,6 +196,7 @@ import psycopg2 conn = psycopg2.connect(host='$SHARED_PG_HOST', port=$SHARED_PG_PORT, user='$SHARED_PG_USER', password='$SHARED_PG_PASSWORD', dbname='postgres') conn.autocommit = True cur = conn.cursor() +cur.execute(f'DROP DATABASE IF EXISTS \"$CI_DB_NAME\" WITH (FORCE)') cur.execute(f'CREATE DATABASE \"$CI_DB_NAME\"') cur.close() conn.close() diff --git a/scripts/ci/run_validate.sh b/scripts/ci/run_validate.sh index da70cf245..050a82b94 100755 --- a/scripts/ci/run_validate.sh +++ b/scripts/ci/run_validate.sh @@ -408,6 +408,7 @@ import psycopg2 conn = psycopg2.connect(host='$SHARED_PG_HOST', port=$SHARED_PG_PORT, user='$SHARED_PG_USER', password='$SHARED_PG_PASSWORD', dbname='postgres') conn.autocommit = True cur = conn.cursor() +cur.execute(f'DROP DATABASE IF EXISTS \"$CI_DB_NAME\" WITH (FORCE)') cur.execute(f'CREATE DATABASE \"$CI_DB_NAME\"') cur.close() conn.close() diff --git a/scripts/ci/validate_migration.sh b/scripts/ci/validate_migration.sh index 998dc1651..48243dd3d 100644 --- a/scripts/ci/validate_migration.sh +++ b/scripts/ci/validate_migration.sh @@ -112,6 +112,7 @@ import psycopg2 conn = psycopg2.connect(host='$SHARED_PG_HOST', port=$SHARED_PG_PORT, user='$SHARED_PG_USER', password='$SHARED_PG_PASSWORD', dbname='postgres') conn.autocommit = True cur = conn.cursor() +cur.execute(f'DROP DATABASE IF EXISTS \"$CI_DB_NAME\" WITH (FORCE)') cur.execute(f'CREATE DATABASE \"$CI_DB_NAME\"') cur.close() conn.close()