mirror of
https://github.com/pcvolkmer/etl-processor.git
synced 2025-04-20 01:36:50 +00:00
Add postgres migration file and configuration for postgres
This commit is contained in:
parent
c8e99133e2
commit
46928964ef
@ -8,3 +8,11 @@ services:
|
|||||||
MARIADB_USER: dev
|
MARIADB_USER: dev
|
||||||
MARIADB_PASSWORD: dev
|
MARIADB_PASSWORD: dev
|
||||||
MARIADB_ROOT_PASSWORD: dev
|
MARIADB_ROOT_PASSWORD: dev
|
||||||
|
# postgres:
|
||||||
|
# image: postgres:alpine
|
||||||
|
# ports:
|
||||||
|
# - "15432:5432"
|
||||||
|
# environment:
|
||||||
|
# POSTGRES_DB: dev
|
||||||
|
# POSTGRES_USER: dev
|
||||||
|
# POSTGRES_PASSWORD: dev
|
||||||
|
@ -32,6 +32,7 @@ data class Request(
|
|||||||
@Id val id: Long? = null,
|
@Id val id: Long? = null,
|
||||||
val uuid: RequestId = RequestId.randomUUID(),
|
val uuid: RequestId = RequestId.randomUUID(),
|
||||||
val patientId: String,
|
val patientId: String,
|
||||||
|
val pid: String,
|
||||||
val fingerprint: String,
|
val fingerprint: String,
|
||||||
val status: RequestStatus,
|
val status: RequestStatus,
|
||||||
val processedAt: Instant = Instant.now()
|
val processedAt: Instant = Instant.now()
|
||||||
|
@ -46,6 +46,7 @@ class MtbFileController(
|
|||||||
|
|
||||||
@PostMapping(path = ["/mtbfile"])
|
@PostMapping(path = ["/mtbfile"])
|
||||||
fun mtbFile(@RequestBody mtbFile: MtbFile): ResponseEntity<Void> {
|
fun mtbFile(@RequestBody mtbFile: MtbFile): ResponseEntity<Void> {
|
||||||
|
val pid = mtbFile.patient.id
|
||||||
val pseudonymized = pseudonymizeService.pseudonymize(mtbFile)
|
val pseudonymized = pseudonymizeService.pseudonymize(mtbFile)
|
||||||
|
|
||||||
val lastRequestForPatient =
|
val lastRequestForPatient =
|
||||||
@ -55,6 +56,7 @@ class MtbFileController(
|
|||||||
requestRepository.save(
|
requestRepository.save(
|
||||||
Request(
|
Request(
|
||||||
patientId = pseudonymized.patient.id,
|
patientId = pseudonymized.patient.id,
|
||||||
|
pid = pid,
|
||||||
fingerprint = fingerprint(mtbFile),
|
fingerprint = fingerprint(mtbFile),
|
||||||
status = RequestStatus.DUPLICATION
|
status = RequestStatus.DUPLICATION
|
||||||
)
|
)
|
||||||
@ -93,6 +95,7 @@ class MtbFileController(
|
|||||||
requestRepository.save(
|
requestRepository.save(
|
||||||
Request(
|
Request(
|
||||||
patientId = pseudonymized.patient.id,
|
patientId = pseudonymized.patient.id,
|
||||||
|
pid = pid,
|
||||||
fingerprint = fingerprint(mtbFile),
|
fingerprint = fingerprint(mtbFile),
|
||||||
status = requestStatus
|
status = requestStatus
|
||||||
)
|
)
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
CREATE TABLE IF NOT EXISTS request
|
CREATE TABLE IF NOT EXISTS request
|
||||||
(
|
(
|
||||||
id int auto_increment primary key,
|
id int auto_increment primary key,
|
||||||
uuid varchar(255) not null,
|
uuid varchar(255) not null unique,
|
||||||
patient_id varchar(255) not null,
|
patient_id varchar(255) not null,
|
||||||
|
pid varchar(255) not null,
|
||||||
fingerprint varchar(255) not null,
|
fingerprint varchar(255) not null,
|
||||||
status varchar(16) not null,
|
status varchar(16) not null,
|
||||||
processed_at datetime default utc_timestamp() not null
|
processed_at datetime default utc_timestamp() not null
|
||||||
|
11
src/main/resources/db/migration/postgresql/V0_1_0__Init.sql
Normal file
11
src/main/resources/db/migration/postgresql/V0_1_0__Init.sql
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS request
|
||||||
|
(
|
||||||
|
id serial,
|
||||||
|
uuid varchar(255) not null unique,
|
||||||
|
patient_id varchar(255) not null,
|
||||||
|
pid varchar(255) not null,
|
||||||
|
fingerprint varchar(255) not null,
|
||||||
|
status varchar(16) not null,
|
||||||
|
processed_at timestamp with time zone default now() not null,
|
||||||
|
PRIMARY KEY (id)
|
||||||
|
);
|
Loading…
x
Reference in New Issue
Block a user