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

play.db.ebean.dbmigration.InvalidDatabaseState.scala Maven / Gradle / Ivy

The newest version!
package play.db.ebean.dbmigration

import play.api._

/**
  * InvalidDatabaseRevision.
  *
  * @param db        The database name
  * @param script    The SQL scripts
  * @param forceFrom From which version force migration
  * @since 17.01.29
  * @author Thibault Meyer
  */
case class InvalidDatabaseState(db: String, script: String, forceFrom: String) extends PlayException.RichDescription(
  "Database '" + db + "' needs migration!", "Ebean DB Migration") {

  private val redirectToApply = s"document.location = '${EbeanMigrationWebPath.migratePath(db)}?redirect=' + encodeURIComponent(location);"

  private val redirectToForceApply = s"document.location = '${EbeanMigrationWebPath.migratePath(db)}?force=$forceFrom&redirect=' + encodeURIComponent(location);"

  def subTitle: String = "The following SQL instructions will be run:"

  def content: String = script

  def htmlDescription: String =
    s"""
       |    Click on the button 'Migrate' to apply needed modifications.
       |    
|
| | ${if (forceFrom != null) s"""""" else ""} |
""".stripMargin }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy