fix(housekeeping): align audit log schema

Housekeeping audit writes used an obsolete housekeeping_log schema with operator_id, operator_name, target_user_id and ip columns, while the migration and list composer read actor_id, actor_name, target_type, target_id, target_label, action, detail and success. That made log inserts fail against migrated databases and made auto-created tables unreadable by the client. Align the writer and auto-create DDL with the action-log schema, preserve operator IP in detail, and add a contract test for schema drift.
This commit is contained in:
simoleo89
2026-06-13 15:44:09 +02:00
parent 2b18ca2deb
commit 98aab95d58
2 changed files with 55 additions and 25 deletions
@@ -0,0 +1,29 @@
package com.eu.habbo.habbohotel.modtool;
import org.junit.jupiter.api.Test;
import java.nio.file.Files;
import java.nio.file.Path;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
class HousekeepingAuditLogContractTest {
private static String auditLogSource() throws Exception {
return Files.readString(Path.of("src/main/java/com/eu/habbo/habbohotel/modtool/HousekeepingAuditLog.java"));
}
@Test
void writerUsesActionLogSchemaReadByHousekeepingClient() throws Exception {
String source = auditLogSource();
assertTrue(source.contains("actor_id"), "housekeeping_log writer must persist actor_id");
assertTrue(source.contains("actor_name"), "housekeeping_log writer must persist actor_name");
assertTrue(source.contains("target_type"), "housekeeping_log writer must persist target_type");
assertTrue(source.contains("target_id"), "housekeeping_log writer must persist target_id");
assertTrue(source.contains("target_label"), "housekeeping_log writer must persist target_label");
assertTrue(source.contains("success"), "housekeeping_log writer must persist success");
assertFalse(source.contains("operator_id"), "housekeeping_log writer must not use the obsolete operator_id schema");
assertFalse(source.contains("target_user_id"), "housekeeping_log writer must not use the obsolete target_user_id schema");
}
}