Skip to content

Commit

Permalink
Migrate to MySQL enum on Game VictoryCondition
Browse files Browse the repository at this point in the history
  • Loading branch information
Brutus5000 committed Feb 7, 2025
1 parent ef26b9c commit 7e9f545
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
@Configuration
public class MainDbTestContainers {
private static final MariaDBContainer<?> fafDBContainer = new MariaDBContainer<>("mariadb:10.6");
private static final GenericContainer<?> flywayMigrationsContainer = new GenericContainer<>("faforever/faf-db-migrations:v133");
private static final GenericContainer<?> flywayMigrationsContainer = new GenericContainer<>("faforever/faf-db-migrations:v136");
private static final Network sharedNetwork = Network.newNetwork();

@Bean
Expand Down
2 changes: 1 addition & 1 deletion src/inttest/resources/sql/prepGameData.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
INSERT INTO game_stats (id, startTime, gameName, gameType, gameMod, `host`, mapId, validity, replay_available)
VALUES (1, NOW(), 'Test game', '0', 6, 1, 1, 0, false);
VALUES (1, NOW(), 'Test game', 'DEMORALIZATION', 6, 1, 1, 0, false);

insert into game_review (id, text, user_id, score, game_id) VALUES (1, 'Awesome', 1, 5, 1);
insert into game_review (id, text, user_id, score, game_id) VALUES (2, 'Nice', 2, 3, 1);
Expand Down
2 changes: 1 addition & 1 deletion src/inttest/resources/sql/prepTeamkillData.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SET FOREIGN_KEY_CHECKS = 0;

INSERT INTO game_stats (id, startTime, gameName, gameType, gameMod, `host`, mapId, validity) VALUES
(1, NOW(), 'Test game', '0', 6, 1, 1, 0);
(1, NOW(), 'Test game', 'DEMORALIZATION', 6, 1, 1, 0);


SET FOREIGN_KEY_CHECKS = 1;
Expand Down

This file was deleted.

4 changes: 1 addition & 3 deletions src/main/java/com/faforever/api/data/domain/Game.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.faforever.api.data.domain;

import com.faforever.api.data.checks.Prefab;
import com.faforever.api.data.converter.VictoryConditionConverter;
import com.faforever.api.data.listeners.GameEnricher;
import com.yahoo.elide.annotation.ComputedAttribute;
import com.yahoo.elide.annotation.Include;
Expand All @@ -13,7 +12,6 @@
import org.jetbrains.annotations.Nullable;

import jakarta.persistence.Column;
import jakarta.persistence.Convert;
import jakarta.persistence.Entity;
import jakarta.persistence.EntityListeners;
import jakarta.persistence.EnumType;
Expand Down Expand Up @@ -77,7 +75,7 @@ public Long getReplayTicks() {
}

@Column(name = "gameType")
@Convert(converter = VictoryConditionConverter.class)
@Enumerated(EnumType.STRING)
public VictoryCondition getVictoryCondition() {
return victoryCondition;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ public enum VictoryCondition {
DEMORALIZATION,
DOMINATION,
ERADICATION,
SANDBOX;
SANDBOX,
DECAPITATION;
}
2 changes: 1 addition & 1 deletion src/main/resources/config/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ faf-api:
hmac-secret: ${CLOUDFLARE_HMAC_SECRET}
hmac-param: ${CLOUDFLARE_HMAC_PARAM:verify}
database:
schema-version: ${DATABASE_SCHEMA_VERSION:133}
schema-version: ${DATABASE_SCHEMA_VERSION:136}
deployment:
forged-alliance-exe-path: ${FORGED_ALLIANCE_EXE_PATH:/content/legacy-featured-mod-files/updates_faf_files/ForgedAlliance.exe}
repositories-directory: ${REPOSITORIES_DIRECTORY:/repositories}
Expand Down

0 comments on commit 7e9f545

Please sign in to comment.