fix: make ERP exception menu SQL Server 2016 safe

This commit is contained in:
zgw
2026-09-15 17:38:35 +08:00
parent 67251a7562
commit 2632a57d73
2 changed files with 33 additions and 11 deletions

View File

@@ -31,6 +31,23 @@ class ShadowV3OperationsPackageTest {
.isRegularFile();
}
@Test
void erpPushExceptionMenuUsesIdentityGeneratedKeys() throws IOException {
String script = text("sql/upgrade-erp-push-exception-menu.sql");
assertThat(script).contains("SCOPE_IDENTITY()");
assertThat(script).doesNotContain("MAX(menu_id)", "(menu_id, menu_name");
}
@Test
void erpPushExceptionMenuIsAsciiSafeForSqlcmd13() throws IOException {
byte[] script = Files.readAllBytes(root.resolve("sql/upgrade-erp-push-exception-menu.sql"));
for (byte value : script) {
assertThat(value & 0x80).as("SQL script byte must be ASCII").isZero();
}
}
@Test
void preflightIsReadOnlyAndChecksExactSourceAndSingleProcess() throws IOException {
String script = text("scripts/shadow-v3-preflight.cmd");