validateIntegrity method
- Insertable<
VersionRow> 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<VersionRow> 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('favorite_chats_list_version')) {
context.handle(
_favoriteChatsListVersionMeta,
favoriteChatsListVersion.isAcceptableOrUnknown(
data['favorite_chats_list_version']!,
_favoriteChatsListVersionMeta));
}
if (data.containsKey('favorite_chats_synchronized')) {
context.handle(
_favoriteChatsSynchronizedMeta,
favoriteChatsSynchronized.isAcceptableOrUnknown(
data['favorite_chats_synchronized']!,
_favoriteChatsSynchronizedMeta));
}
if (data.containsKey('chat_contacts_list_version')) {
context.handle(
_chatContactsListVersionMeta,
chatContactsListVersion.isAcceptableOrUnknown(
data['chat_contacts_list_version']!,
_chatContactsListVersionMeta));
}
if (data.containsKey('favorite_contacts_synchronized')) {
context.handle(
_favoriteContactsSynchronizedMeta,
favoriteContactsSynchronized.isAcceptableOrUnknown(
data['favorite_contacts_synchronized']!,
_favoriteContactsSynchronizedMeta));
}
if (data.containsKey('contacts_synchronized')) {
context.handle(
_contactsSynchronizedMeta,
contactsSynchronized.isAcceptableOrUnknown(
data['contacts_synchronized']!, _contactsSynchronizedMeta));
}
if (data.containsKey('blocklist_synchronized')) {
context.handle(
_blocklistSynchronizedMeta,
blocklistSynchronized.isAcceptableOrUnknown(
data['blocklist_synchronized']!, _blocklistSynchronizedMeta));
}
if (data.containsKey('sessions_list_version')) {
context.handle(
_sessionsListVersionMeta,
sessionsListVersion.isAcceptableOrUnknown(
data['sessions_list_version']!, _sessionsListVersionMeta));
}
if (data.containsKey('blocklist_version')) {
context.handle(
_blocklistVersionMeta,
blocklistVersion.isAcceptableOrUnknown(
data['blocklist_version']!, _blocklistVersionMeta));
}
if (data.containsKey('blocklist_count')) {
context.handle(
_blocklistCountMeta,
blocklistCount.isAcceptableOrUnknown(
data['blocklist_count']!, _blocklistCountMeta));
}
return context;
}