createSimpleDbTable

open fun <T : DbTableData> createSimpleDbTable(tableDefinition: T, autoCreateSchema: Boolean = false)

The purpose of this function is to allow the creation of a simple database table based on a DbTableData data class. By defining a data class that is a subclasses of DbTableData, a limited CREATE TABLE specification can be obtained and the table created. Then, the database can be used to insert data from instances of the DbTableData subclass. The DbTableData data class cannot have a auto-increment type primary key. In addition, the table will not have foreign key specifications nor referential integrity specifications. If supported by the underlying database engine, additional specifications could be added via alter table DDL specifications.

Parameters

tableDefinition

a table definition based on DbTableData specifications. The specified table must not already exist in its specified schema.

autoCreateSchema

if true, if a table is in a schema that does not exist, the schema will automatically be created. The default is false. In which case, an error may occur if the schema does not exist to hold the table. Some databases do not support schemas. In that case, do not specify a schema for the table. Leave the schema null.