MssqlUniqueKeySchema constructor

MssqlUniqueKeySchema({
  1. required String name,
  2. required List<String> columns,
  3. required bool isPrimaryKey,
  4. bool isConstraint = false,
  5. bool isDisabled = false,
  6. String? filterSql,
  7. List<bool> nullable = const <bool>[],
  8. List<String?> collations = const <String?>[],
})

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.',
    );
  }
}