validateIntegrity method
- Insertable<
BackgroundRow> instance, { - bool isInserting = false,
override
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<BackgroundRow> instance,
{bool isInserting = false}) {
final context = VerificationContext();
final data = instance.toColumns(true);
if (data.containsKey('user_id')) {
context.handle(_userIdMeta,
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta));
} else if (isInserting) {
context.missing(_userIdMeta);
}
if (data.containsKey('data')) {
context.handle(
_dataMeta, this.data.isAcceptableOrUnknown(data['data']!, _dataMeta));
} else if (isInserting) {
context.missing(_dataMeta);
}
return context;
}