Interface TableDefinition<R extends Record>
public interface TableDefinition<R extends Record>
A table to open with a schema version and migrations:
Table<Balance> balances = this.storage().define("balances", Balance.class)
.version(2)
.migrate(1, row -> new Balance(row.getLong("coins"), null))
.open();
-
Method Details
-
version
Schema version of the record, at least 1. Default: 1. -
migrate
How to turn a row stored with schema versionfrominto the current record. Needed when the stored version is older thanversion(int)or the record changed in a way that cannot be applied without data. -
open
Creates the table, or checks the stored one against the record and migrates it.- Throws:
StorageException- when the stored table does not match and no migration applies
-