таблица task, миграция

This commit is contained in:
Anton Dzyk 2025-12-11 22:29:35 +03:00
parent 24f9f8d806
commit ea4bfe281f
7 changed files with 61 additions and 4 deletions

5
debug/application.yaml Normal file
View File

@ -0,0 +1,5 @@
spring:
datasource:
url: jdbc:postgresql://localhost:5432/lti
username: postgres
password: postgres

11
pom.xml
View File

@ -43,6 +43,17 @@
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.7.8</version>
</dependency>
</dependencies>
<build>

View File

@ -4,13 +4,17 @@ import jakarta.persistence.*;
import ru.oa2.lti.model.TaskType;
@Entity
@Table(name = "task")
public class Task {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@GeneratedValue(strategy = GenerationType.AUTO)
long taskId;
@Column(length = 20)
@Enumerated(EnumType.STRING)
TaskType taskType;
@Column(columnDefinition = "jsonb")
Object data;
}

View File

@ -1,2 +0,0 @@
spring.application.name=lti-provider
server.port=9999

View File

@ -0,0 +1,15 @@
spring:
application:
name: lti-provider
liquibase:
change-log: classpath:db/changelog/changelog-master.xml
datasource:
driver-class-name: org.postgresql.Driver
server:
port: 9999

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" ?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.10.xsd"
objectQuotingStrategy="QUOTE_ONLY_RESERVED_WORDS">
<changeSet id="2025-12-01" author="dzyk">
<createTable tableName="task">
<column autoIncrement="true" name="task_id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="PK_TASK"/>
</column>
<column name="task_type" type="varchar(20)"/>
<column name="data" type="jsonb"/>
</createTable>
</changeSet>
</databaseChangeLog>

View File

@ -8,6 +8,6 @@
http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
<include file="/db/changelog/1.0.0/2025-12-add_task.xml"/>
</databaseChangeLog>