feat(operations): add source diagnosis workspace

This commit is contained in:
lingniu
2026-07-16 17:35:10 +08:00
parent df7d9799b3
commit 96cad7eef7
18 changed files with 881 additions and 10 deletions

View File

@@ -85,6 +85,10 @@ if test -f "$old/lingniu-vehicle-platform.service"; then
cp "$old/lingniu-vehicle-platform.service" "$next/lingniu-vehicle-platform.service"
fi
cp -a "$old/deploy" "$next/deploy"
if test -d "$SCRIPT_DIR/migrations"; then
mkdir -p "$next/deploy/migrations"
cp "$SCRIPT_DIR"/migrations/*.sql "$next/deploy/migrations/"
fi
cp "$SCRIPT_DIR/prepare-web-release-tree.sh" "$next/deploy/prepare-web-release-tree.sh"
cp "$SCRIPT_DIR/prune-release-history.py" "$next/deploy/prune-release-history.py"
cp "$SCRIPT_DIR/verify-customer-demo.py" "$next/deploy/verify-customer-demo.py"

View File

@@ -42,6 +42,7 @@ test -f "$root/current/web/assets/new.js"
test -f "$root/current/web/assets/old.js"
test -f "$root/current/web/.compatibility-manifests/1.assets"
test -x "$root/current/deploy/verify-customer-demo.py"
test -f "$root/current/deploy/migrations/015_vehicle_source_policy_audit.sql"
test ! -e "$root/current/lingniu-vehicle-platform.service"
test "$(find "$root/releases" -mindepth 1 -maxdepth 1 -type d | wc -l | tr -d ' ')" = 3
grep -q 'web_release_install=ok release=new-release previous=old-release' "$fixture/install.out"

View File

@@ -0,0 +1,28 @@
CREATE TABLE IF NOT EXISTS platform_vehicle_source_policy_version (
vin VARCHAR(32) NOT NULL PRIMARY KEY,
version INT NOT NULL DEFAULT 1,
updated_by VARCHAR(128) NOT NULL DEFAULT 'system',
updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS platform_vehicle_source_policy_audit (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
vin VARCHAR(32) NOT NULL,
version INT NOT NULL,
protocol VARCHAR(32) NOT NULL,
source_ref CHAR(64) NOT NULL,
source_key VARCHAR(256) NOT NULL,
source_label VARCHAR(160) NOT NULL,
old_enabled TINYINT(1) NOT NULL,
new_enabled TINYINT(1) NOT NULL,
old_priority INT NOT NULL,
new_priority INT NOT NULL,
old_remark VARCHAR(255) NOT NULL DEFAULT '',
new_remark VARCHAR(255) NOT NULL DEFAULT '',
actor VARCHAR(128) NOT NULL,
summary VARCHAR(500) NOT NULL,
changed_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
UNIQUE KEY uk_vehicle_source_policy_version (vin, version),
KEY idx_vehicle_source_policy_audit_time (vin, changed_at),
KEY idx_vehicle_source_policy_source_ref (source_ref)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;