Skip to content

Commit 7546c72

Browse files
authored
chore!: EXPOSED-727 Change timestamp column type for H2 from "DATETIME(9)" to "TIMESTAMP(9)" (#2401)
- **Why**: 1. Oracle, PostgreSQL, and MariaDB are the only ones that use type "TIMESTAMP" for the timestamp column. H2 also has that type but "DATETIME" was being used instead for some reason. 2. This is a preparation step that makes detecting column type change for migration easier. - **How**: Overrided `timestampType()` in `H2DataTypeProvider` ⚠️ Note: Some issues were discovered and fixed in the Pull Request Title Validation and Commit Message Validation scripts.
1 parent a32e1f6 commit 7546c72

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

.github/workflows/commit-message-validation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Validate commit messages
2929
run: |
3030
# Regex for Conventional Commits specification
31-
COMMIT_REGEX="^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([^\)]*\))?:\s?(EXPOSED-[0-9]+\s?)?.+$"
31+
COMMIT_REGEX="^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(!)?(\([^\)]*\))?:\s?(EXPOSED-[0-9]+\s?)?.+$"
3232
3333
# Get all commits in the pull request (from base to head)
3434
COMMITS=$(git log --format=%s --no-merges origin/main..${{ github.sha }})

.github/workflows/pull-request-title-validation.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,11 @@ jobs:
2525
uses: actions/checkout@v3
2626

2727
- name: Validate PR title
28+
env:
29+
PR_TITLE: ${{ github.event.pull_request.title }}
2830
run: |
2931
# Regex for Conventional Commits specification
30-
PR_TITLE_REGEX="^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([^\)]*\))?:\s?(EXPOSED-[0-9]+\s?)?.+$"
31-
32-
# Get the PR title
33-
PR_TITLE="${{ github.event.pull_request.title }}"
32+
PR_TITLE_REGEX="^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(!)?(\([^\)]*\))?:\s?(EXPOSED-[0-9]+\s?)?.+$"
3433
3534
# Check if PR title matches the regex
3635
if [[ ! "$PR_TITLE" =~ $PR_TITLE_REGEX ]]; then

documentation-website/Writerside/topics/Breaking-Changes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Breaking Changes
22

3+
## 0.60.0
4+
* In H2, the `timestamp()` column now maps to data type `TIMESTAMP(9)` instead of `DATETIME(9)`.
5+
36
## 0.59.0
47
* [PostgreSQL] `MigrationUtils.statementsRequiredForDatabaseMigration(*tables)` used to potentially return `DROP` statements for any database sequence not
58
mapped to an Exposed table object. Now it only checks against database sequences that have a relational dependency on any of the specified tables
@@ -28,6 +31,7 @@ val long = long("long_column").nullable().check { column ->
2831
column.isNull() or typeCondition
2932
}
3033
```
34+
* In MariaDB, the `timestamp()` column now maps to data type `TIMESTAMP` instead of `DATETIME`.
3135

3236
## 0.57.0
3337
* Insert, Upsert, and Replace statements will no longer implicitly send all default values (except for client-side default values) in every SQL request.

exposed-core/src/main/kotlin/org/jetbrains/exposed/sql/vendors/H2.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ internal object H2DataTypeProvider : DataTypeProvider() {
1010
override fun binaryType(): String = "VARBINARY"
1111

1212
override fun uuidType(): String = "UUID"
13+
1314
override fun uuidToDB(value: UUID): Any = value.toString()
15+
1416
override fun dateTimeType(): String = "DATETIME(9)"
1517

18+
override fun timestampType(): String = "TIMESTAMP(9)"
19+
1620
override fun timestampWithTimeZoneType(): String = "TIMESTAMP(9) WITH TIME ZONE"
1721

1822
override fun jsonBType(): String = "JSON"

0 commit comments

Comments
 (0)