Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate current model changes into db/changelog/dev #260

Merged
merged 7 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions srv/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@
<configuration>
<commands>
<command>build --for java</command>
<command>deploy --profile pg --dry --delta-from srv/src/main/resources/db/changelog/v2/model.csn >
srv/src/main/resources/db/changelog/dev/model.sql</command>
<command>deploy --model-only --dry > srv/src/main/resources/db/changelog/dev/model.csn</command>
</commands>
</configuration>
</execution>
Expand Down
4 changes: 3 additions & 1 deletion srv/src/main/resources/application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ cds:
---
spring:
config.activate.on-profile: cloud
liquibase.contexts: "!dev"

---
spring:
config.activate.on-profile: default
liquibase.contexts: "dev"
cds:
dataSource:
auto-config.enabled: false

5 changes: 4 additions & 1 deletion srv/src/main/resources/db/changelog/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
!*.sql
!*.json
!*.json
/dev/*.sql
/dev/*.csn
/dev/*.json
10 changes: 9 additions & 1 deletion srv/src/main/resources/db/changelog/db.changelog-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,12 @@ databaseChangeLog:
changes:
- sqlFile:
dbms: postgresql
path: db/changelog/v2/model.sql
path: db/changelog/v2/model.sql
- changeSet:
id: "development"
author: CAP Java
contextFilter: dev
changes:
- sqlFile:
dbms: postgresql
vmikhailenko marked this conversation as resolved.
Show resolved Hide resolved
path: db/changelog/dev/model.sql
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.devtools.restart.RestartScope;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand All @@ -17,7 +16,6 @@ public class DatabaseConfiguration {

@Bean
@ServiceConnection
@RestartScope
PostgreSQLContainer<?> postgresContainer(@Value("${my.bookshop.postgres-image}") String imageName) {
DockerImageName image = DockerImageName.parse(imageName).asCompatibleSubstituteFor(POSTGRES);
return new PostgreSQLContainer<>(image)
Expand Down
Loading