chore(deploy): synchronize phase3 unified database migration
This commit is contained in:
@@ -19,7 +19,7 @@ class WarehouseRoleSqlContractTest {
|
||||
void unifiedDeploymentContainsTheSameWarehouseRoleContract() throws Exception {
|
||||
String sql = unifiedSql();
|
||||
assertWarehouseRoleContract(sql);
|
||||
assertThat(sql)
|
||||
assertThat(roleMigrationBlock(sql))
|
||||
.doesNotContain("\n ADD COLUMN IF NOT EXISTS")
|
||||
.doesNotContain("DROP CHECK IF EXISTS");
|
||||
assertThat(sql.lastIndexOf("SELECT 'PASS' AS migration_status"))
|
||||
@@ -97,6 +97,15 @@ class WarehouseRoleSqlContractTest {
|
||||
return sql.substring(start, end > start ? end : sql.length());
|
||||
}
|
||||
|
||||
private static String roleMigrationBlock(String sql) {
|
||||
String marker = "-- 来源:iam/src/main/resources/db/phase3-warehouse-roles.sql";
|
||||
String endMarker = "-- 二、三期对外统一使用 INBOUNDED;历史 WAIT_SPLIT 仅由查询适配为 INBOUNDED,统一迁移不改写主表或历史状态。";
|
||||
int start = sql.indexOf(marker);
|
||||
int end = sql.indexOf(endMarker, start + marker.length());
|
||||
if (start < 0 || end < 0) throw new IllegalStateException("统一入口缺少仓库角色连续区块");
|
||||
return sql.substring(start, end);
|
||||
}
|
||||
|
||||
private static String moduleSql() throws Exception {
|
||||
return new ClassPathResource("db/phase3-warehouse-roles.sql")
|
||||
.getContentAsString(StandardCharsets.UTF_8);
|
||||
|
||||
Reference in New Issue
Block a user