| | |
| | | package com.battery.business.runtime; |
| | | |
| | | import static org.junit.jupiter.api.Assertions.assertEquals; |
| | | import static org.junit.jupiter.api.Assertions.assertFalse; |
| | | import static org.junit.jupiter.api.Assertions.assertTrue; |
| | | |
| | |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.util.Set; |
| | | |
| | | import org.flywaydb.core.api.Location; |
| | | import org.flywaydb.core.internal.resolver.ChecksumCalculator; |
| | | import org.flywaydb.core.internal.resource.classpath.ClassPathResource; |
| | | import org.junit.jupiter.api.Test; |
| | | |
| | | /** Ticket03 最终数据库基线的结构契约。 */ |
| | |
| | | "t_test_console_import_record"); |
| | | |
| | | @Test |
| | | void finalBaselineKeepsTheChecksumAlreadyAppliedToDevelopmentDatabase() |
| | | { |
| | | // 已执行的基线必须保持 Flyway 校验值,新增字段只能追加迁移。 |
| | | ClassPathResource baseline = new ClassPathResource(new Location("classpath:db/migration-final"), |
| | | "db/migration-final/V2__final_business_baseline.sql", getClass().getClassLoader(), |
| | | StandardCharsets.UTF_8); |
| | | assertEquals(-1864711325, ChecksumCalculator.calculate(baseline)); |
| | | } |
| | | |
| | | @Test |
| | | void finalBaselineContainsOnlyTheAcceptedBusinessModel() |
| | | { |
| | | String sql = resource("db/migration-final/V2__final_business_baseline.sql"); |