feature/task_one

This commit is contained in:
Малашенков Станислав 2025-12-17 12:44:58 +03:00
parent 3e1ce239f4
commit 0bd16634ee
7 changed files with 86 additions and 5 deletions

View file

@ -38,6 +38,7 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-validation'
implementation 'javax.cache:cache-api'
implementation 'jakarta.xml.bind:jakarta.xml.bind-api'
implementation 'org.springframework.boot:spring-boot-starter-liquibase'
runtimeOnly 'org.springframework.boot:spring-boot-starter-actuator'
runtimeOnly "org.webjars:webjars-locator-lite:${webjarsLocatorLiteVersion}"
runtimeOnly "org.webjars.npm:bootstrap:${webjarsBootstrapVersion}"

View file

@ -0,0 +1,3 @@
spring.liquibase.contexts=dev

View file

@ -4,4 +4,4 @@ spring.datasource.url=${MYSQL_URL:jdbc:mysql://localhost/petclinic}
spring.datasource.username=${MYSQL_USER:petclinic}
spring.datasource.password=${MYSQL_PASS:petclinic}
# SQL is written to be idempotent so this is safe
spring.sql.init.mode=always
spring.sql.init.mode=never

View file

@ -4,4 +4,4 @@ spring.datasource.url=${POSTGRES_URL:jdbc:postgresql://localhost/petclinic}
spring.datasource.username=${POSTGRES_USER:petclinic}
spring.datasource.password=${POSTGRES_PASS:petclinic}
# SQL is written to be idempotent so this is safe
spring.sql.init.mode=always
spring.sql.init.mode=never

View file

@ -0,0 +1 @@
spring.liquibase.contexts=prod

View file

@ -1,8 +1,14 @@
# database init, supports mysql too
database=h2
spring.sql.init.schema-locations=classpath*:db/${database}/schema.sql
spring.sql.init.data-locations=classpath*:db/${database}/data.sql
#database=h2
#spring.sql.init.schema-locations=classpath*:db/${database}/schema.sql
#spring.sql.init.data-locations=classpath*:db/${database}/data.sql
#liquibase
spring.sql.init.mode=never
spring.liquibase.enabled=true
spring.liquibase.change-log=classpath:/db/changelog/db.changelog-master.yaml
spring.liquibase.show-summary=SUMMARY
spring.liquibase.show-summary-output=LOG
# Web
spring.thymeleaf.mode=HTML
@ -20,6 +26,7 @@ management.endpoints.web.exposure.include=*
logging.level.org.springframework=INFO
# logging.level.org.springframework.web=DEBUG
# logging.level.org.springframework.context.annotation=TRACE
logging.level.liquibase=INFO
# Maximum time static resources should be cached
spring.web.resources.cache.cachecontrol.max-age=12h

View file

@ -0,0 +1,69 @@
databaseChangeLog:
- changeSet:
id: 001-schema-h2
author: you
dbms: h2
changes:
- sqlFile:
path: db/h2/schema.sql
relativeToChangelogFile: false
splitStatements: true
stripComments: true
- changeSet:
id: 002-schema-mysql
author: you
dbms: mysql
changes:
- sqlFile:
path: db/mysql/schema.sql
relativeToChangelogFile: false
splitStatements: true
stripComments: true
- changeSet:
id: 003-schema-postgres
author: you
dbms: postgresql
changes:
- sqlFile:
path: db/postgres/schema.sql
relativeToChangelogFile: false
splitStatements: true
stripComments: true
- changeSet:
id: 101-data-h2
author: you
dbms: h2
context: dev
changes:
- sqlFile:
path: db/h2/data.sql
relativeToChangelogFile: false
splitStatements: true
stripComments: true
- changeSet:
id: 102-data-mysql
author: you
dbms: mysql
context: dev
changes:
- sqlFile:
path: db/mysql/data.sql
relativeToChangelogFile: false
splitStatements: true
stripComments: true
- changeSet:
id: 103-data-postgres
author: you
dbms: postgresql
context: dev
changes:
- sqlFile:
path: db/postgres/data.sql
relativeToChangelogFile: false
splitStatements: true
stripComments: true