Exposed 0.56.0 Help

Table types

In Exposed, the Table class is the core abstraction for defining database tables. This class provides methods to define various column types, constraints, and other table-specific properties.

Table is located in the org.jetbrains.exposed.sql package of the exposed-core module.

The following example defines a table with an auto-incrementing integer id column and a string name column:

import org.jetbrains.exposed.sql.Table object Cities : Table("cities") { val id = integer("id").autoIncrement() val name = varchar("name", 50) }
CREATE TABLE IF NOT EXISTS CITIES (ID INT AUTO_INCREMENT NOT NULL, "name" VARCHAR(50) NOT NULL)

For more information on defining and configuring tables in Exposed, see Working with tables.

Last modified: 30 October 2024