- Notifications
You must be signed in to change notification settings - Fork3
Liquibase and spring boot demo completed#1
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
9 commits Select commitHold shift + click to select a range
7f67235 Init commit
honest-nicemanb0eab87 Step 1. Add pgAdmin
honest-niceman6b51c7e Step 2. Add Liquibase and generate init script
honest-niceman03d54cc Step 3. Adjust JPA model
honest-niceman22a6d3b Step 4. Generate diff scripts
honest-niceman16797a0 Step 5. Append changeset to existing changelog
honest-nicemane660c06 Step 6. Run the app, make sure everything works fine
honest-niceman6b3b95b Add README.md
honest-niceman9e4ebe4 Add info about Liquibase video to main README.md
honest-nicemanFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
6 changes: 6 additions & 0 deletionsREADME.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletionsliquibase-and-spring-boot/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Liquibase + Spring Boot | Настройка и написание миграций баз данных | Amplicode | ||
| [](http://www.youtube.com/watch?v=blAaNt_XHAs) | ||
| Текущая директория содержит проект `blog`, который был использован в видео. | ||
| Все действия производились в ветке `liquibase-and-spring-boot`. | ||
| Первый коммит с которого можно начать повторять демо `7f6723523042dd69e8976818fade3772a3a38bc8`. |
37 changes: 37 additions & 0 deletionsliquibase-and-spring-boot/blog/.gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| HELP.md | ||
| .gradle | ||
| build/ | ||
| !gradle/wrapper/gradle-wrapper.jar | ||
| !**/src/main/**/build/ | ||
| !**/src/test/**/build/ | ||
| ### STS ### | ||
| .apt_generated | ||
| .classpath | ||
| .factorypath | ||
| .project | ||
| .settings | ||
| .springBeans | ||
| .sts4-cache | ||
| bin/ | ||
| !**/src/main/**/bin/ | ||
| !**/src/test/**/bin/ | ||
| ### IntelliJ IDEA ### | ||
| .idea | ||
| *.iws | ||
| *.iml | ||
| *.ipr | ||
| out/ | ||
| !**/src/main/**/out/ | ||
| !**/src/test/**/out/ | ||
| ### NetBeans ### | ||
| /nbproject/private/ | ||
| /nbbuild/ | ||
| /dist/ | ||
| /nbdist/ | ||
| /.nb-gradle/ | ||
| ### VS Code ### | ||
| .vscode/ |
28 changes: 28 additions & 0 deletionsliquibase-and-spring-boot/blog/build.gradle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| plugins { | ||
| id 'java' | ||
| id 'org.springframework.boot' version '3.2.5' | ||
| id 'io.spring.dependency-management' version '1.1.4' | ||
| } | ||
| group = 'io.amplicode' | ||
| version = '0.0.1-SNAPSHOT' | ||
| java { | ||
| sourceCompatibility = '17' | ||
| } | ||
| repositories { | ||
| mavenCentral() | ||
| } | ||
| dependencies { | ||
| implementation 'org.springframework.boot:spring-boot-starter-data-jpa' | ||
| runtimeOnly 'org.postgresql:postgresql' | ||
| testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
| testRuntimeOnly 'org.junit.platform:junit-platform-launcher' | ||
| implementation 'org.liquibase:liquibase-core' | ||
| } | ||
| tasks.named('test') { | ||
| useJUnitPlatform() | ||
| } |
43 changes: 43 additions & 0 deletionsliquibase-and-spring-boot/blog/docker-compose.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| services: | ||
| postgres: | ||
| image: postgres:16.3 | ||
| restart: always | ||
| ports: | ||
| - "5432:5432" | ||
| volumes: | ||
| - postgres_data:/var/lib/postgresql/data | ||
| - ./docker/postgres:/docker-entrypoint-initdb.d:ro | ||
| environment: | ||
| POSTGRES_USER: root | ||
| POSTGRES_PASSWORD: root | ||
| POSTGRES_DB: blog | ||
| healthcheck: | ||
| test: pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB | ||
| interval: 10s | ||
| timeout: 5s | ||
| start_period: 10s | ||
| retries: 5 | ||
| pgadmin: | ||
| image: dpage/pgadmin4:8.6 | ||
| restart: always | ||
| ports: | ||
| - "5050:80" | ||
| volumes: | ||
| - pgadmin_data:/var/lib/pgadmin | ||
| - ./docker/pgadmin/servers.json:/pgadmin4/servers.json | ||
| - ./docker/pgadmin/pgpass:/pgadmin4/pgpass | ||
| environment: | ||
| PGADMIN_DEFAULT_EMAIL: admin@admin.com | ||
| PGADMIN_DEFAULT_PASSWORD: root | ||
| PGADMIN_CONFIG_SERVER_MODE: "False" | ||
| PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED: "False" | ||
| healthcheck: | ||
| test: wget --no-verbose --tries=1 --spider http://localhost:80/misc/ping || exit -1 | ||
| interval: 10s | ||
| timeout: 5s | ||
| start_period: 10s | ||
| retries: 5 | ||
| entrypoint: /bin/sh -c "chmod 600 /pgadmin4/pgpass; /entrypoint.sh;" | ||
| volumes: | ||
| postgres_data: | ||
| pgadmin_data: |
1 change: 1 addition & 0 deletionsliquibase-and-spring-boot/blog/docker/pgadmin/pgpass
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| postgres:5432:blog:root:root |
14 changes: 14 additions & 0 deletionsliquibase-and-spring-boot/blog/docker/pgadmin/servers.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "Servers" : { | ||
| "1" : { | ||
| "Group" : "Servers", | ||
| "Name" : "postgres", | ||
| "Host" : "postgres", | ||
| "Port" : 5432, | ||
| "MaintenanceDB" : "blog", | ||
| "Username" : "root", | ||
| "PassFile" : "/pgadmin4/pgpass", | ||
| "SSLMode" : "prefer" | ||
| } | ||
| } | ||
| } |
30 changes: 30 additions & 0 deletionsliquibase-and-spring-boot/blog/docker/postgres/init-schema.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| CREATE TABLE posts ( | ||
| id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL, | ||
| created_by VARCHAR(255), | ||
| created_date TIMESTAMP WITHOUT TIME ZONE, | ||
| last_modified_by VARCHAR(255), | ||
| last_modified_date TIMESTAMP WITHOUT TIME ZONE, | ||
| title VARCHAR(255) NOT NULL, | ||
| text OID NOT NULL, | ||
| published_at TIMESTAMP WITHOUT TIME ZONE, | ||
| author_id BIGINT NOT NULL, | ||
| CONSTRAINT pk_posts PRIMARY KEY (id) | ||
| ); | ||
| CREATE TABLE users ( | ||
| id BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL, | ||
| created_by VARCHAR(255), | ||
| created_date TIMESTAMP WITHOUT TIME ZONE, | ||
| last_modified_by VARCHAR(255), | ||
| last_modified_date TIMESTAMP WITHOUT TIME ZONE, | ||
| first_name VARCHAR(255) NOT NULL, | ||
| last_name VARCHAR(255) NOT NULL, | ||
| email VARCHAR(255), | ||
| fax VARCHAR(255), | ||
| last_activity TIMESTAMP WITHOUT TIME ZONE, | ||
| CONSTRAINT pk_users PRIMARY KEY (id) | ||
| ); | ||
| CREATE INDEX idx_user_names ON users(first_name, last_name); | ||
| ALTER TABLE posts ADD CONSTRAINT FK_POSTS_ON_AUTHOR FOREIGN KEY (author_id) REFERENCES users (id); |
Binary file addedliquibase-and-spring-boot/blog/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletionsliquibase-and-spring-boot/blog/gradle/wrapper/gradle-wrapper.properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| distributionBase=GRADLE_USER_HOME | ||
| distributionPath=wrapper/dists | ||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip | ||
| networkTimeout=10000 | ||
| validateDistributionUrl=true | ||
| zipStoreBase=GRADLE_USER_HOME | ||
| zipStorePath=wrapper/dists |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.