Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to MySQL enum on Game VictoryCondition #934

Merged
merged 1 commit into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading