diff --git a/build.gradle b/build.gradle index 15e5cf8..63d0b6c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,17 @@ +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'org.flywaydb:flyway-mysql:+' + } +} + plugins { id 'java' id 'org.springframework.boot' version '3.1.5' id 'io.spring.dependency-management' version '1.1.3' + id "org.flywaydb.flyway" version '+' } group = 'ybe.mini' @@ -41,6 +51,10 @@ dependencies { annotationProcessor "jakarta.annotation:jakarta.annotation-api" annotationProcessor "jakarta.persistence:jakarta.persistence-api" + //flyway + implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-mysql' + // validation implementation 'org.springframework.boot:spring-boot-starter-validation' @@ -79,4 +93,11 @@ tasks.withType(JavaCompile).configureEach { clean.doLast { file(querydslDir).deleteDir() +} + +flyway { + url = "jdbc:mysql://localhost:3303/travel" + user = "root" + password = "root" + cleanDisabled = false } \ No newline at end of file diff --git a/src/main/resources/application-core.yml b/src/main/resources/application-core.yml index 99a0de5..a429ba2 100644 --- a/src/main/resources/application-core.yml +++ b/src/main/resources/application-core.yml @@ -10,4 +10,11 @@ spring: enabled: true #표준 예외 폼 사용 web: resources: - add-mappings: false # 404오류 에 대해 리소스에서 접근하지 않고 예외로 던지기 \ No newline at end of file + add-mappings: false # 404오류 에 대해 리소스에서 접근하지 않고 예외로 던지기 + + flyway: + enabled: false + baseline-on-migrate: false + encoding: UTF-8 + outOfOrder: true + locations: classpath:db/migration \ No newline at end of file diff --git a/src/main/resources/db/migration/V1__initialize_project_tables.sql b/src/main/resources/db/migration/V1__initialize_project_tables.sql new file mode 100644 index 0000000..e69de29