feat: changes from h2 to postgres

master
Artur Oliveira 2025-12-15 22:00:00 -03:00
parent d06c103a66
commit 2980248669
3 changed files with 18 additions and 9 deletions

View File

@ -34,6 +34,7 @@ dependencies {
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'com.h2database:h2'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.projectlombok:lombok'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.6.3'
testImplementation 'org.springframework.boot:spring-boot-starter-data-jdbc-test'

View File

@ -1,17 +1,24 @@
spring:
application:
name: backend
sql:
init:
mode: always
schema-locations: classpath:schema.sql
datasource:
url: jdbc:h2:file:./data/db
driver-class-name: org.h2.Driver
username: sa
password:
url: jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_NAME}
username: ${DB_USER}
password: ${DB_PASSWD}
jpa:
hibernate:
ddl-auto: update
database-platform: org.hibernate.dialect.H2Dialect
h2:
console:
enabled: true
path: /h2-console
show-sql: true
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
format_sql: true
default_schema: server-manager

View File

@ -0,0 +1 @@
CREATE SCHEMA IF NOT EXISTS "server-manager";