This commit is contained in:
2026-08-19 14:14:04 +08:00
@@ -31,6 +31,22 @@ class FeeItemMigrationSqlContractTest {
.doesNotContain("OR EXISTS (SELECT trade_scope, fee_type_name FROM tmp_fee_item_seed");
}
@Test
void inboundFeeSourceIndexUsesTheFinalVersionedDefinition() throws Exception {
assertFinalSourceIndex(resolve("deploy/sql/头程数据库统一增量-MySQL8.sql"));
assertFinalSourceIndex(resolve(
"firstleg/src/main/resources/db/phase2-published-freight-detail-migration.sql"));
}
private static void assertFinalSourceIndex(Path path) throws Exception {
String sql = Files.readString(path, StandardCharsets.UTF_8);
assertThat(sql)
.contains("UNIQUE KEY `uk_inbound_fee_source` "
+ "(`tenant_id`, `source_type`, `source_fee_id`, `source_fee_version`)")
.doesNotContain("inbound_fee_source_index_ddl")
.doesNotContain("DROP INDEX uk_inbound_fee_source");
}
private static Path resolve(String value) {
Path direct = Path.of(value);
if (Files.exists(direct)) return direct;