package com.baiyue.lastleg.dropship; import org.junit.jupiter.api.Test; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import static org.assertj.core.api.Assertions.assertThat; class DropshipSchemaContractTest { @Test void baselineAndIncrementalSqlKeepContainerAndMultiPalletIndexes() throws Exception { String baseline = Files.readString( Path.of("src", "main", "resources", "db", "lastleg.sql"), StandardCharsets.UTF_8).toLowerCase(); String migration = Files.readString( Path.of("..", "scripts", "db", "incremental.sql"), StandardCharsets.UTF_8).toLowerCase(); assertThat(baseline).contains( "key idx_ll_order_container(customer_id,container_no)", "unique key uk_ll_dropship_profile_order_pallet(customer_id,order_id,source_pallet_no)", "unique key uk_ll_dropship_sku_inventory(profile_id,sku_code)", "key idx_ll_dropship_profile_order(customer_id,order_id)", "warehouse_pallet_id bigint null comment '仓库实物托盘id'", "pallet_no varchar(128) null comment '托盘号'", "status varchar(32) not null default 'pending_inbound'"); assertThat(migration).contains( "add key idx_ll_order_container (customer_id,container_no)", "add unique key uk_ll_dropship_profile_order_pallet(customer_id,order_id,source_pallet_no)", "add unique key uk_ll_dropship_sku_profile(profile_id,sku_code)", "add key idx_ll_dropship_profile_order(customer_id,order_id)", "modify column warehouse_pallet_id bigint null", "modify column pallet_no varchar(128) null"); } }