Skip to content

Commit 8fac8b8

Browse files
authored
Postgresql (#3)
* added postgresql and changed byte type to oid * added postgres * v1.2.2
1 parent b896089 commit 8fac8b8

File tree

11 files changed

+52
-13
lines changed

11 files changed

+52
-13
lines changed

.github/workflows/build.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ jobs:
4040
MSSQL_SA_PASSWORD: "veryStrong123"
4141
ports:
4242
- 1433:1433
43-
4443
steps:
4544
- uses: actions/checkout@v4
4645
- name: Set up JDK 21
@@ -49,9 +48,31 @@ jobs:
4948
java-version: '21'
5049
distribution: 'temurin'
5150
cache: maven
52-
- name: Run Tests with MSSQL
51+
- name: Run tests with MSSQL
5352
run: mvn test -pl core -am -Dspring.profiles.active=mssql
5453

54+
test-postgres:
55+
runs-on: ubuntu-latest
56+
needs: build
57+
services:
58+
postgres:
59+
image: postgres
60+
options: --name pg-container
61+
env:
62+
POSTGRES_USER: sa
63+
POSTGRES_PASSWORD: veryStrong123
64+
ports:
65+
- 5432:5432
66+
steps:
67+
- uses: actions/checkout@v4
68+
- name: Set up JDK 21
69+
uses: actions/setup-java@v4
70+
with:
71+
java-version: '21'
72+
distribution: 'temurin'
73+
cache: maven
74+
- name: Run tests with postgres
75+
run: mvn test -pl core -am -Dspring.profiles.active=postgres
5576

5677
java-doc:
5778
runs-on: ubuntu-latest
@@ -84,7 +105,7 @@ jobs:
84105

85106
maven-deploy:
86107
runs-on: ubuntu-latest
87-
needs: [build, test-mssql]
108+
needs: [build, test-mssql, test-postgres]
88109
if: ${{ github.ref == 'refs/heads/main' }}
89110
steps:
90111
- uses: actions/checkout@v4

RUN_AND_BUILD.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
mvn versions:display-dependency-updates
2-
mvn versions:set -DnewVersion=1.2.0 -DgenerateBackupPoms=false
3-
mvn versions:set -DnewVersion=1.2.1-SNAPSHOT -DgenerateBackupPoms=false
2+
mvn versions:set -DnewVersion=1.2.1 -DgenerateBackupPoms=false
3+
mvn versions:set -DnewVersion=1.2.2-SNAPSHOT -DgenerateBackupPoms=false
44

5-
docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=veryStrong123" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2022-latest
5+
docker run --name pg-container -e POSTGRES_USER=sa -e POSTGRES_PASSWORD=veryStrong123 -p 5432:5432 -d postgres
66

77
docker run --cap-add SYS_PTRACE -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=veryStrong123' -p 1433:1433 --name azuresqledge -d mcr.microsoft.com/azure-sql-edge

core/pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.sterl.spring</groupId>
88
<artifactId>spring-persistent-tasks-root</artifactId>
9-
<version>1.2.1-SNAPSHOT</version>
9+
<version>1.2.2-SNAPSHOT</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

@@ -84,6 +84,11 @@
8484
<artifactId>mssql-jdbc</artifactId>
8585
<scope>test</scope>
8686
</dependency>
87+
<dependency>
88+
<groupId>org.postgresql</groupId>
89+
<artifactId>postgresql</artifactId>
90+
<scope>test</scope>
91+
</dependency>
8792
</dependencies>
8893

8994
<build>

core/src/main/java/org/sterl/spring/persistent_tasks/shared/model/TriggerData.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ public void updateRunningDuration() {
7979
private Long runningDurationInMs;
8080

8181
@Lob
82+
@Column(name = "state")
8283
private byte[] state;
8384

8485
@Column(length = 512)

core/src/test/java/org/sterl/spring/persistent_tasks/AbstractSpringTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import org.springframework.context.annotation.Configuration;
1616
import org.springframework.context.annotation.Primary;
1717
import org.springframework.stereotype.Component;
18+
import org.springframework.test.context.ActiveProfiles;
1819
import org.springframework.transaction.support.TransactionTemplate;
1920
import org.sterl.spring.persistent_tasks.api.SpringBeanTask;
2021
import org.sterl.spring.persistent_tasks.api.TaskId;
@@ -33,7 +34,7 @@
3334
import uk.co.jemos.podam.api.PodamFactory;
3435
import uk.co.jemos.podam.api.PodamFactoryImpl;
3536

36-
//@ActiveProfiles("mssql")
37+
//@ActiveProfiles("postgres") // postgres mssql
3738
@SpringBootTest(classes = SampleApp.class, webEnvironment = WebEnvironment.RANDOM_PORT)
3839
public class AbstractSpringTest {
3940

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
spring:
2+
datasource:
3+
username: sa
4+
password: veryStrong123
5+
url: jdbc:postgresql://localhost:5432/postgres
6+
driver-class-name: org.postgresql.Driver
7+
hikari:
8+
maximum-pool-size: 100
9+
jpa:
10+
hibernate:
11+
ddl-auto: none

db/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.sterl.spring</groupId>
88
<artifactId>spring-persistent-tasks-root</artifactId>
9-
<version>1.2.1-SNAPSHOT</version>
9+
<version>1.2.2-SNAPSHOT</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

db/src/main/resources/spring-persistent-tasks/db/pt-changelog-v1.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<property name="offsetdatetime.type" value="DATETIME(6)" dbms="mysql,mariadb" />
1515

1616
<property name="binary.type" value="varbinary(MAX)" dbms="mssql" />
17-
<property name="binary.type" value="BYTEA" dbms="postgresql" />
17+
<property name="binary.type" value="oid" dbms="postgresql" />
1818
<property name="binary.type" value="BLOB" dbms="h2" />
1919
<property name="binary.type" value="LONGBLOB" dbms="mysql,mariadb" />
2020

example/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>org.sterl.spring</groupId>
88
<artifactId>spring-persistent-tasks-root</artifactId>
9-
<version>1.2.1-SNAPSHOT</version>
9+
<version>1.2.2-SNAPSHOT</version>
1010
<relativePath>../pom.xml</relativePath>
1111
</parent>
1212

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<groupId>org.sterl.spring</groupId>
1313
<artifactId>spring-persistent-tasks-root</artifactId>
14-
<version>1.2.1-SNAPSHOT</version>
14+
<version>1.2.2-SNAPSHOT</version>
1515
<packaging>pom</packaging>
1616

1717
<inceptionYear>2024</inceptionYear>

0 commit comments

Comments
 (0)