Add jwt service + add liquibase

This commit is contained in:
SebClem 2022-05-21 01:14:50 +02:00
parent 5248069a78
commit 116767f27f
Signed by: sebclem
GPG Key ID: 5A4308F6A359EA50
21 changed files with 714 additions and 225 deletions

View File

@ -3,6 +3,7 @@ plugins {
id 'io.spring.dependency-management' version '1.0.11.RELEASE' id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java' id 'java'
id 'groovy' id 'groovy'
id 'org.liquibase.gradle' version '2.0.4'
} }
@ -38,6 +39,8 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-log4j2") implementation("org.springframework.boot:spring-boot-starter-log4j2")
implementation("org.springframework.boot:spring-boot-starter-oauth2-client") implementation("org.springframework.boot:spring-boot-starter-oauth2-client")
implementation('org.liquibase:liquibase-core')
implementation('io.jsonwebtoken:jjwt-api:0.11.5') implementation('io.jsonwebtoken:jjwt-api:0.11.5')
implementation('io.jsonwebtoken:jjwt-impl:0.11.5') implementation('io.jsonwebtoken:jjwt-impl:0.11.5')
implementation('io.jsonwebtoken:jjwt-gson:0.11.5') implementation('io.jsonwebtoken:jjwt-gson:0.11.5')
@ -50,6 +53,8 @@ dependencies {
// JPA Data (We are going to use Repositories, Entities, Hibernate, etc...) // JPA Data (We are going to use Repositories, Entities, Hibernate, etc...)
implementation(platform("org.apache.logging.log4j:log4j-bom:2.17.1")) implementation(platform("org.apache.logging.log4j:log4j-bom:2.17.1"))
implementation group: 'org.hibernate', name: 'hibernate-validator', version: '7.0.4.Final'
// Use MySQL Connector-J // Use MySQL Connector-J
implementation 'mysql:mysql-connector-java' implementation 'mysql:mysql-connector-java'
implementation 'org.reflections:reflections:0.9.12' implementation 'org.reflections:reflections:0.9.12'
@ -59,8 +64,36 @@ dependencies {
implementation group: 'org.jsoup', name: 'jsoup', version: '1.13.1' implementation group: 'org.jsoup', name: 'jsoup', version: '1.13.1'
liquibaseRuntime 'org.liquibase:liquibase-core:4.2.2'
liquibaseRuntime 'org.liquibase:liquibase-groovy-dsl:2.1.1'
liquibaseRuntime 'mysql:mysql-connector-java:5.1.34'
liquibaseRuntime group: 'javax.xml.bind', name: 'jaxb-api', version: '2.3.1'
liquibaseRuntime group: 'org.liquibase.ext', name: 'liquibase-hibernate5', version: '4.10.0'
liquibaseRuntime 'org.springframework.boot:spring-boot-starter-data-jpa'
liquibaseRuntime 'org.springframework.data:spring-data-jpa'
liquibaseRuntime 'org.springframework:spring-beans'
liquibaseRuntime 'net.dv8tion:JDA:4.4.0_350'
liquibaseRuntime 'com.sedmelluq:lavaplayer:1.3.77'
liquibaseRuntime sourceSets.main.output
} }
apply plugin: "org.liquibase.gradle"
configurations {
liquibaseRuntime.extendsFrom runtime
}
liquibase {
activities {
main {
changeLogFile "src/main/resources/db/changelog/db.changelog-master.yml"
url System.getenv("DB_URL")
referenceUrl 'hibernate:spring:net.Broken?dialect=org.hibernate.dialect.MySQL5Dialect&hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy'
username System.getenv("DB_USER")
password System.getenv("DB_PWD")
}
}
}
class Version { class Version {
String major, minor, revision String major, minor, revision

View File

@ -1,28 +1,61 @@
package net.Broken.Api.Controllers; package net.Broken.Api.Controllers;
import net.Broken.Api.Data.Login; import net.Broken.Api.Data.Login;
import net.Broken.Api.Security.Services.JwtService;
import net.Broken.DB.Entity.UserEntity;
import net.Broken.DB.Repository.UserRepository;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Optional;
@RestController @RestController
@RequestMapping("/api/v2") @RequestMapping("/api/v2")
@CrossOrigin(origins = "*", maxAge = 3600)
public class AuthController { public class AuthController {
private final AuthenticationManager authenticationManager; private final AuthenticationManager authenticationManager;
public AuthController(AuthenticationManager authenticationManager) { private final UserRepository userRepository;
private final JwtService jwtService;
public AuthController(AuthenticationManager authenticationManager, UserRepository userRepository, JwtService jwtService) {
this.authenticationManager = authenticationManager; this.authenticationManager = authenticationManager;
this.userRepository = userRepository;
this.jwtService = jwtService;
} }
@PostMapping("login/discord") @PostMapping("login/discord")
public String helloUser(@RequestBody Login login) { public String loginDiscord(@Validated @RequestBody Login login) {
Authentication authentication = authenticationManager.authenticate( Authentication authentication = authenticationManager.authenticate(
new UsernamePasswordAuthenticationToken(login.redirectUri(), login.code()) new UsernamePasswordAuthenticationToken(login.redirectUri(), login.code())
); );
authentication.getPrincipal();
return "Hello User"; return "Hello User";
} }
@GetMapping("login/discord")
public String helloUsertest() {
Optional<UserEntity> user = userRepository.findById(5);
return jwtService.buildJwt(user.get());
}
@RequestMapping(
value = "/**",
method = RequestMethod.OPTIONS
)
public ResponseEntity handle() {
return new ResponseEntity(HttpStatus.OK);
}
} }

View File

@ -1,5 +1,8 @@
package net.Broken.Api.Data; package net.Broken.Api.Data;
public record Login (String code, String redirectUri){ import javax.validation.constraints.NotBlank;
public record Login(
@NotBlank String code, @NotBlank String redirectUri) {
} }

View File

@ -1,4 +1,4 @@
package net.Broken.Api.Security; package net.Broken.Api.Security.Components;
import net.Broken.Api.Security.Data.DiscordOauthUserInfo; import net.Broken.Api.Security.Data.DiscordOauthUserInfo;
import net.Broken.Api.Security.Exception.OAuthLoginFail; import net.Broken.Api.Security.Exception.OAuthLoginFail;
@ -17,7 +17,6 @@ import java.util.ArrayList;
@Component @Component
public class DiscordAuthenticationProvider implements AuthenticationProvider { public class DiscordAuthenticationProvider implements AuthenticationProvider {
private final Logger logger = LogManager.getLogger();
private final DiscordOauthService discordOauthService; private final DiscordOauthService discordOauthService;
public DiscordAuthenticationProvider(DiscordOauthService discordOauthService) { public DiscordAuthenticationProvider(DiscordOauthService discordOauthService) {
@ -34,7 +33,6 @@ public class DiscordAuthenticationProvider implements AuthenticationProvider {
discordOauthService.revokeToken(token); discordOauthService.revokeToken(token);
UserEntity userEntity = discordOauthService.loginOrRegisterDiscordUser(discordOauthUserInfo); UserEntity userEntity = discordOauthService.loginOrRegisterDiscordUser(discordOauthUserInfo);
return new UsernamePasswordAuthenticationToken(userEntity, null, new ArrayList<>()); return new UsernamePasswordAuthenticationToken(userEntity, null, new ArrayList<>());
} catch (OAuthLoginFail e) { } catch (OAuthLoginFail e) {
throw new BadCredentialsException("Bad response form Discord Oauth server ! Code expired ?"); throw new BadCredentialsException("Bad response form Discord Oauth server ! Code expired ?");
} }

View File

@ -1,4 +1,4 @@
package net.Broken.Api.Security.Services; package net.Broken.Api.Security.Components;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;

View File

@ -3,4 +3,6 @@ package net.Broken.Api.Security.Data;
public class DiscordOauthUserInfo { public class DiscordOauthUserInfo {
public String id; public String id;
public String username; public String username;
public String discriminator;
public String avatar;
} }

View File

@ -1,7 +1,6 @@
package net.Broken.Api.Security; package net.Broken.Api.Security;
import net.Broken.Api.Security.Services.UnauthorizedHandler; import net.Broken.Api.Security.Components.UnauthorizedHandler;
import net.Broken.DB.Repository.UserRepository;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.AuthenticationManager;

View File

@ -25,19 +25,19 @@ import java.util.Map;
public class DiscordOauthService { public class DiscordOauthService {
private final Logger logger = LogManager.getLogger(); private final Logger logger = LogManager.getLogger();
@Value("${discord.client-id}") @Value("${discord.oauth.client-id}")
private String clientId; private String clientId;
@Value("${discord.client-secret}") @Value("${discord.oauth.client-secret}")
private String clientSecret; private String clientSecret;
@Value("${discord.token-endpoint}") @Value("${discord.oauth.token-endpoint}")
private String tokenEndpoint; private String tokenEndpoint;
@Value("${discord.tokenRevokeEndpoint}") @Value("${discord.oauth.tokenRevokeEndpoint}")
private String tokenRevokeEndpoint; private String tokenRevokeEndpoint;
@Value("${discord.userInfoEnpoint}") @Value("${discord.oauth.userInfoEnpoint}")
private String userInfoEnpoint; private String userInfoEnpoint;
private final UserRepository userRepository; private final UserRepository userRepository;

View File

@ -0,0 +1,46 @@
package net.Broken.Api.Security.Services;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import io.jsonwebtoken.security.Keys;
import net.Broken.DB.Entity.UserEntity;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.security.Key;
import java.time.LocalDateTime;
import java.util.Calendar;
import java.util.Date;
@Service
public class JwtService {
@Value("${security.jwt.secret}")
private String jwtSecret;
private final Key jwtKey;
public JwtService() {
this.jwtKey = Keys.secretKeyFor(SignatureAlgorithm.HS256);
}
public String buildJwt(UserEntity user){
Date iat = new Date();
Date nbf = new Date();
Calendar expCal = Calendar.getInstance();
expCal.add(Calendar.DATE, 7);
Date exp = expCal.getTime();
return Jwts.builder()
.setSubject(user.getName())
.setId(user.getJdaId())
.setIssuedAt(iat)
.setNotBefore(nbf)
.setExpiration(exp)
.signWith(this.jwtKey)
.compact();
}
}

View File

@ -10,7 +10,7 @@ import javax.persistence.Id;
@Entity @Entity
public class GuildPreferenceEntity { public class GuildPreferenceEntity {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id; private Integer id;
private String guildId; private String guildId;

View File

@ -1,57 +0,0 @@
package net.Broken.DB.Entity;
import javax.persistence.*;
import java.util.Calendar;
import java.util.Date;
@Entity
public class PendingPwdResetEntity {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
@OneToOne
private UserEntity userEntity;
private String securityToken;
private Date expirationDate;
public PendingPwdResetEntity(UserEntity userEntity, String token) {
this.userEntity = userEntity;
this.securityToken = token;
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.HOUR, 24);
expirationDate = cal.getTime();
}
public PendingPwdResetEntity() {
}
public UserEntity getUserEntity() {
return userEntity;
}
public void setUserEntity(UserEntity userEntity) {
this.userEntity = userEntity;
}
public String getSecurityToken() {
return securityToken;
}
public void setSecurityToken(String securityToken) {
this.securityToken = securityToken;
}
public Date getExpirationDate() {
return expirationDate;
}
public void setExpirationDate(Date expirationDate) {
this.expirationDate = expirationDate;
}
}

View File

@ -1,76 +0,0 @@
package net.Broken.DB.Entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
/**
* Entity for DB. Represent user who not yet confirmed her account.
*/
@Entity
public class PendingUserEntity {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
private String name;
private String jdaId;
private String checkToken;
private String password;
public PendingUserEntity() {
}
public PendingUserEntity(String name, String jdaId, String checkToken, String password) {
this.name = name;
this.jdaId = jdaId;
this.checkToken = checkToken;
this.password = password;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getJdaId() {
return jdaId;
}
public void setJdaId(String jdaId) {
this.jdaId = jdaId;
}
public String getCheckToken() {
return checkToken;
}
public void setCheckToken(String checkToken) {
this.checkToken = checkToken;
}
}

View File

@ -12,7 +12,7 @@ import java.util.List;
public class PlaylistEntity { public class PlaylistEntity {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id; private Integer id;
private String name; private String name;

View File

@ -9,7 +9,7 @@ import javax.persistence.*;
public class TrackEntity { public class TrackEntity {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id; private Integer id;
private String title; private String title;

View File

@ -16,7 +16,7 @@ import java.util.List;
@Entity @Entity
public class UserEntity { public class UserEntity {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id; private Integer id;
private String name; private String name;

View File

@ -8,7 +8,7 @@ import javax.persistence.*;
public class UserStats { public class UserStats {
@Id @Id
@GeneratedValue(strategy = GenerationType.AUTO) @GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id; private Long id;

View File

@ -1,11 +0,0 @@
package net.Broken.DB.Repository;
import net.Broken.DB.Entity.PendingPwdResetEntity;
import net.Broken.DB.Entity.UserEntity;
import org.springframework.data.repository.CrudRepository;
import java.util.List;
public interface PendingPwdResetRepository extends CrudRepository<PendingPwdResetEntity, Integer> {
List<PendingPwdResetEntity> findByUserEntity(UserEntity userEntity);
}

View File

@ -1,17 +0,0 @@
package net.Broken.DB.Repository;
import net.Broken.DB.Entity.PendingUserEntity;
import org.springframework.data.repository.CrudRepository;
import java.util.List;
/**
* Repository for PendingUserEntity
*/
public interface PendingUserRepository extends CrudRepository<PendingUserEntity, Integer> {
List<PendingUserEntity> findByJdaId(String jdaId);
PendingUserEntity findById(int id);
}

View File

@ -1,24 +1,10 @@
package net.Broken.Tools.UserManager; package net.Broken.Tools.UserManager;
import net.Broken.DB.Entity.PendingUserEntity;
import net.Broken.DB.Entity.UserEntity; import net.Broken.DB.Entity.UserEntity;
import net.Broken.DB.Repository.PendingUserRepository;
import net.Broken.DB.Repository.UserRepository; import net.Broken.DB.Repository.UserRepository;
import net.Broken.MainBot;
import net.Broken.RestApi.Data.UserManager.UserInfoData;
import net.Broken.Tools.EmbedMessageUtils;
import net.Broken.Tools.ResourceLoader;
import net.Broken.Tools.UserManager.Exceptions.*; import net.Broken.Tools.UserManager.Exceptions.*;
import net.dv8tion.jda.api.entities.MessageEmbed;
import net.dv8tion.jda.api.entities.User;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.springframework.security.crypto.password.PasswordEncoder;
import java.io.FileNotFoundException;
import java.security.SecureRandom;
import java.util.List;
import java.util.UUID;
public class UserUtils { public class UserUtils {

View File

@ -3,39 +3,22 @@ spring:
username: ${DB_USER} username: ${DB_USER}
url: ${DB_URL} url: ${DB_URL}
password: ${DB_PWD} password: ${DB_PWD}
thymeleaf: liquibase:
cache: 'true' change-log: classpath:db/changelog/db.changelog-master.yml
jpa:
hibernate:
ddl-auto: update
security:
oauth2:
client:
registration:
discord:
client-id: ${CLIENT_ID}
client-secret: ${CLIENT_SECRET}
clientAuthenticationMethod: post
authorizationGrantType: authorization_code
scope:
- identify
redirect-uri: "http://localhost:8080/login/oauth2/code/discord"
clientName: FourScouts client
provider:
discord:
authorizationUri: https://discordapp.com/api/oauth2/authorize
tokenUri: https://discordapp.com/api/oauth2/token
userInfoUri: https://discordapp.com/api/users/@me
userNameAttribute: username
server: server:
compression: compression:
enabled: 'true' enabled: true
mime-types: application/json,application/xml,text/html,text/xml,text/plain,application/javascript,text/css mime-types: application/json,application/xml,text/html,text/xml,text/plain,application/javascript,text/css
port: ${PORT} port: ${PORT}
http2: http2:
enabled: 'true' enabled: true
security:
jwt:
secret: ${JWT_SECRET}
discord: discord:
oauth:
client-id: ${CLIENT_ID} client-id: ${CLIENT_ID}
client-secret: ${CLIENT_SECRET} client-secret: ${CLIENT_SECRET}
token-endpoint: https://discord.com/api/oauth2/token token-endpoint: https://discord.com/api/oauth2/token

View File

@ -0,0 +1,567 @@
databaseChangeLog:
- changeSet:
id: 1653065037086-1
author: seb65 (generated)
changes:
- createTable:
columns:
- column:
autoIncrement: true
constraints:
nullable: false
primaryKey: true
name: id
type: INT
- column:
constraints:
nullable: false
name: anti_spam
type: BIT
- column:
constraints:
nullable: false
name: default_role
type: BIT
- column:
name: default_role_id
type: VARCHAR(255)
- column:
name: guild_id
type: VARCHAR(255)
- column:
constraints:
nullable: false
name: welcome
type: BIT
- column:
name: welcome_chanelid
type: VARCHAR(255)
- column:
name: welcome_message
type: VARCHAR(255)
- column:
constraints:
nullable: false
name: daily_madame
type: BIT
- column:
constraints:
nullable: false
name: auto_voice
type: BIT
- column:
name: auto_voice_channelid
type: VARCHAR(255)
- column:
name: auto_voice_channel_title
type: VARCHAR(255)
tableName: guild_preference_entity
- changeSet:
id: 1653065037086-2
author: seb65 (generated)
changes:
- createTable:
columns:
- column:
constraints:
nullable: false
name: guild_preference_entity_id
type: INT
- column:
name: visible_voice_chanel
type: VARCHAR(255)
tableName: guild_preference_entity_visible_voice_chanel
- changeSet:
id: 1653065037086-3
author: seb65 (generated)
changes:
- createSequence:
columns:
- column:
defaultValueComputed: 'NULL'
name: next_val
type: BIGINT
tableName: hibernate_sequence
- changeSet:
id: 1653065037086-4
author: seb65 (generated)
changes:
- createTable:
columns:
- column:
autoIncrement: true
constraints:
nullable: false
primaryKey: true
name: id
type: INT
- column:
defaultValueComputed: 'NULL'
name: expiration_date
type: datetime
- column:
name: security_token
type: VARCHAR(255)
- column:
defaultValueComputed: 'NULL'
name: user_entity_id
type: INT
tableName: pending_pwd_reset_entity
- changeSet:
id: 1653065037086-5
author: seb65 (generated)
changes:
- createTable:
columns:
- column:
autoIncrement: true
constraints:
nullable: false
primaryKey: true
name: id
type: INT
- column:
name: check_token
type: VARCHAR(255)
- column:
name: jda_id
type: VARCHAR(255)
- column:
name: name
type: VARCHAR(255)
- column:
name: password
type: VARCHAR(255)
tableName: pending_user_entity
- changeSet:
id: 1653065037086-6
author: seb65 (generated)
changes:
- createTable:
columns:
- column:
autoIncrement: true
constraints:
nullable: false
primaryKey: true
name: id
type: INT
- column:
name: name
type: VARCHAR(255)
- column:
constraints:
nullable: false
name: user_entity_id
type: INT
tableName: playlist_entity
- changeSet:
id: 1653065037086-7
author: seb65 (generated)
changes:
- createTable:
columns:
- column:
autoIncrement: true
constraints:
nullable: false
primaryKey: true
name: id
type: INT
- column:
name: identifier
type: VARCHAR(255)
- column:
defaultValueComputed: 'NULL'
name: pos
type: INT
- column:
name: title
type: VARCHAR(255)
- column:
name: url
type: VARCHAR(255)
- column:
constraints:
nullable: false
name: playlist_entity_id
type: INT
tableName: track_entity
- changeSet:
id: 1653065037086-8
author: seb65 (generated)
changes:
- createTable:
columns:
- column:
autoIncrement: true
constraints:
nullable: false
primaryKey: true
name: id
type: INT
- column:
name: api_token
type: VARCHAR(255)
- column:
name: jda_id
type: VARCHAR(255)
- column:
name: name
type: VARCHAR(255)
- column:
name: password
type: VARCHAR(255)
- column:
constraints:
nullable: false
name: is_bot_admin
type: BIT
tableName: user_entity
- changeSet:
id: 1653065037086-9
author: seb65 (generated)
changes:
- createTable:
columns:
- column:
autoIncrement: true
constraints:
nullable: false
primaryKey: true
name: id
type: BIGINT
- column:
defaultValueNumeric: 0
name: api_command_count
type: BIGINT
- column:
name: guild_id
type: VARCHAR(255)
- column:
defaultValueNumeric: 0
name: message_count
type: BIGINT
- column:
defaultValueNumeric: 0
name: vocal_time
type: BIGINT
- column:
constraints:
nullable: false
name: user_entity_id
type: INT
tableName: user_stats
- changeSet:
id: 1653065037086-10
author: seb65 (generated)
changes:
- createIndex:
columns:
- column:
defaultValueComputed: 'NULL'
name: user_entity_id
indexName: FKatrj670ooxj9qiq230iacbt68
tableName: pending_pwd_reset_entity
- changeSet:
id: 1653065037086-11
author: seb65 (generated)
changes:
- createIndex:
columns:
- column:
name: user_entity_id
indexName: FKi0pu9fhjbhs223glek7baeuwm
tableName: playlist_entity
- changeSet:
id: 1653065037086-12
author: seb65 (generated)
changes:
- createIndex:
columns:
- column:
name: playlist_entity_id
indexName: FKjrr0flblumxnll3re0apujvr
tableName: track_entity
- changeSet:
id: 1653065037086-13
author: seb65 (generated)
changes:
- createIndex:
columns:
- column:
name: user_entity_id
indexName: FKjvpcyocfa9h3ybvr5loj4lfbk
tableName: user_stats
- changeSet:
id: 1653065037086-14
author: seb65 (generated)
changes:
- createIndex:
columns:
- column:
name: guild_preference_entity_id
indexName: FKlyf6ksd3969rqtwm3bqupbniu
tableName: guild_preference_entity_visible_voice_chanel
- changeSet:
id: 1653065037086-15
author: seb65 (generated)
changes:
- addForeignKeyConstraint:
baseColumnNames: user_entity_id
baseTableName: pending_pwd_reset_entity
constraintName: FKatrj670ooxj9qiq230iacbt68
deferrable: false
initiallyDeferred: false
onDelete: RESTRICT
onUpdate: RESTRICT
referencedColumnNames: id
referencedTableName: user_entity
validate: true
- changeSet:
id: 1653065037086-16
author: seb65 (generated)
changes:
- addForeignKeyConstraint:
baseColumnNames: user_entity_id
baseTableName: playlist_entity
constraintName: FKi0pu9fhjbhs223glek7baeuwm
deferrable: false
initiallyDeferred: false
onDelete: RESTRICT
onUpdate: RESTRICT
referencedColumnNames: id
referencedTableName: user_entity
validate: true
- changeSet:
id: 1653065037086-17
author: seb65 (generated)
changes:
- addForeignKeyConstraint:
baseColumnNames: playlist_entity_id
baseTableName: track_entity
constraintName: FKjrr0flblumxnll3re0apujvr
deferrable: false
initiallyDeferred: false
onDelete: RESTRICT
onUpdate: RESTRICT
referencedColumnNames: id
referencedTableName: playlist_entity
validate: true
- changeSet:
id: 1653065037086-18
author: seb65 (generated)
changes:
- addForeignKeyConstraint:
baseColumnNames: user_entity_id
baseTableName: user_stats
constraintName: FKjvpcyocfa9h3ybvr5loj4lfbk
deferrable: false
initiallyDeferred: false
onDelete: RESTRICT
onUpdate: RESTRICT
referencedColumnNames: id
referencedTableName: user_entity
validate: true
- changeSet:
id: 1653065037086-19
author: seb65 (generated)
changes:
- addForeignKeyConstraint:
baseColumnNames: guild_preference_entity_id
baseTableName: guild_preference_entity_visible_voice_chanel
constraintName: FKlyf6ksd3969rqtwm3bqupbniu
deferrable: false
initiallyDeferred: false
onDelete: RESTRICT
onUpdate: RESTRICT
referencedColumnNames: id
referencedTableName: guild_preference_entity
validate: true
databaseChangeLog:
- changeSet:
id: 1653073535100-14
author: seb65 (generated)
changes:
- addUniqueConstraint:
columnNames: jda_id
constraintName: UC_USER_ENTITYJDA_ID_COL
tableName: user_entity
- changeSet:
id: 1653073535100-15
author: seb65 (generated)
changes:
- dropForeignKeyConstraint:
baseTableName: pending_pwd_reset_entity
constraintName: FKatrj670ooxj9qiq230iacbt68
- changeSet:
id: 1653073535100-16
author: seb65 (generated)
changes:
- dropForeignKeyConstraint:
baseTableName: guild_preference_entity_visible_voice_chanel
constraintName: FKlyf6ksd3969rqtwm3bqupbniu
- changeSet:
id: 1653073535100-17
author: seb65 (generated)
changes:
- dropTable:
tableName: guild_preference_entity_visible_voice_chanel
- changeSet:
id: 1653073535100-18
author: seb65 (generated)
changes:
- dropTable:
tableName: hibernate_sequence
- changeSet:
id: 1653073535100-19
author: seb65 (generated)
changes:
- dropTable:
tableName: pending_pwd_reset_entity
- changeSet:
id: 1653073535100-20
author: seb65 (generated)
changes:
- dropTable:
tableName: pending_user_entity
- changeSet:
id: 1653073535100-21
author: seb65 (generated)
changes:
- dropColumn:
columnName: api_token
tableName: user_entity
- changeSet:
id: 1653073535100-22
author: seb65 (generated)
changes:
- dropColumn:
columnName: password
tableName: user_entity
- changeSet:
id: 1653073535100-1
author: seb65 (generated)
changes:
- dropDefaultValue:
columnDataType: varchar(255)
columnName: auto_voice_channel_title
tableName: guild_preference_entity
- changeSet:
id: 1653073535100-2
author: seb65 (generated)
changes:
- dropDefaultValue:
columnDataType: varchar(255)
columnName: auto_voice_channelid
tableName: guild_preference_entity
- changeSet:
id: 1653073535100-3
author: seb65 (generated)
changes:
- dropDefaultValue:
columnDataType: varchar(255)
columnName: default_role_id
tableName: guild_preference_entity
- changeSet:
id: 1653073535100-4
author: seb65 (generated)
changes:
- dropDefaultValue:
columnDataType: varchar(255)
columnName: guild_id
tableName: guild_preference_entity
- changeSet:
id: 1653073535100-5
author: seb65 (generated)
changes:
- dropDefaultValue:
columnDataType: varchar(255)
columnName: guild_id
tableName: user_stats
- changeSet:
id: 1653073535100-6
author: seb65 (generated)
changes:
- dropDefaultValue:
columnDataType: varchar(255)
columnName: identifier
tableName: track_entity
- changeSet:
id: 1653073535100-7
author: seb65 (generated)
changes:
- dropDefaultValue:
columnDataType: varchar(255)
columnName: jda_id
tableName: user_entity
- changeSet:
id: 1653073535100-8
author: seb65 (generated)
changes:
- dropDefaultValue:
columnDataType: varchar(255)
columnName: name
tableName: playlist_entity
- changeSet:
id: 1653073535100-9
author: seb65 (generated)
changes:
- dropDefaultValue:
columnDataType: varchar(255)
columnName: name
tableName: user_entity
- changeSet:
id: 1653073535100-10
author: seb65 (generated)
changes:
- dropDefaultValue:
columnDataType: varchar(255)
columnName: title
tableName: track_entity
- changeSet:
id: 1653073535100-11
author: seb65 (generated)
changes:
- dropDefaultValue:
columnDataType: varchar(255)
columnName: url
tableName: track_entity
- changeSet:
id: 1653073535100-12
author: seb65 (generated)
changes:
- dropDefaultValue:
columnDataType: varchar(255)
columnName: welcome_chanelid
tableName: guild_preference_entity
- changeSet:
id: 1653073535100-13
author: seb65 (generated)
changes:
- dropDefaultValue:
columnDataType: varchar(255)
columnName: welcome_message
tableName: guild_preference_entity
databaseChangeLog:
- changeSet:
id: 1653086152139-1
author: seb65 (generated)
preConditions:
onFail: MARK_RAN
tableExists:
tableName: hibernate_sequence
changes:
- dropTable:
tableName: hibernate_sequence
- createSequence:
cycle: false
ordered: true
sequenceName: hibernate_sequence
startValue: 23608
databaseChangeLog: []