ColumnDefinition class
Represents a single column in a database table definition.
Constructors
- ColumnDefinition(String name, String type)
- Creates a new column definition.
Properties
- afterColumn → String?
-
no setter
- charsetValue → String?
-
no setter
- checkConstraint → String?
-
no setter
- collationValue → String?
-
no setter
- commentValue → String?
-
no setter
- defaultValue → dynamic
-
no setter
-
enumValues
→ List<
String> ? -
no setter
- foreignKey → String?
-
no setter
- foreignTable → String?
-
no setter
- generatedExpression → String?
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isAutoIncrement → bool
-
no setter
- isDefaultRaw → bool
-
no setter
- isFirst → bool
-
no setter
- isIndexed → bool
-
no setter
- isInvisible → bool
-
no setter
- isNullable → bool
-
no setter
- isPrimary → bool
-
no setter
- isStoredGenerated → bool
-
no setter
- isUnique → bool
-
no setter
- isUnsigned → bool
-
no setter
- lengthValue → int?
-
no setter
- name → String
-
The name of the column.
final
- oldName → String?
-
no setter
- onDeleteAction → String?
-
no setter
- onUpdateAction → String?
-
no setter
- precisionValue → int?
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scaleValue → int?
-
no setter
- type → String
-
The type of the column (e.g. 'INT', 'VARCHAR', 'DECIMAL').
final
- useCurrentOnUpdateValue → bool
-
no setter
Methods
-
after(
String column) → ColumnDefinition - Place the column "after" another column.
-
autoIncrement(
) → ColumnDefinition - Specifies the column as auto-incrementing.
-
cascadeOnDelete(
) → ColumnDefinition - Cascade on delete.
-
cascadeOnUpdate(
) → ColumnDefinition - Cascade on update.
-
charset(
String charset) → ColumnDefinition - Specifies the character set for the column.
-
check(
String condition) → ColumnDefinition - Specifies a check constraint for the column.
-
collation(
String collation) → ColumnDefinition - Specifies the collation for the column.
-
comment(
String text) → ColumnDefinition - Specifies a comment for the column.
-
commentIf(
bool condition, String text) → ColumnDefinition - Conditionally set a comment.
-
defaultFalse(
) → ColumnDefinition - Default to FALSE.
-
defaultNow(
) → ColumnDefinition - Default to CURRENT_TIMESTAMP.
-
defaultNull(
) → ColumnDefinition - Default to NULL.
-
defaultRaw(
String sql) → ColumnDefinition - Specifies a raw SQL default value for the column.
-
defaultsTo(
dynamic value) → ColumnDefinition - Specifies a default value for the column.
-
defaultTrue(
) → ColumnDefinition - Default to TRUE.
-
defaultVal(
dynamic value) → ColumnDefinition - Alias for defaultsTo.
-
enumVal(
List< String> values) → ColumnDefinition - Specifies the values for an ENUM column.
-
first(
) → ColumnDefinition - Place the column "first" in the table.
-
foreign(
String table, {String key = 'id'}) → ColumnDefinition - Specifies a foreign key constraint.
-
from(
String oldName) → ColumnDefinition - Rename the column from an old name (used in migrations).
-
index(
) → ColumnDefinition - Specifies an index for the column.
-
invisible(
) → ColumnDefinition - Specifies the column as invisible (MySQL 8.0+).
-
length(
int len) → ColumnDefinition - Specifies the length of the column (for string types).
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
nullable(
[bool value = true]) → ColumnDefinition - Specifies the column as nullable.
-
nullOnDelete(
) → ColumnDefinition - Set null on delete.
-
onDelete(
String action) → ColumnDefinition - Specifies the action to take when the foreign key is deleted.
-
onUpdate(
String action) → ColumnDefinition - Specifies the action to take when the foreign key is updated.
-
onUpdateCurrentTimestamp(
) → ColumnDefinition - Alias for useCurrentOnUpdate.
-
primary(
) → ColumnDefinition - Specifies the column as a primary key.
-
references(
String table, {String key = 'id'}) → ColumnDefinition - Alias for foreign.
-
required(
) → ColumnDefinition - Specifies the column as NOT NULL.
-
restrictOnDelete(
) → ColumnDefinition - Restrict on delete.
-
signed(
) → ColumnDefinition - Specifies the column as signed (removes UNSIGNED).
-
storedAs(
String expression) → ColumnDefinition - Create a stored generated column.
-
toString(
) → String -
A string representation of this object.
inherited
-
total(
int total, [int places = 0]) → ColumnDefinition - Specifies the precision and scale for decimal columns.
-
unique(
) → ColumnDefinition - Specifies the column as unique.
-
unsigned(
) → ColumnDefinition - Specifies the column as an unsigned integer.
-
useCurrent(
) → ColumnDefinition - Set the TIMESTAMP column to use CURRENT_TIMESTAMP as default.
-
useCurrentOnUpdate(
) → ColumnDefinition - Set the TIMESTAMP column to use CURRENT_TIMESTAMP on update.
-
virtualAs(
String expression) → ColumnDefinition - Create a virtual generated column.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited