Column class

Describes a column in a database table.

Available extensions

Constructors

Column({required String name, required ColumnType type, bool isPrimaryKey = false, bool isAutoIncrement = false, bool isNullable = false, bool isUnique = false, int length = 255, dynamic defaultValue, List<String>? options, String? comment, String? after, String? renamedFrom})
Creates a new Column definition.

Properties

after String?
Optional column name to place this column after when adding it to MySQL.
final
comment String?
Optional database-level comment for the column.
final
defaultValue → dynamic
The default value for the column, if any.
final
hashCode int
The hash code for this object.
no setteroverride
isAutoIncrement bool
Indicates whether the column is auto-incremented.
final
isNullable bool
Indicates whether the column can be null.
final
isPrimaryKey bool
Indicates whether the column is a primary key.
final
isUnique bool
Indicates whether the column must be unique.
final
length int
The length of the column (for applicable types like string).
final
name String
The name of the column.
final
options List<String>?
A list of allowed values (used for ENUM columns).
final
renamedFrom String?
Previous column name to rename from during migration.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type ColumnType
The data type of the column.
final

Methods

copyWith({String? name, ColumnType? type, int? length, bool? isPrimaryKey, bool? isAutoIncrement, bool? isNullable, bool? isUnique, dynamic defaultValue, List<String>? options, String? comment, String? after, String? renamedFrom}) Column
Returns a new Column with updated values while keeping immutability.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sqlTypeMySQL() String

Available on Column, provided by the ColumnSQL extension

sqlTypePostgres() String

Available on Column, provided by the ColumnSQL extension

toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override