Added: migrations

Fix: removed password field from entity and dto.
This commit is contained in:
KamilM1205 2025-06-29 21:05:03 +04:00
parent 812957b93a
commit ec8f49ea00
7 changed files with 61 additions and 41 deletions

View file

@ -2,11 +2,19 @@ plugins {
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)
@ -23,14 +31,20 @@ repositories {
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.flywaydb:flyway-database-postgresql:11.10.0")
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")

View file

@ -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);
}

View file

@ -5,5 +5,4 @@ public class CreateUserRequest {
String firstName;
String lastName;
String email;
String hashedPassword;
}

View file

@ -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;
}

View file

@ -20,5 +20,4 @@ public class UserDTO {
String firstName;
String lastName;
String email;
String hashedPassword;
}

View file

@ -4,3 +4,9 @@ spring.application.name=profileservice
spring.datasource.url=jdbc:postgresql://localhost:5432/userdb
spring.datasource.username=userdb
spring.datasource.password=1205
spring.jpa.hibernate.ddl-auto=update
## Flyway
spring.flyway.enabled=true
spring.flyway.locations=classpath:db.migration

View file

@ -0,0 +1,7 @@
CREATE TABLE IF NOT EXISTS "users" (
"id" uuid PRIMARY KEY,
"username" varchar,
"firstName" varchar,
"lastName" varchar,
"email" varchar
);