feat(person): add nullable generation column to persons (#689)

Flyway V70: SMALLINT generation column with CHECK(0..10) and partial
index over non-null rows. Person.generation field surfaces it through
the JPA model. Pre-import rows and persons outside the curated family
graph legitimately stay null; the canonical importer (next commits)
back-fills via preferHuman so a human-edited value is never lost.

Refs #689

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-05-28 15:20:24 +02:00
parent 1cb05697cc
commit f22508ca91
3 changed files with 66 additions and 0 deletions

View File

@@ -672,4 +672,39 @@ class PersonRepositoryTest {
assertThat(slice.get(0).getDocumentCount()).isEqualTo(1);
}
// ─── generation column (#689) ──────────────────────────────────────────────
@Test
void save_persistsGeneration_andFindByIdReturnsSameGeneration() {
Person person = Person.builder()
.firstName("Walter")
.lastName("Raddatz")
.generation(3)
.build();
Person saved = personRepository.save(person);
entityManager.flush();
entityManager.clear();
Optional<Person> found = personRepository.findById(saved.getId());
assertThat(found).isPresent();
assertThat(found.get().getGeneration()).isEqualTo(3);
}
@Test
void save_allowsNullGeneration_existingRowsRemainNull() {
Person person = Person.builder()
.firstName("Anonym")
.lastName("Person")
.build();
Person saved = personRepository.save(person);
entityManager.flush();
entityManager.clear();
Optional<Person> found = personRepository.findById(saved.getId());
assertThat(found).isPresent();
assertThat(found.get().getGeneration()).isNull();
}
}