feature/Improved the migration scripts

This commit is contained in:
Marko Milić 2020-06-22 09:30:34 +02:00
parent ddd90b8092
commit 87bd1975ff
3 changed files with 9 additions and 3 deletions

View File

@ -6,6 +6,7 @@ import java.time.{ZoneId, ZonedDateTime}
import code.api.util.APIUtil
import code.api.util.migration.Migration.{DbFunction, saveLog}
import code.consent.MappedConsent
import net.liftweb.common.Full
import net.liftweb.mapper.{DB, Schemifier}
import net.liftweb.util.DefaultConnectionIdentifier
@ -24,7 +25,12 @@ object MigrationOfMappedConsent {
val executedSql =
DbFunction.maybeWrite(true, Schemifier.infoF _, DB.use(DefaultConnectionIdentifier){ conn => conn}) {
() => "ALTER TABLE mappedconsent ALTER COLUMN mjsonwebtoken type text;"
APIUtil.getPropsValue("db.driver") match {
case Full(value) if value.contains("com.microsoft.sqlserver.jdbc.SQLServerDriver") =>
() => "ALTER TABLE mappedconsent ALTER COLUMN mjsonwebtoken text;"
case _ =>
() => "ALTER TABLE mappedconsent ALTER COLUMN mjsonwebtoken type text;"
}
}
val endDate = System.currentTimeMillis()

View File

@ -24,7 +24,7 @@ object MigrationOfMappedUserAuthContext {
val executedSql =
DbFunction.maybeWrite(true, Schemifier.infoF _, DB.use(DefaultConnectionIdentifier){ conn => conn}) {
() => "DROP INDEX mappeduserauthcontext_muserid_mkey;"
() => "DROP INDEX IF EXISTS mappeduserauthcontext_muserid_mkey;"
}
val endDate = System.currentTimeMillis()

View File

@ -24,7 +24,7 @@ object MigrationOfMappedUserAuthContextUpdate {
val executedSql =
DbFunction.maybeWrite(true, Schemifier.infoF _, DB.use(DefaultConnectionIdentifier){ conn => conn}) {
() => "DROP INDEX mappeduserauthcontextupdate_muserid_mkey;"
() => "DROP INDEX IF EXISTS mappeduserauthcontextupdate_muserid_mkey;"
}
val endDate = System.currentTimeMillis()