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

Commitaf59b74

Browse files
Merge pull request#2
Flyway demo completed
2 parentsa63ad13 +367c71a commitaf59b74

File tree

22 files changed

+885
-0
lines changed

22 files changed

+885
-0
lines changed

‎flyway-and-spring-boot/README.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#Flyway + Spring Boot | Настройка и написание миграций баз данных | Amplicode
2+
3+
[![](https://i3.ytimg.com/vi/w-46xlGRcZk/maxresdefault.jpg)](http://www.youtube.com/watch?v=w-46xlGRcZk)
4+
5+
Текущая директория содержит проект`blog`, который был использован в видео.
6+
7+
Все действия производились в ветке`flyway-and-spring-boot`.
8+
9+
Первый коммит с которого можно начать повторять демо`99748de21ed5a5f731ce3c583df673841faa46ec`.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
HELP.md
2+
.gradle
3+
build/
4+
!gradle/wrapper/gradle-wrapper.jar
5+
!**/src/main/**/build/
6+
!**/src/test/**/build/
7+
8+
### STS ###
9+
.apt_generated
10+
.classpath
11+
.factorypath
12+
.project
13+
.settings
14+
.springBeans
15+
.sts4-cache
16+
bin/
17+
!**/src/main/**/bin/
18+
!**/src/test/**/bin/
19+
20+
### IntelliJ IDEA ###
21+
.idea
22+
*.iws
23+
*.iml
24+
*.ipr
25+
out/
26+
!**/src/main/**/out/
27+
!**/src/test/**/out/
28+
29+
### NetBeans ###
30+
/nbproject/private/
31+
/nbbuild/
32+
/dist/
33+
/nbdist/
34+
/.nb-gradle/
35+
36+
### VS Code ###
37+
.vscode/
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
buildscript {
2+
dependencies {
3+
classpath("org.flywaydb:flyway-database-postgresql:10.10.0")
4+
}
5+
}
6+
7+
plugins {
8+
id'java'
9+
id'org.springframework.boot' version'3.2.5'
10+
id'io.spring.dependency-management' version'1.1.4'
11+
id'org.flywaydb.flyway' version'10.10.0'
12+
}
13+
14+
group='io.amplicode'
15+
version='0.0.1-SNAPSHOT'
16+
17+
java {
18+
sourceCompatibility='17'
19+
}
20+
21+
repositories {
22+
mavenCentral()
23+
}
24+
25+
dependencies {
26+
implementation'org.springframework.boot:spring-boot-starter-data-jpa'
27+
runtimeOnly'org.postgresql:postgresql'
28+
testImplementation'org.springframework.boot:spring-boot-starter-test'
29+
testRuntimeOnly'org.junit.platform:junit-platform-launcher'
30+
implementation'org.flywaydb:flyway-core'
31+
}
32+
33+
tasks.named('test') {
34+
useJUnitPlatform()
35+
}
36+
37+
flyway {
38+
baselineVersion=0
39+
url='jdbc:postgresql://localhost:5432/blog'
40+
user='root'
41+
password='root'
42+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
services:
2+
postgres:
3+
image:postgres:16.3
4+
restart:always
5+
ports:
6+
-"5432:5432"
7+
volumes:
8+
-postgres_data:/var/lib/postgresql/data
9+
-./docker/postgres:/docker-entrypoint-initdb.d:ro
10+
environment:
11+
POSTGRES_USER:root
12+
POSTGRES_PASSWORD:root
13+
POSTGRES_DB:blog
14+
healthcheck:
15+
test:pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB
16+
interval:10s
17+
timeout:5s
18+
start_period:10s
19+
retries:5
20+
pgadmin:
21+
image:dpage/pgadmin4:8.6
22+
restart:always
23+
ports:
24+
-"5050:80"
25+
volumes:
26+
-pgadmin_data:/var/lib/pgadmin
27+
-./docker/pgadmin/servers.json:/pgadmin4/servers.json
28+
-./docker/pgadmin/pgpass:/pgadmin4/pgpass
29+
environment:
30+
PGADMIN_DEFAULT_EMAIL:admin@admin.com
31+
PGADMIN_DEFAULT_PASSWORD:root
32+
PGADMIN_CONFIG_SERVER_MODE:"False"
33+
PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED:"False"
34+
healthcheck:
35+
test:wget --no-verbose --tries=1 --spider http://localhost:80/misc/ping || exit -1
36+
interval:10s
37+
timeout:5s
38+
start_period:10s
39+
retries:5
40+
entrypoint:/bin/sh -c "chmod 600 /pgadmin4/pgpass; /entrypoint.sh;"
41+
volumes:
42+
postgres_data:
43+
pgadmin_data:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
postgres:5432:blog:root:root
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"Servers" : {
3+
"1" : {
4+
"Group" :"Servers",
5+
"Name" :"postgres",
6+
"Host" :"postgres",
7+
"Port" :5432,
8+
"MaintenanceDB" :"blog",
9+
"Username" :"root",
10+
"PassFile" :"/pgadmin4/pgpass",
11+
"SSLMode" :"prefer"
12+
}
13+
}
14+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
CREATETABLEposts (
2+
idBIGINT GENERATED BY DEFAULTAS IDENTITYNOT NULL,
3+
created_byVARCHAR(255),
4+
created_dateTIMESTAMP WITHOUT TIME ZONE,
5+
last_modified_byVARCHAR(255),
6+
last_modified_dateTIMESTAMP WITHOUT TIME ZONE,
7+
titleVARCHAR(255)NOT NULL,
8+
textOIDNOT NULL,
9+
published_atTIMESTAMP WITHOUT TIME ZONE,
10+
author_idBIGINTNOT NULL,
11+
CONSTRAINT pk_postsPRIMARY KEY (id)
12+
);
13+
14+
CREATETABLEusers (
15+
idBIGINT GENERATED BY DEFAULTAS IDENTITYNOT NULL,
16+
created_byVARCHAR(255),
17+
created_dateTIMESTAMP WITHOUT TIME ZONE,
18+
last_modified_byVARCHAR(255),
19+
last_modified_dateTIMESTAMP WITHOUT TIME ZONE,
20+
first_nameVARCHAR(255)NOT NULL,
21+
last_nameVARCHAR(255)NOT NULL,
22+
emailVARCHAR(255),
23+
faxVARCHAR(255),
24+
last_activityTIMESTAMP WITHOUT TIME ZONE,
25+
CONSTRAINT pk_usersPRIMARY KEY (id)
26+
);
27+
28+
CREATEINDEXidx_user_namesON users(first_name, last_name);
29+
30+
ALTERTABLE posts ADDCONSTRAINT FK_POSTS_ON_AUTHORFOREIGN KEY (author_id)REFERENCES users (id);
42.4 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp