Annotation Interface Schema


@Documented @Retention(RUNTIME) @Target(TYPE) public @interface Schema
The schema version of a storage record, read by ModStorage.table(String, Class) and ModStorage.define(String, Class); TableDefinition.version(int) overrides it. Records without it have version 1. The migrations from older versions are the record's Migrate methods.
@Schema(version = 2)
record Balance(long coins, @Nullable Instant lastPaid)
{
    @Migrate(from = 1)
    static Balance fromV1(Row row) {
       return new Balance(row.getLong("coins"), null);
    }
}
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    int
    At least 1.
  • Element Details

    • version

      int version
      At least 1.