001package io.ebean.migration.auto;
002
003import javax.sql.DataSource;
004import java.util.Properties;
005
006/**
007 * Automatically run DB Migrations on application start.
008 */
009public interface AutoMigrationRunner {
010
011  /**
012   * Set the name of the database the migration is run for.
013   * <p>
014   * This name can be used when loading properties like:
015   * <code>ebean.${name}.migration.migrationPath</code>
016   */
017  void setName(String name);
018
019  /**
020   * Set a default DB schema to use.
021   * <p>
022   * This is mostly for Postgres use where the dbSchema matches the DB username. In this case
023   * we don't set the current schema as that can mess up the Postgres search path.
024   * </p>
025   */
026  void setDefaultDbSchema(String defaultDbSchema);
027
028  /**
029   * Load configuration properties.
030   */
031  void loadProperties(Properties properties);
032
033  /**
034   * Run DB migrations using the given DataSource.
035   */
036  void run(DataSource dataSource);
037}