Added: migrations
Fix: removed password field from entity and dto.
This commit is contained in:
parent
812957b93a
commit
ec8f49ea00
7 changed files with 61 additions and 41 deletions
|
|
@ -1,49 +1,63 @@
|
|||
plugins {
|
||||
java
|
||||
id("org.springframework.boot") version "3.5.3"
|
||||
id("io.spring.dependency-management") version "1.1.7"
|
||||
java
|
||||
id("org.springframework.boot") version "3.5.3"
|
||||
id("io.spring.dependency-management") version "1.1.7"
|
||||
id("org.flywaydb.flyway") version "11.10.0"
|
||||
}
|
||||
|
||||
group = "ru.team58"
|
||||
version = "0.0.1-SNAPSHOT"
|
||||
|
||||
flyway {
|
||||
url = "jdbc:postgresql://localhost:5432/userdb"
|
||||
user = "userdb"
|
||||
password = "1205"
|
||||
driver = "org.postgresql.Driver"
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(17)
|
||||
}
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(17)
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
compileOnly {
|
||||
extendsFrom(configurations.annotationProcessor.get())
|
||||
}
|
||||
compileOnly {
|
||||
extendsFrom(configurations.annotationProcessor.get())
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
buildscript {
|
||||
dependencies {
|
||||
classpath("org.flywaydb:flyway-database-postgresql:11.10.0")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
|
||||
implementation("org.springframework.boot:spring-boot-starter-security")
|
||||
implementation("org.springframework.boot:spring-boot-starter-web")
|
||||
implementation("org.flywaydb:flyway-core")
|
||||
implementation("org.mapstruct:mapstruct:1.6.3")
|
||||
implementation("org.postgresql:postgresql")
|
||||
implementation("org.flywaydb:flyway-database-postgresql")
|
||||
implementation("org.apache.logging.log4j:log4j-api:2.22.1")
|
||||
implementation("org.apache.logging.log4j:log4j-core:2.22.1")
|
||||
implementation("org.slf4j:slf4j-api:2.0.13")
|
||||
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.6")
|
||||
runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:2.22.1")
|
||||
annotationProcessor("org.mapstruct:mapstruct-processor:1.6.3")
|
||||
compileOnly("org.projectlombok:lombok")
|
||||
annotationProcessor("org.projectlombok:lombok")
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
||||
testImplementation("org.springframework.security:spring-security-test")
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
|
||||
implementation("org.springframework.boot:spring-boot-starter-security")
|
||||
implementation("org.springframework.boot:spring-boot-starter-web")
|
||||
implementation("org.flywaydb:flyway-core")
|
||||
implementation("org.flywaydb:flyway-database-postgresql:11.10.0")
|
||||
implementation("org.mapstruct:mapstruct:1.6.3")
|
||||
implementation("org.postgresql:postgresql")
|
||||
implementation("org.apache.logging.log4j:log4j-api:2.22.1")
|
||||
implementation("org.apache.logging.log4j:log4j-core:2.22.1")
|
||||
implementation("org.slf4j:slf4j-api:2.0.13")
|
||||
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.6")
|
||||
runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:2.22.1")
|
||||
annotationProcessor("org.mapstruct:mapstruct-processor:1.6.3")
|
||||
compileOnly("org.projectlombok:lombok")
|
||||
annotationProcessor("org.projectlombok:lombok")
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
||||
testImplementation("org.springframework.security:spring-security-test")
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
}
|
||||
|
||||
tasks.withType<Test> {
|
||||
useJUnitPlatform()
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package ru.team58.profileservice;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration;
|
||||
|
|
@ -9,9 +8,8 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
|||
|
||||
@SpringBootApplication(exclude = { SecurityAutoConfiguration.class })
|
||||
@EnableJpaRepositories
|
||||
@Slf4j
|
||||
public class ProfileserviceApplication {
|
||||
private static final Logger log = LoggerFactory.getLogger(ProfileserviceApplication.class);
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ProfileserviceApplication.class, args);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,5 +5,4 @@ public class CreateUserRequest {
|
|||
String firstName;
|
||||
String lastName;
|
||||
String email;
|
||||
String hashedPassword;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import ru.team58.profileservice.service.UserDTO;
|
|||
import java.util.UUID;
|
||||
|
||||
@Entity
|
||||
@Table(name = "user")
|
||||
@Table(name = "users")
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
|
|
@ -22,7 +22,7 @@ public class UserEntity {
|
|||
@Column(name = "username", nullable = false)
|
||||
String username;
|
||||
|
||||
@Column(name = "firstname", nullable = false)
|
||||
@Column(name = "firstName", nullable = false)
|
||||
String firstName;
|
||||
|
||||
@Column(name = "lastName", nullable = false)
|
||||
|
|
@ -30,7 +30,4 @@ public class UserEntity {
|
|||
|
||||
@Column(name = "email", nullable = false)
|
||||
String email;
|
||||
|
||||
@Column(name = "hashed_password", nullable = false)
|
||||
String hashed_password;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,5 +20,4 @@ public class UserDTO {
|
|||
String firstName;
|
||||
String lastName;
|
||||
String email;
|
||||
String hashedPassword;
|
||||
}
|
||||
|
|
@ -3,4 +3,10 @@ spring.application.name=profileservice
|
|||
## PostgreSQL
|
||||
spring.datasource.url=jdbc:postgresql://localhost:5432/userdb
|
||||
spring.datasource.username=userdb
|
||||
spring.datasource.password=1205
|
||||
spring.datasource.password=1205
|
||||
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
|
||||
## Flyway
|
||||
spring.flyway.enabled=true
|
||||
spring.flyway.locations=classpath:db.migration
|
||||
7
src/main/resources/db/migration/V1_0_0__CreateUser.sql
Normal file
7
src/main/resources/db/migration/V1_0_0__CreateUser.sql
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
CREATE TABLE IF NOT EXISTS "users" (
|
||||
"id" uuid PRIMARY KEY,
|
||||
"username" varchar,
|
||||
"firstName" varchar,
|
||||
"lastName" varchar,
|
||||
"email" varchar
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue