options
Table options to be appended at the very end of the CREATE TABLE statement, after the closing parenthesis of the column definitions block.
Commonly used for MySQL/MariaDB ENGINE specification, charset settings, and other database-specific table options.
Exposed provides built-in option classes:
EngineOption - MySQL/MariaDB storage engine (InnoDB, MyISAM, MEMORY, etc.)
CharsetOption - Character set and collation
RawTableOption - Custom options as raw SQL strings for any database-specific setting
Important: Table options are only applied during table creation. They are not tracked by Exposed's migration system. If you change an option (e.g., from ENGINE=MyISAM to ENGINE=InnoDB), the migration system will not detect this change. You must manually create ALTER TABLE statements or recreate the table to apply option changes.
Example:
object Users : Table("users") {
val id = integer("id")
override val primaryKey = PrimaryKey(id)
override val options = listOf(
EngineOption(TableEngine.INNODB),
CharsetOption("utf8mb4"),
RawTableOption("ROW_FORMAT=COMPRESSED") // Custom option
)
}This will generate:
CREATE TABLE users (
id INT NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=COMPRESSEDThe table options appear after the ) that closes the column definitions.