Class ScriptSchemaMigration

java.lang.Object
com.soulfiremc.server.script.ScriptSchemaMigration

public final class ScriptSchemaMigration extends Object
Handles migration of script node/edge JSON between schema versions. When the node/edge format changes, add a new migration step here and increment CURRENT_VERSION.
  • Field Details

    • CURRENT_VERSION

      public static final int CURRENT_VERSION
      The current schema version. Increment when making breaking changes to the node/edge JSON format.
      See Also:
  • Method Details

    • migrate

      public static ScriptSchemaMigration.MigrationResult migrate(int fromVersion, List<Map<String, com.google.gson.JsonElement>> nodes, List<Map<String, com.google.gson.JsonElement>> edges)
      Migrates nodes and edges from an older schema version to the current one. Returns the migrated data. If already at current version, returns unchanged.
      Parameters:
      fromVersion - the schema version of the data
      nodes - the raw node data
      edges - the raw edge data
      Returns:
      migrated node and edge data