fix: support deployed outbound detail schema
This commit is contained in:
@@ -1065,7 +1065,7 @@ BEGIN
|
|||||||
warehouse.project_no AS [@project_no],
|
warehouse.project_no AS [@project_no],
|
||||||
outbound.product_id AS [@product_id], outbound.lot_no AS [@lot_no],
|
outbound.product_id AS [@product_id], outbound.lot_no AS [@lot_no],
|
||||||
outbound.quantity AS [@quantity], outbound.assign_num AS [@assign_num],
|
outbound.quantity AS [@quantity], outbound.assign_num AS [@assign_num],
|
||||||
outbound.allot_quantity AS [@allot_quantity], outbound.create_time AS [@create_time]
|
outbound.allot_quantity AS [@allot_quantity]
|
||||||
FROM dbo.out_stockout_detail outbound WITH (NOLOCK)
|
FROM dbo.out_stockout_detail outbound WITH (NOLOCK)
|
||||||
JOIN dbo.out_stockout stockout WITH (NOLOCK) ON stockout.stockout_id = outbound.stockout_id
|
JOIN dbo.out_stockout stockout WITH (NOLOCK) ON stockout.stockout_id = outbound.stockout_id
|
||||||
LEFT JOIN dbo.bas_warehouse warehouse WITH (NOLOCK)
|
LEFT JOIN dbo.bas_warehouse warehouse WITH (NOLOCK)
|
||||||
@@ -1279,7 +1279,7 @@ BEGIN
|
|||||||
warehouse.project_no AS [@project_no],
|
warehouse.project_no AS [@project_no],
|
||||||
outbound.product_id AS [@product_id], outbound.lot_no AS [@lot_no],
|
outbound.product_id AS [@product_id], outbound.lot_no AS [@lot_no],
|
||||||
outbound.quantity AS [@quantity], outbound.assign_num AS [@assign_num],
|
outbound.quantity AS [@quantity], outbound.assign_num AS [@assign_num],
|
||||||
outbound.allot_quantity AS [@allot_quantity], outbound.create_time AS [@create_time]
|
outbound.allot_quantity AS [@allot_quantity]
|
||||||
FROM dbo.out_stockout_detail outbound WITH (NOLOCK)
|
FROM dbo.out_stockout_detail outbound WITH (NOLOCK)
|
||||||
JOIN dbo.out_stockout stockout WITH (NOLOCK) ON stockout.stockout_id = outbound.stockout_id
|
JOIN dbo.out_stockout stockout WITH (NOLOCK) ON stockout.stockout_id = outbound.stockout_id
|
||||||
LEFT JOIN dbo.bas_warehouse warehouse WITH (NOLOCK)
|
LEFT JOIN dbo.bas_warehouse warehouse WITH (NOLOCK)
|
||||||
|
|||||||
@@ -402,7 +402,7 @@ BEGIN
|
|||||||
warehouse.project_no AS [@project_no],
|
warehouse.project_no AS [@project_no],
|
||||||
outbound.product_id AS [@product_id], outbound.lot_no AS [@lot_no],
|
outbound.product_id AS [@product_id], outbound.lot_no AS [@lot_no],
|
||||||
outbound.quantity AS [@quantity], outbound.assign_num AS [@assign_num],
|
outbound.quantity AS [@quantity], outbound.assign_num AS [@assign_num],
|
||||||
outbound.allot_quantity AS [@allot_quantity], outbound.create_time AS [@create_time]
|
outbound.allot_quantity AS [@allot_quantity]
|
||||||
FROM dbo.out_stockout_detail outbound WITH (NOLOCK)
|
FROM dbo.out_stockout_detail outbound WITH (NOLOCK)
|
||||||
JOIN dbo.out_stockout stockout WITH (NOLOCK) ON stockout.stockout_id = outbound.stockout_id
|
JOIN dbo.out_stockout stockout WITH (NOLOCK) ON stockout.stockout_id = outbound.stockout_id
|
||||||
LEFT JOIN dbo.bas_warehouse warehouse WITH (NOLOCK)
|
LEFT JOIN dbo.bas_warehouse warehouse WITH (NOLOCK)
|
||||||
@@ -613,7 +613,7 @@ BEGIN
|
|||||||
stockout.warehouse_id AS [@source_warehouse_id],
|
stockout.warehouse_id AS [@source_warehouse_id],
|
||||||
warehouse.project_no AS [@project_no],
|
warehouse.project_no AS [@project_no],
|
||||||
outbound.product_id AS [@product_id], outbound.lot_no AS [@lot_no], outbound.quantity AS [@quantity],
|
outbound.product_id AS [@product_id], outbound.lot_no AS [@lot_no], outbound.quantity AS [@quantity],
|
||||||
outbound.assign_num AS [@assign_num], outbound.allot_quantity AS [@allot_quantity], outbound.create_time AS [@create_time]
|
outbound.assign_num AS [@assign_num], outbound.allot_quantity AS [@allot_quantity]
|
||||||
FROM dbo.out_stockout_detail outbound WITH (NOLOCK)
|
FROM dbo.out_stockout_detail outbound WITH (NOLOCK)
|
||||||
JOIN dbo.out_stockout stockout WITH (NOLOCK) ON stockout.stockout_id = outbound.stockout_id
|
JOIN dbo.out_stockout stockout WITH (NOLOCK) ON stockout.stockout_id = outbound.stockout_id
|
||||||
LEFT JOIN dbo.bas_warehouse warehouse WITH (NOLOCK)
|
LEFT JOIN dbo.bas_warehouse warehouse WITH (NOLOCK)
|
||||||
|
|||||||
@@ -64,6 +64,16 @@ class ShadowSqlServerMigrationScriptTest {
|
|||||||
"procedure alg.usp_rebuild_lane_state",
|
"procedure alg.usp_rebuild_lane_state",
|
||||||
"procedure alg.usp_refresh_dirty_lanes");
|
"procedure alg.usp_refresh_dirty_lanes");
|
||||||
|
|
||||||
|
private static final Set<String> PRODUCTION_OUTBOUND_DETAIL_COLUMNS = Set.of(
|
||||||
|
"stockout_detail_id",
|
||||||
|
"stockout_id",
|
||||||
|
"warehouse_id",
|
||||||
|
"product_id",
|
||||||
|
"lot_no",
|
||||||
|
"quantity",
|
||||||
|
"assign_num",
|
||||||
|
"allot_quantity");
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void installCreatesOnlyAllowListedShadowObjects() throws IOException {
|
void installCreatesOnlyAllowListedShadowObjects() throws IOException {
|
||||||
String install = resource("db/sqlserver/install-shadow.sql");
|
String install = resource("db/sqlserver/install-shadow.sql");
|
||||||
@@ -246,6 +256,25 @@ class ShadowSqlServerMigrationScriptTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void refreshSupportsProductionOutboundDetailWithoutCreateTime() throws IOException {
|
||||||
|
for (String script : new String[]{"db/sqlserver/install-shadow.sql",
|
||||||
|
"db/sqlserver/upgrade-shadow-v2-to-v3.sql"}) {
|
||||||
|
String refresh = normalize(resource(script));
|
||||||
|
refresh = batchBody(refresh, "create procedure alg.usp_refresh_shadow_snapshot");
|
||||||
|
|
||||||
|
Set<String> referencedColumns = Pattern.compile("\\boutbound\\.([a-z0-9_]+)")
|
||||||
|
.matcher(refresh)
|
||||||
|
.results()
|
||||||
|
.map(match -> match.group(1))
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
|
||||||
|
assertThat(referencedColumns)
|
||||||
|
.as("%s must support the deployed out_stockout_detail schema", script)
|
||||||
|
.isSubsetOf(PRODUCTION_OUTBOUND_DETAIL_COLUMNS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void decisionReasonStoresBoundedUnicodeDiagnosticsAcrossCleanInstallAndUpgrade() throws IOException {
|
void decisionReasonStoresBoundedUnicodeDiagnosticsAcrossCleanInstallAndUpgrade() throws IOException {
|
||||||
String install = normalize(resource("db/sqlserver/install-shadow.sql"));
|
String install = normalize(resource("db/sqlserver/install-shadow.sql"));
|
||||||
|
|||||||
Reference in New Issue
Block a user