@Target(value=METHOD)
@Retention(value=RUNTIME)
public @interface Apply
The method can accept dependency-injected parameters from the Flamingock context, including database connections, repositories, and custom dependencies.
Example usage:
@Change(id = "add-user-email-index", order = "2024-11-15-002", author = "team@example.com")
public class AddUserEmailIndex {
@Apply
public void addIndex(MongoDatabase database) {
database.getCollection("users")
.createIndex(Indexes.ascending("email"));
}
@Rollback
public void removeIndex(MongoDatabase database) {
database.getCollection("users")
.dropIndex("email_1");
}
}