Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions exposed-core/api/exposed-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -4442,6 +4442,7 @@ public class org/jetbrains/exposed/v1/core/vendors/PostgreSQLDialect : org/jetbr
public fun dropIndex (Ljava/lang/String;Ljava/lang/String;ZZ)Ljava/lang/String;
public fun getName ()Ljava/lang/String;
public fun getRequiresAutoCommitOnCreateDrop ()Z
public fun getSupportsColumnTypeChange ()Z
public fun getSupportsOrderByNullsFirstLast ()Z
public fun getSupportsSelectForUpdate ()Z
public fun getSupportsSubqueryUnions ()Z
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,8 @@ open class PostgreSQLDialect(override val name: String = dialectName) : VendorDi

override val supportsWindowFrameGroupsMode: Boolean = true

override val supportsColumnTypeChange: Boolean = true

@Deprecated(
"The parameter was moved to JdbcExposedDatabaseMetadata/R2dbcExposedDatabaseMetadata classes",
ReplaceWith("TransactionManager.current().db.supportsSelectForUpdate")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import org.jetbrains.exposed.v1.datetime.date as kotlinDatetimeDate
import org.jetbrains.exposed.v1.javatime.date as javatimeDate

class DatabaseMigrationTests : DatabaseTestsBase() {
private val columnTypeChangeUnsupportedDb = TestDB.ALL - TestDB.ALL_H2_V2
private val columnTypeChangeUnsupportedDb = TestDB.ALL - TestDB.ALL_H2_V2 - TestDB.ALL_POSTGRES

@OptIn(InternalApi::class)
@Test
Expand Down Expand Up @@ -464,4 +464,27 @@ class DatabaseMigrationTests : DatabaseTestsBase() {
logCaptor.clearLogs()
logCaptor.close()
}

@Test
fun testColumnTypeChangeOnlyGeneratesMigrationStatement() {
val originalTable = object : Table("tester") {
val data = varchar("data", 50)
}

val modifiedTable = object : Table("tester") {
val data = text("data")
}

withDb(excludeSettings = columnTypeChangeUnsupportedDb) {
try {
SchemaUtils.create(originalTable)

val statements = MigrationUtils.statementsRequiredForDatabaseMigration(modifiedTable, withLogs = false)
assertEquals(1, statements.size)
assertTrue(statements.first().contains("ALTER", ignoreCase = true))
} finally {
SchemaUtils.drop(originalTable)
}
}
}
}
Loading