-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into add-topic-transaction-examples
- Loading branch information
Showing
25 changed files
with
1,108 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>tech.ydb.jdbc.examples</groupId> | ||
<artifactId>ydb-jdbc-examples</artifactId> | ||
<version>1.1.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>spring-liquibase-app</artifactId> | ||
<name>Spring Liquibase Example</name> | ||
<description>Basic example for SpringBoot3 and Liquibase</description> | ||
<properties> | ||
<maven.compiler.release>17</maven.compiler.release> | ||
<kotlin.version>1.9.22</kotlin.version> | ||
<hibernate.ydb.dialect.version>0.9.1</hibernate.ydb.dialect.version> | ||
<spring.boot.version>3.2.1</spring.boot.version> | ||
<liquibase.ydb.dialect.version>0.9.1</liquibase.ydb.dialect.version> | ||
<liquibase.core.version>4.24.0</liquibase.core.version> | ||
</properties> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-data-jpa</artifactId> | ||
<version>${spring.boot.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.data</groupId> | ||
<artifactId>spring-data-commons</artifactId> | ||
<version>${spring.boot.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-reflect</artifactId> | ||
<version>${kotlin.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-stdlib</artifactId> | ||
<version>${kotlin.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>tech.ydb.dialects</groupId> | ||
<artifactId>hibernate-ydb-dialect</artifactId> | ||
<version>${hibernate.ydb.dialect.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>tech.ydb.jdbc</groupId> | ||
<artifactId>ydb-jdbc-driver-shaded</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>tech.ydb.dialects</groupId> | ||
<artifactId>liquibase-ydb-dialect</artifactId> | ||
<version>0.9.7</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.liquibase</groupId> | ||
<artifactId>liquibase-core</artifactId> | ||
<version>${liquibase.core.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<version>${spring.boot.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>tech.ydb.test</groupId> | ||
<artifactId>ydb-junit5-support</artifactId> | ||
<scope>test</scope> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory> | ||
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<environmentVariables> | ||
<TESTCONTAINERS_REUSE_ENABLE>true</TESTCONTAINERS_REUSE_ENABLE> | ||
</environmentVariables> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<version>${spring.boot.version}</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-maven-plugin</artifactId> | ||
<version>${kotlin.version}</version> | ||
<executions> | ||
<execution> | ||
<id>compile</id> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>compile</goal> | ||
</goals> | ||
</execution> | ||
<execution> | ||
<id>test-compile</id> | ||
<goals> | ||
<goal>test-compile</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<args> | ||
<arg>-Xjsr305=strict</arg> | ||
</args> | ||
<compilerPlugins> | ||
<plugin>spring</plugin> | ||
<plugin>jpa</plugin> | ||
</compilerPlugins> | ||
</configuration> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-maven-allopen</artifactId> | ||
<version>${kotlin.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jetbrains.kotlin</groupId> | ||
<artifactId>kotlin-maven-noarg</artifactId> | ||
<version>${kotlin.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
9 changes: 9 additions & 0 deletions
9
jdbc/spring-liquibase-app/src/main/kotlin/tech/ydb/liquibase/LiquibaseApplication.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package tech.ydb.liquibase | ||
|
||
import org.springframework.boot.autoconfigure.SpringBootApplication | ||
|
||
/** | ||
* @author Kirill Kurdyukov | ||
*/ | ||
@SpringBootApplication | ||
class LiquibaseApplication |
36 changes: 36 additions & 0 deletions
36
jdbc/spring-liquibase-app/src/main/kotlin/tech/ydb/liquibase/model/Employee.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package tech.ydb.liquibase.model | ||
|
||
import jakarta.persistence.Column | ||
import jakarta.persistence.Entity | ||
import jakarta.persistence.Id | ||
import jakarta.persistence.Table | ||
import java.time.LocalDate | ||
import java.time.LocalDateTime | ||
|
||
@Entity | ||
@Table(name = "employee") | ||
data class Employee( | ||
@Id | ||
val id: Long, | ||
|
||
@Column(name = "full_name") | ||
val fullName: String, | ||
|
||
@Column | ||
val email: String, | ||
|
||
@Column(name = "hire_date") | ||
val hireDate: LocalDate, | ||
|
||
@Column | ||
val salary: java.math.BigDecimal, | ||
|
||
@Column(name = "is_active") | ||
val isActive: Boolean, | ||
|
||
@Column | ||
val department: String, | ||
|
||
@Column | ||
val age: Int, | ||
) |
8 changes: 8 additions & 0 deletions
8
.../spring-liquibase-app/src/main/kotlin/tech/ydb/liquibase/repository/EmployeeRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package tech.ydb.liquibase.repository | ||
|
||
import org.springframework.data.repository.CrudRepository | ||
import tech.ydb.liquibase.model.Employee | ||
|
||
interface EmployeeRepository : CrudRepository<Employee, Long> | ||
|
||
fun EmployeeRepository.findByIdOrNull(id: Long): Employee? = this.findById(id).orElse(null) |
8 changes: 8 additions & 0 deletions
8
jdbc/spring-liquibase-app/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
spring.jpa.properties.hibernate.dialect=tech.ydb.hibernate.dialect.YdbDialect | ||
|
||
spring.datasource.driver-class-name=tech.ydb.jdbc.YdbDriver | ||
spring.datasource.url=jdbc:ydb:grpc://localhost:2136/local | ||
|
||
spring.liquibase.change-log=classpath:changelog.yaml | ||
|
||
logging.level.liquibase=DEBUG |
45 changes: 45 additions & 0 deletions
45
jdbc/spring-liquibase-app/src/main/resources/changelog.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
databaseChangeLog: | ||
- changeSet: | ||
id: "employee" | ||
author: "kurdyukov-kir" | ||
changes: | ||
- createTable: | ||
tableName: employee | ||
columns: | ||
- column: | ||
name: id | ||
type: bigint | ||
constraints: | ||
primaryKey: true | ||
nullable: false | ||
- column: | ||
name: full_name | ||
type: varchar | ||
- column: | ||
name: email | ||
type: varchar | ||
- column: | ||
name: hire_date | ||
type: date | ||
- column: | ||
name: salary | ||
type: decimal(22,9) | ||
- column: | ||
name: is_active | ||
type: boolean | ||
- column: | ||
name: department | ||
type: varchar | ||
- column: | ||
name: age | ||
type: int | ||
- column: | ||
name: limit_date_password | ||
type: datetime | ||
- createIndex: | ||
indexName: idx_employee_email | ||
tableName: employee | ||
unique: false | ||
columns: | ||
- column: | ||
name: email |
Oops, something went wrong.