All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.rinoto.migramongo.dao.MigrationHistoryService Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
package com.rinoto.migramongo.dao;

import com.rinoto.migramongo.MigrationEntry;
import com.rinoto.migramongo.MigrationInfo;
import com.rinoto.migramongo.MigrationRun;

public interface MigrationHistoryService {

    /**
     * Gets the last migration that was applied, by checking the createdAt field of the entries
     * 
     * @return last mig entry
     */
    MigrationEntry getLastMigrationApplied();

    /**
     * It changes the status of an existing MigrationEntry to {@link com.rinoto.migramongo.MigraMongoStatus.MigrationStatus#OK}
     * 
     * @param migrationEntry entry to change
     * @return migEntry just changed
     */
    MigrationEntry setMigrationStatusToFinished(MigrationEntry migrationEntry);

    /**
     * It changes the status of an existing MigrationEntry to {@link com.rinoto.migramongo.MigraMongoStatus.MigrationStatus#OK} and adds the repaired=true to the entry.
     * 
     * @param migrationEntry entry to change
     * @return migEntry just changed
     */
    MigrationRun setMigrationStatusToManuallyRepaired(MigrationEntry migrationEntry);

    /**
     * It changes the status of an existing MigrationEntry to {@link com.rinoto.migramongo.MigraMongoStatus.MigrationStatus#ERROR}
     * 
     * @param migrationEntry entry to change
     * @param e the exception
     * @return migEntry just changed
     */
    MigrationEntry setMigrationStatusToFailed(MigrationEntry migrationEntry, Exception e);

    /**
     * Inserts a new MigrationEntry with the information of the MigrationInfo parameter
     * 
     * @param migrationInfo info to insert
     * @return migEntry just updated
     */
    MigrationEntry insertMigrationStatusInProgress(MigrationInfo migrationInfo);

    /**
     * Inserts a new MigrationEntry with the information of the MigrationInfo parameter, and sets it to skipped, i.e. the migration was not executed.
     * 
     * @param migrationInfo info to insert
     * @return migEntry just updated
     */
    MigrationEntry insertMigrationStatusSkipped(MigrationInfo migrationInfo);

    /**
     * It finds a MigrationEntry that matches the fromVersion and toVersion parameters
     * 
     * @param fromVersion fromVersion param
     * @param toVersion toVersion param
     * @return migEntry found
     */
    MigrationEntry findMigration(String fromVersion, String toVersion);

    /**
     * Finds all migrations applied since the specified version, order asc
     * 
     * @param fromVersion the version we want to get the entries from
     * @return all migrations applied since the specified version
     */
    Iterable findMigrations(String fromVersion);

    /**
     * Returns all the migration entries that have been applied, ordered by date asc.
     * 
     * @return all migrations applied
     */
    Iterable getAllMigrationsApplied();

    MigrationEntry addRunToMigrationEntry(MigrationEntry entry, MigrationRun run);

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy