Annotation-driven MongoDB migration runner for Spring Boot — `@MongoMigration` methods on `MigrationScript` beans execute in order at startup, with history in `{prefix}_migrations` collection. No Mongock dependency.
Annotation-driven migration runner: discover @MongoMigration methods on MigrationScript-implementing beans, execute in order, record results in a {prefix}_migrations collection so already-run migrations are skipped.
@MongoMigration annotation, MigrationScript marker interface, MongoMigrationConfig (collects beans), MongoMigrationRunner (@EventListener(ApplicationReadyEvent.class) discovers + runs + records).V{nnn}_{Desc}.java per migration, @Component implements MigrationScript, annotate method with .@MongoMigration(id, order, description)collectionExists / pre-check.runMigrations() body; filter executed IDs per tenant via TenantContextHolder.migrationId, description, executedAt, durationMs, status(SUCCESS|FAILED), error?.| Item | Rule |
|---|---|
| id | unique, immutable |
| order | numeric ascending |
| idempotency | history-based skip |
| failure | logged as FAILED, retried on next startup |
| rollback | none — write reverse migration |
| deletion | never delete a committed migration file |
See content.md for reference implementation sketch.