MssqlUniqueKeySchema constructor
MssqlUniqueKeySchema({})
Implementation
MssqlUniqueKeySchema({
required this.name,
required List<String> columns,
required this.isPrimaryKey,
this.isConstraint = false,
this.isDisabled = false,
this.filterSql,
List<bool> nullable = const <bool>[],
List<String?> collations = const <String?>[],
}) : columns = List<String>.unmodifiable(columns),
nullable = List<bool>.unmodifiable(
nullable.isEmpty ? List<bool>.filled(columns.length, false) : nullable,
),
collations = List<String?>.unmodifiable(
collations.isEmpty
? List<String?>.filled(columns.length, null)
: collations,
) {
if (this.nullable.length != this.columns.length) {
throw ArgumentError.value(
nullable,
'nullable',
'Unique key "$name" has ${this.columns.length} columns and '
'${this.nullable.length} nullability flags.',
);
}
if (this.collations.length != this.columns.length) {
throw ArgumentError.value(
collations,
'collations',
'Unique key "$name" has ${this.columns.length} columns and '
'${this.collations.length} collations.',
);
}
}