Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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
honest-niceman merged 9 commits intomainfromliquibase-and-spring-boot
May 15, 2024
Merged
Show file tree
Hide file tree
Changes fromall 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
6 changes: 6 additions & 0 deletionsREADME.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,3 +13,9 @@
* Видео: https://youtu.be/uxdec6WIWEg
* Проект: [blog](generate-entities-from-db/blog)
* Инструкция для самостоятельного прохождения: [README.md](generate-entities-from-db/README.md)

## Liquibase + Spring Boot | Настройка и написание миграций баз данных

* Видео: http://www.youtube.com/watch?v=blAaNt_XHAs
* Проект: [blog](liquibase-and-spring-boot/blog)
* Инструкция для самостоятельного прохождения: [README.md](liquibase-and-spring-boot/README.md)
9 changes: 9 additions & 0 deletionsliquibase-and-spring-boot/README.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
# Liquibase + Spring Boot | Настройка и написание миграций баз данных | Amplicode

[![](https://i3.ytimg.com/vi/blAaNt_XHAs/maxresdefault.jpg)](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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
postgres:5432:blog:root:root
14 changes: 14 additions & 0 deletionsliquibase-and-spring-boot/blog/docker/pgadmin/servers.json
View file
Open in desktop
Original file line numberDiff line numberDiff 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"
}
}
}
View file
Open in desktop
Original file line numberDiff line numberDiff 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);
View file
Open in desktop
Binary file not shown.
View file
Open in desktop
Original file line numberDiff line numberDiff 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
Loading

[8]ページ先頭

©2009-2025 Movatter.jp