// Path: cassandra-migration/src/main/java/org/cognitor/cassandra/migration/util/Ensure.java
// public static <T> T notNull(T argument, String argumentName) {
//     if (argument == null) {
//         throw new IllegalArgumentException("Argument " + argumentName + " must not be null.");
//     }
//     return argument;
// }


import org.slf4j.Logger;
import java.util.List;
import static java.lang.String.format;
import static org.cognitor.cassandra.migration.util.Ensure.notNull;
import static org.slf4j.LoggerFactory.getLogger;
package org.cognitor.cassandra.migration;




/**
 * The migration task is managing the database migrations. It checks which
 * schema version is in the database and retrieves the migrations that
 * need to be applied from the repository. Those migrations are than
 * executed against the database.
 *
 * @author Patrick Kranz
 */
public class MigrationTask {
    private static final Logger LOGGER = getLogger(MigrationTask.class);

    private final Database database;
    private final MigrationRepository repository;
    private final boolean withConsensus;

    /**
     * Creates a migration task that uses the given database and repository and no consensus
     * protocol enabled.
     *
     * @param database   the database that should be migrated
     * @param repository the repository that contains the migration scripts
     */
    public MigrationTask(Database database, MigrationRepository repository) {
        this(database, repository, false);
    }

    /**
     * Creates a migration task that uses the given database and repository.
     *
     * @param database      the database that should be migrated
     * @param repository    the repository that contains the migration scripts
     * @param withConsensus if the migration should be handled by a single process at once, using LWT based leader election
     */
    public MigrationTask(Database database, MigrationRepository repository, boolean withConsensus) {
// Path: cassandra-migration/src/main/java/org/cognitor/cassandra/migration/util/Ensure.java
// public static <T> T notNull(T argument, String argumentName) {
//     if (argument == null) {
//         throw new IllegalArgumentException("Argument " + argumentName + " must not be null.");
//     }
//     return argument;
// }


// Path: cassandra-migration/src/main/java/org/cognitor/cassandra/migration/MigrationTask.java
import org.slf4j.Logger;
import java.util.List;
import static java.lang.String.format;
import static org.cognitor.cassandra.migration.util.Ensure.notNull;
import static org.slf4j.LoggerFactory.getLogger;

package org.cognitor.cassandra.migration;




/**
 * The migration task is managing the database migrations. It checks which
 * schema version is in the database and retrieves the migrations that
 * need to be applied from the repository. Those migrations are than
 * executed against the database.
 *
 * @author Patrick Kranz
 */
public class MigrationTask {
    private static final Logger LOGGER = getLogger(MigrationTask.class);

    private final Database database;
    private final MigrationRepository repository;
    private final boolean withConsensus;

    /**
     * Creates a migration task that uses the given database and repository and no consensus
     * protocol enabled.
     *
     * @param database   the database that should be migrated
     * @param repository the repository that contains the migration scripts
     */
    public MigrationTask(Database database, MigrationRepository repository) {
        this(database, repository, false);
    }

    /**
     * Creates a migration task that uses the given database and repository.
     *
     * @param database      the database that should be migrated
     * @param repository    the repository that contains the migration scripts
     * @param withConsensus if the migration should be handled by a single process at once, using LWT based leader election
     */
    public MigrationTask(Database database, MigrationRepository repository, boolean withConsensus) {
        this.database = notNull(database, "database");