JunctionColumn class

Custom column for junction tables

Use this to add extra attributes to ManyToMany junction tables.

Example:

@ManyToMany(
  targetEntity: RoleEntity,
  joinTable: JoinTable(
    name: 'user_roles',
    joinColumn: JoinColumn(name: 'user_id'),
    inverseJoinColumn: JoinColumn(name: 'role_id'),
    extraColumns: [
      JunctionColumn(name: 'assigned_at', type: JunctionColumnType.timestamp, defaultValue: 'CURRENT_TIMESTAMP'),
      JunctionColumn(name: 'assigned_by', type: JunctionColumnType.integer, nullable: true),
      JunctionColumn(name: 'is_active', type: JunctionColumnType.boolean, defaultValue: 'true'),
    ],
  ),
)
List<RoleEntity>? roles;

Constructors

JunctionColumn({required String name, required JunctionColumnType type, bool nullable = false, String? defaultValue, bool unique = false})
const

Properties

defaultValue → String?
Default value (SQL expression as string)
final
hashCode → int
The hash code for this object.
no setterinherited
name → String
Column name
final
nullable → bool
Whether this column is nullable
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
type → JunctionColumnType
Column type
final
unique → bool
Whether this column should be unique
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited