storageParameters
Storage parameters to be included in the WITH clause at the very end of the CREATE TABLE statement, after the closing parenthesis of the column definitions block and after any table options.
Used by PostgreSQL, SQL Server, and other databases for storage-specific options.
Exposed provides built-in parameter classes:
FillFactorParameter - PostgreSQL fillfactor (10-100)
AutovacuumEnabledParameter - PostgreSQL autovacuum control
ToastTupleTargetParameter - PostgreSQL TOAST configuration
RawTableStorageParameter - Custom parameters as raw SQL strings for any database-specific setting
Important: Storage parameters are only applied during table creation. They are not tracked by Exposed's migration system. If you change a storage parameter (e.g., from fillfactor=70 to fillfactor=80), the migration system will not detect this change. You must manually create ALTER TABLE statements or use database-specific commands to apply storage parameter changes.
Example:
object Users : Table("users") {
val id = integer("id")
override val primaryKey = PrimaryKey(id)
override val storageParameters = listOf(
FillFactorParameter(70),
AutovacuumEnabledParameter(false),
RawTableStorageParameter("parallel_workers=4") // Custom parameter
)
}This will generate:
CREATE TABLE users (
id INT NOT NULL,
PRIMARY KEY (id)
) WITH (fillfactor=70, autovacuum_enabled=false, parallel_workers=4)The storage parameters appear in a WITH (...) clause after the ) that closes the column definitions.