validateIntegrity method

  1. @override
VerificationContext validateIntegrity(
  1. Insertable<report> instance, {
  2. bool isInserting = false,
})

Validates that the given entity can be inserted into this table, meaning that it respects all constraints (nullability, text length, etc.).

Implementation

@override
VerificationContext validateIntegrity(Insertable<report> instance,
    {bool isInserting = false}) {
  final context = VerificationContext();
  final data = instance.toColumns(true);
  if (data.containsKey('id')) {
    context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
  }
  if (data.containsKey('date')) {
    context.handle(
        _dateMeta, date.isAcceptableOrUnknown(data['date']!, _dateMeta));
  } else if (isInserting) {
    context.missing(_dateMeta);
  }
  if (data.containsKey('exception')) {
    context.handle(_exceptionMeta,
        exception.isAcceptableOrUnknown(data['exception']!, _exceptionMeta));
  } else if (isInserting) {
    context.missing(_exceptionMeta);
  }
  if (data.containsKey('device_info')) {
    context.handle(
        _deviceInfoMeta,
        deviceInfo.isAcceptableOrUnknown(
            data['device_info']!, _deviceInfoMeta));
  } else if (isInserting) {
    context.missing(_deviceInfoMeta);
  }
  return context;
}