addColumn

abstract fun addColumn(newKQLiteColumn: KQLiteColumn<*>)

Adds a new column to an existing table.

This function generates and executes an ALTER TABLE ... ADD COLUMN ... SQL statement. The column's definition (name, data type, constraints) is derived from the provided newKQLiteColumn object.

Example

// Adds a new 'email' column to the 'Users' table.
// Assuming the `Users` table object now includes an `email` column definition.

// ALTER TABLE `Users` ADD COLUMN `email` TEXT NOT NULL DEFAULT '';
schema
.alterTable(Users)
.addColumn(Users.email)

Author

MOHAMMAD AZIM ANSARI

Parameters

newKQLiteColumn

The KQLiteColumn object representing the new column to be added. Its properties will be used to construct the column definition in the SQL statement.

See also