Enum Class SchemaInitialization
- All Implemented Interfaces:
Serializable,Comparable<SchemaInitialization>,Constable
PostgresqlEventStorageEngine ensures its PostgreSQL schema (tables, sequence,
indices, and internal migrations) is present when it is constructed.
Writing events against a schema that is not fully up to date can corrupt data in ways that are hard to recover from -- an incomplete schema can silently produce corrupted or incomplete data instead of failing outright. The options below trade off startup cost and self-healing behavior against that risk.
- Since:
- 5.4.0
- Author:
- John Hendrikx
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionChecks whether the schema is complete, and creates or repairs whatever is missing (tables, sequence, indices, and internal migrations).Skips all schema checks.Checks whether the schema is complete, and fails construction with anIllegalStateExceptionif it is not. -
Method Summary
Modifier and TypeMethodDescriptionstatic SchemaInitializationReturns the enum constant of this class with the specified name.static SchemaInitialization[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
CREATE_IF_MISSING
Checks whether the schema is complete, and creates or repairs whatever is missing (tables, sequence, indices, and internal migrations). This is the default.When the schema is already complete, this only performs cheap existence checks and does not lock any of the event store's tables. When something is missing, the (idempotent) creation statements run, which do briefly lock the affected tables.
-
VALIDATE
Checks whether the schema is complete, and fails construction with anIllegalStateExceptionif it is not. Never creates or modifies anything.Use this when schema changes are managed out-of-band (e.g. by a dedicated migration step or a database administrator) and an incomplete schema should be treated as a startup failure rather than something the application silently repairs.
-
SKIP
Skips all schema checks. The schema is assumed to already be complete and correct.This avoids any database round trip or locking at construction time, but writing events against a schema that is not actually complete can corrupt data, as described in this enum's class-level documentation. Only use this once the schema is known to be up to date, for example after a rolling deployment where earlier instances have already migrated it.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-