Skip to content

Photos 4 database schema

Rhet Turnbull edited this page Oct 4, 2020 · 3 revisions

The schema for Photos version 4 databases, as produced by sqlite3 photos.db ".schema" is:

CREATE TABLE LiGlobals (
    modelId integer primary key,
    keyPath varchar,
    value varchar,
    blobValue blob
);

CREATE TABLE LiLibHistory (
    modelId integer primary key,
    modDate timestamp,
    eventType varchar,
    metaSchemaVersion integer,
    libraryVersion integer,
    comment varchar
);

CREATE TABLE LiStringAtom (modelId integer primary key, string varchar);

CREATE TABLE LiTableDef (
    modelId integer primary key,
    tableName varchar,
    databaseName varchar,
    digest varchar,
    ridIndexField varchar,
    tableOptions integer
);

CREATE TABLE LiPropertyDef (
    modelId integer primary key,
    keyPath varchar,
    tableId integer,
    propertyType integer,
    storage integer,
    desiredStorage integer,
    options integer
);

CREATE TABLE LiPropertyHistory (
    modelId integer primary key,
    tableId integer,
    modDate timestamp,
    originatingClient integer,
    changeId integer,
    keyPathList blob,
    changeType integer,
    memo varchar,
    reason integer,
    changeIdList blob
);

CREATE TABLE RKAdjustmentData (
    modelId integer primary key autoincrement,
    uuid varchar,
    versionId integer,
    data blob,
    originator varchar,
    format varchar,
    formatVersion varchar,
    fingerprint varchar,
    orientation integer,
    editSource integer,
    naturalDuration decimal,
    renderTypes integer
);

CREATE TABLE sqlite_sequence(name, seq);

CREATE TABLE RKAdjustmentData_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKAdminData (
    modelId integer primary key autoincrement,
    propertyArea varchar,
    propertyName varchar,
    propertyValue varchar,
    blobPropertyValue blob,
    storedDataType integer,
    persistAfterRebuild integer
);

CREATE TABLE RKAdminData_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKAlbum (
    modelId integer primary key autoincrement,
    uuid varchar,
    albumType integer,
    albumSubclass integer,
    name varchar,
    folderUuid varchar,
    queryFolderUuid varchar,
    posterVersionUuid varchar,
    selectedTrackPathUuid varchar,
    sortKeyPath varchar,
    sortAscending integer,
    customSortAvailable integer,
    createDate timestamp,
    isFavorite integer,
    isInTrash integer,
    inTrashDate timestamp,
    isHidden integer,
    isMagic integer,
    colorLabelIndex integer,
    faceSortKeyPath varchar,
    recentUserChangeDate timestamp,
    filterData blob,
    queryData blob,
    isPinned integer,
    cloudLibraryState integer,
    hasBeenSynced integer,
    cloudIdentifier varchar,
    isCloudQuarantined integer,
    projectExtensionIdentifier varchar,
    projectDocumentType varchar,
    projectExtensionRenderedPreviewUuid varchar
);

CREATE TABLE RKAlbum_dataNote (
    keyPath integer,
    value blob,
    attachedToId integer,
    primary key (attachedToId, keyPath)
);

CREATE TABLE RKAlbum_stringNote (
    keyPath integer,
    value varchar,
    attachedToId integer,
    primary key (attachedToId, keyPath)
);

CREATE TABLE RKAlbum_integerNote (
    keyPath integer,
    value integer,
    attachedToId integer,
    primary key (attachedToId, keyPath)
);

CREATE TABLE RKAlbum_decimalNote (
    keyPath integer,
    value decimal,
    attachedToId integer,
    primary key (attachedToId, keyPath)
);

CREATE TABLE RKAlbum_dateNote (
    keyPath integer,
    value timestamp,
    attachedToId integer,
    primary key (attachedToId, keyPath)
);

CREATE TABLE RKAlbum_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKAlbum_albumType_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKAlbum_albumSubclass_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKAlbum_isInTrash_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKAlbum_isHidden_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKAlbum_isMagic_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKAlbum_cloudLibraryState_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKAlbum_hasBeenSynced_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKAlbum_isCloudQuarantined_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKAlbumVersion (
    modelId integer primary key autoincrement,
    versionId integer,
    albumId integer
);

CREATE TABLE RKAlbumVersion_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKAlbumVersion_albumId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKAttachment (
    modelId integer primary key autoincrement,
    uuid varchar,
    isInTrash integer,
    inTrashDate timestamp,
    attachedToClassType integer,
    attachedToUuid varchar,
    propertyKey varchar,
    filename varchar,
    fileIsReference integer,
    isMissing integer,
    duration decimal,
    fileModificationDate timestamp,
    filePath varchar,
    fileAliasData blob,
    propertiesData blob,
    bookmarkId integer,
    volumeId integer
);

CREATE TABLE RKAttachment_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKBookmark (
    modelId integer primary key autoincrement,
    data blob
);

CREATE TABLE RKBookmark_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKCloudResource (
    modelId integer primary key autoincrement,
    fingerprint varchar,
    associatedModelType integer,
    identifier varchar,
    type integer,
    available integer,
    status integer,
    fileSize integer,
    width integer,
    height integer,
    lastAccessDate timestamp,
    pinnedUntilDate timestamp,
    UTI integer,
    transientFilePath varchar,
    isOnDisk integer,
    adjustmentUuid varchar,
    baseScore integer,
    isFullSizeOutput integer
);

CREATE TABLE RKCloudResource_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKCloudResource_type_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKCloudResource_available_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKCloudResource_status_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKCloudResource_isOnDisk_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKCloudResource_isFullSizeOutput_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKCustomSortOrder (
    modelId integer primary key autoincrement,
    containerUuid varchar,
    objectUuid varchar,
    orderNumber integer
);

CREATE TABLE RKCustomSortOrder_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFace (
    modelId integer primary key autoincrement,
    uuid varchar,
    isInTrash integer,
    personId integer,
    hasBeenSynced integer,
    adjustmentUuid varchar,
    imageModelId integer,
    sourceWidth integer,
    sourceHeight integer,
    centerX decimal,
    centerY decimal,
    size decimal,
    leftEyeX decimal,
    leftEyeY decimal,
    rightEyeX decimal,
    rightEyeY decimal,
    mouthX decimal,
    mouthY decimal,
    hidden integer,
    manual integer,
    hasSmile integer,
    blurScore decimal,
    isLeftEyeClosed integer,
    isRightEyeClosed integer,
    nameSource integer,
    poseRoll decimal,
    poseYaw decimal,
    posePitch decimal,
    faceAlgorithmVersion integer,
    expressionConfidence decimal,
    expressionType1 integer,
    expressionType2 integer,
    expressionType3 integer,
    expressionScore1 decimal,
    expressionScore2 decimal,
    expressionScore3 decimal,
    qualityMeasure integer,
    clusterSequenceNumber integer,
    syncPropertyModifiedDate timestamp,
    faceGroupId integer,
    confirmedFaceCropGenerationState integer,
    faceType integer,
    trainingType integer,
    cloudNameSource integer,
    personUuid varchar
);

CREATE TABLE RKFace_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFace_isInTrash_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFace_hasBeenSynced_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFace_hidden_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFace_manual_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFace_nameSource_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFace_faceAlgorithmVersion_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFace_confirmedFaceCropGenerationState_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFace_faceType_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFace_trainingType_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFaceCrop (
    modelId integer primary key autoincrement,
    uuid varchar,
    personId integer,
    cloudLibraryState integer,
    hasBeenSynced integer,
    cloudIdentifier varchar,
    isCloudQuarantined integer,
    type integer,
    faceId integer,
    resourceData blob,
    faceCropType integer,
    state integer,
    invalidMergeCandidatePersonIdentifier varchar
);

CREATE TABLE RKFaceCrop_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFaceCrop_cloudLibraryState_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFaceCrop_hasBeenSynced_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFaceCrop_isCloudQuarantined_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFaceCrop_type_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFaceCrop_state_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFaceGroup (
    modelId integer primary key autoincrement,
    uuid varchar,
    personId integer,
    faceGroupType integer,
    representativeFaceId integer,
    personBuilderState integer
);

CREATE TABLE RKFaceGroup_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFaceGroup_faceGroupType_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFaceGroup_personBuilderState_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFacePrint (
    modelId integer primary key autoincrement,
    uuid varchar,
    faceId integer,
    faceprintVersion integer,
    faceprint blob
);

CREATE TABLE RKFacePrint_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFolder (
    modelId integer primary key autoincrement,
    uuid varchar,
    name varchar,
    posterVersionUuid varchar,
    sortKeyPath varchar,
    sortAscending integer,
    createDate timestamp,
    isFavorite integer,
    isInTrash integer,
    inTrashDate timestamp,
    isHidden integer,
    isMagic integer,
    colorLabelIndex integer,
    cloudLibraryState integer,
    hasBeenSynced integer,
    cloudIdentifier varchar,
    isCloudQuarantined integer,
    folderType integer,
    parentFolderUuid varchar,
    implicitAlbumUuid varchar,
    automaticallyGenerateFullSizePreviews integer,
    minImageTimeZoneName varchar,
    maxImageTimeZoneName varchar,
    minImageDate timestamp,
    maxImageDate timestamp,
    folderPath varchar,
    isExpanded integer,
    isHiddenWhenEmpty integer
);

CREATE TABLE RKFolder_integerNote (
    keyPath integer,
    value integer,
    attachedToId integer,
    primary key (attachedToId, keyPath)
);

CREATE TABLE RKFolder_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFolder_cloudLibraryState_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFolder_hasBeenSynced_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFolder_isCloudQuarantined_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKFolder_folderType_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKImageMask (
    modelId integer primary key autoincrement,
    uuid varchar,
    createDate timestamp
);

CREATE TABLE RKImageMask_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKImageProxyState (
    modelId integer primary key autoincrement,
    versionId integer,
    thumbnailsCurrent integer,
    miniThumbnailsCurrent integer,
    tinyThumbnailsCurrent integer,
    fullSizePreviewUpToDate integer,
    thumbnailCacheIndex integer,
    thumbnailRendered integer,
    previewRendered integer,
    previewJpegHeight integer,
    previewJpegWidth integer,
    thumbnailHeight integer,
    thumbnailWidth integer,
    miniThumbnailHeight integer,
    miniThumbnailWidth integer,
    tinyThumbnailHeight integer,
    tinyThumbnailWidth integer,
    faceTilesCurrent integer,
    previewGenerationVersion integer,
    microThumbnailOrientation integer,
    previewJpegOrientation integer,
    thumbnailOrientation integer,
    miniThumbnailOrientation integer,
    tinyThumbnailOrientation integer,
    microThumbnailsCurrent integer,
    microThumbnailHeight integer,
    microThumbnailWidth integer,
    segmentColorSpace integer
);

CREATE TABLE RKImageProxyState_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKImageProxyState_thumbnailsCurrent_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKImageProxyState_miniThumbnailsCurrent_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKImageProxyState_tinyThumbnailsCurrent_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKImageProxyState_fullSizePreviewUpToDate_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKImageProxyState_thumbnailRendered_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKImageProxyState_previewRendered_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKImageProxyState_faceTilesCurrent_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKImageProxyState_microThumbnailsCurrent_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKImportGroup (
    modelId integer primary key autoincrement,
    uuid varchar,
    name varchar,
    importDate timestamp,
    isSynthesized integer
);

CREATE TABLE RKImportGroup_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKImportMoment (
    modelId integer primary key autoincrement,
    uuid varchar,
    importDate timestamp,
    lastModifiedDate timestamp
);

CREATE TABLE RKImportMoment_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKKeyword (
    modelId integer primary key autoincrement,
    uuid varchar,
    name varchar,
    searchName varchar,
    hasChildren integer,
    shortcut varchar
);

CREATE TABLE RKKeyword_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKKeywordForVersion (
    modelId integer primary key autoincrement,
    versionId integer,
    keywordId integer
);

CREATE TABLE RKKeywordForVersion_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMaster (
    modelId integer primary key autoincrement,
    uuid varchar,
    fingerprint varchar,
    orientation integer,
    name varchar,
    createDate timestamp,
    isInTrash integer,
    inTrashDate timestamp,
    cloudLibraryState integer,
    hasBeenSynced integer,
    isCloudQuarantined integer,
    fileIsReference integer,
    isMissing integer,
    duration decimal,
    fileModificationDate timestamp,
    bookmarkId integer,
    volumeId integer,
    fileSize integer,
    width integer,
    height integer,
    UTI varchar,
    importGroupUuid varchar,
    alternateMasterUuid varchar,
    originalVersionName varchar,
    fileName varchar,
    isExternallyEditable integer,
    isTrulyRaw integer,
    hasAttachments integer,
    hasNotes integer,
    imagePath varchar,
    imageDate timestamp,
    fileCreationDate timestamp,
    originalFileName varchar,
    originalFileSize integer,
    importedBy integer,
    originatingAssetIdentifier varchar,
    burstUuid varchar,
    importComplete integer,
    imageTimeZoneOffsetSeconds integer,
    photoStreamTagId varchar,
    mediaGroupId varchar,
    hasCheckedMediaGroupId integer,
    groupingUuid varchar,
    cloudImportedBy integer
);

CREATE TABLE RKMaster_dataNote (
    keyPath integer,
    value blob,
    attachedToId integer,
    primary key (attachedToId, keyPath)
);

CREATE TABLE RKMaster_integerNote (
    keyPath integer,
    value integer,
    attachedToId integer,
    primary key (attachedToId, keyPath)
);

CREATE TABLE RKMaster_stringNote (
    keyPath integer,
    value varchar,
    attachedToId integer,
    primary key (attachedToId, keyPath)
);

CREATE TABLE RKMaster_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMaster_fingerprint_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMaster_isInTrash_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMaster_cloudLibraryState_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMaster_hasBeenSynced_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMaster_isCloudQuarantined_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMaster_fileIsReference_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMaster_isMissing_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMaster_volumeId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMaster_isExternallyEditable_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMaster_isTrulyRaw_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMaster_hasAttachments_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMaster_importedBy_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMaster_originatingAssetIdentifier_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMaster_importComplete_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMaster_photoStreamTagId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMaster_hasCheckedMediaGroupId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMemory (
    modelId integer primary key autoincrement,
    uuid varchar,
    createDate timestamp,
    cloudLibraryState integer,
    hasBeenSynced integer,
    cloudIdentifier varchar,
    isCloudQuarantined integer,
    title varchar,
    subTitle varchar,
    keyVersionId integer,
    category integer,
    rejected integer,
    photosGraphVersion integer,
    photosGraphData blob,
    movieData blob,
    movieAssetState blob,
    pending integer,
    subcategory integer,
    score decimal,
    favorite integer,
    userCreated integer,
    queryHintData blob,
    notificationState integer,
    blacklistedFeature blob,
    viewCount integer,
    playCount integer,
    shareCount integer
);

CREATE TABLE RKMemory_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMemory_cloudLibraryState_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMemory_hasBeenSynced_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMemory_isCloudQuarantined_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMemory_rejected_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMemory_pending_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMemory_subcategory_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMemory_favorite_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMemory_notificationState_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMemoryCuratedVersion (
    modelId integer primary key autoincrement,
    versionId integer,
    memoryId integer
);

CREATE TABLE RKMemoryCuratedVersion_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMemoryCuratedVersion_memoryId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMemoryExtendedCuratedVersion (
    modelId integer primary key autoincrement,
    versionId integer,
    memoryId integer
);

CREATE TABLE RKMemoryExtendedCuratedVersion_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMemoryExtendedCuratedVersion_memoryId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMemoryMovieVersion (
    modelId integer primary key autoincrement,
    versionId integer,
    memoryId integer
);

CREATE TABLE RKMemoryMovieVersion_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMemoryMovieVersion_memoryId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMemoryRepresentativeVersion (
    modelId integer primary key autoincrement,
    versionId integer,
    memoryId integer
);

CREATE TABLE RKMemoryRepresentativeVersion_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMemoryRepresentativeVersion_memoryId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKModelResource (
    modelId integer primary key autoincrement,
    UTI varchar,
    isOnDisk integer,
    attachedModelId integer,
    attachedModelType integer,
    resourceType integer,
    resourceTag varchar,
    resourceIsReference integer
);

CREATE TABLE RKModelResource_integerNote (
    keyPath integer,
    value integer,
    attachedToId integer,
    primary key (attachedToId, keyPath)
);

CREATE TABLE RKModelResource_stringNote (
    keyPath integer,
    value varchar,
    attachedToId integer,
    primary key (attachedToId, keyPath)
);

CREATE TABLE RKModelResource_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKModelResource_isOnDisk_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKModelResource_attachedModelType_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKModelResource_resourceType_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMoment (
    modelId integer primary key autoincrement,
    uuid varchar,
    versionCount integer,
    lastModifiedDate timestamp,
    startDate timestamp,
    endDate timestamp,
    representativeDate timestamp,
    yearUuid varchar,
    collectionUuid varchar,
    generationType integer,
    reverseLocationData blob,
    reverseLocationDataIsValid integer,
    needsRebuild integer,
    primaryPlaceData blob,
    secondaryPlaceData blob,
    userTitlesData blob,
    approximateLocationData blob
);

CREATE TABLE RKMoment_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMoment_reverseLocationDataIsValid_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMomentCollection (
    modelId integer primary key autoincrement,
    uuid varchar,
    startDate timestamp,
    endDate timestamp,
    representativeDate timestamp,
    generationType integer,
    reverseLocationData blob,
    reverseLocationDataIsValid integer,
    primaryPlaceData blob,
    secondaryPlaceData blob,
    userTitlesData blob,
    sortIndex integer
);

CREATE TABLE RKMomentCollection_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKMomentYear (
    modelId integer primary key autoincrement,
    uuid varchar,
    startDate timestamp,
    endDate timestamp,
    representativeDate timestamp,
    generationType integer,
    reverseLocationData blob,
    reverseLocationDataIsValid integer,
    primaryPlaceData blob,
    secondaryPlaceData blob,
    sortIndex integer
);

CREATE TABLE RKMomentYear_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKPerson (
    modelId integer primary key autoincrement,
    uuid varchar,
    name varchar,
    cloudLibraryState integer,
    hasBeenSynced integer,
    cloudIdentifier varchar,
    isCloudQuarantined integer,
    representativeFaceId integer,
    manualOrder integer,
    personType integer,
    personUri varchar,
    isInPersonNamingModel integer,
    isVerified integer,
    associatedClusterId integer,
    faceCount integer,
    displayName varchar,
    verifiedType integer,
    mergeTargetPersonId integer,
    pendingMergeTargetPersonCloudIdentifier varchar
);

CREATE TABLE RKPerson_dataNote (
    keyPath integer,
    value blob,
    attachedToId integer,
    primary key (attachedToId, keyPath)
);

CREATE TABLE RKPerson_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKPerson_cloudLibraryState_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKPerson_hasBeenSynced_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKPerson_isCloudQuarantined_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKPerson_personType_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKPerson_isInPersonNamingModel_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKPerson_isVerified_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKPerson_verifiedType_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKPerson_pendingMergeTargetPersonCloudIdentifier_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKPersonInvalidMergeCandidatePerson (
    modelId integer primary key autoincrement,
    personId integer,
    invalidMergeCandidatePersonId integer
);

CREATE TABLE RKPersonInvalidMergeCandidatePerson_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKPersonMergeCandidatePerson (
    modelId integer primary key autoincrement,
    personId integer,
    mergeCandidatePersonId integer
);

CREATE TABLE RKPersonMergeCandidatePerson_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKPersonRejectedFace (
    modelId integer primary key autoincrement,
    personId integer,
    faceId integer
);

CREATE TABLE RKPersonRejectedFace_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKPersonRejectedFaceNeedingFaceCrop (
    modelId integer primary key autoincrement,
    personId integer,
    faceId integer
);

CREATE TABLE RKPersonRejectedFaceNeedingFaceCrop_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKPersonRejectedFaceNeedingFaceCrop_personId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKPlace (
    modelId integer primary key autoincrement,
    uuid varchar,
    modDate timestamp,
    createDate timestamp,
    type integer,
    defaultName varchar,
    recordLocator integer,
    userDefined integer,
    providerId varchar,
    providerVersion integer,
    minLongitude decimal,
    maxLongitude decimal,
    minLatitude decimal,
    maxLatitude decimal,
    countryCode varchar,
    centroid varchar,
    area decimal
);

CREATE TABLE RKPlace_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE IF NOT EXISTS "RKPlace_RTree_node"(nodeno INTEGER PRIMARY KEY, data BLOB);

CREATE TABLE IF NOT EXISTS "RKPlace_RTree_rowid"(rowid INTEGER PRIMARY KEY, nodeno INTEGER);

CREATE TABLE IF NOT EXISTS "RKPlace_RTree_parent"(nodeno INTEGER PRIMARY KEY, parentnode INTEGER);

CREATE TABLE RKPlaceForVersion (
    modelId integer primary key autoincrement,
    versionId integer,
    placeId integer
);

CREATE TABLE RKPlaceForVersion_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKSceneInVersion (
    modelId integer primary key autoincrement,
    versionId integer,
    sceneIdentifier integer,
    confidence decimal
);

CREATE TABLE RKSceneInVersion_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKSceneInVersion_versionId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion (
    modelId integer primary key autoincrement,
    uuid varchar,
    orientation integer,
    naturalDuration decimal,
    name varchar,
    createDate timestamp,
    isFavorite integer,
    isInTrash integer,
    inTrashDate timestamp,
    isHidden integer,
    colorLabelIndex integer,
    cloudLibraryState integer,
    hasBeenSynced integer,
    cloudIdentifier varchar,
    isCloudQuarantined integer,
    fileIsReference integer,
    type integer,
    adjustmentUuid varchar,
    lastModifiedDate timestamp,
    fileName varchar,
    hasNotes integer,
    imageDate timestamp,
    burstUuid varchar,
    imageTimeZoneOffsetSeconds integer,
    groupingUuid varchar,
    reverseLocationData blob,
    reverseLocationDataIsValid integer,
    versionNumber integer,
    masterUuid varchar,
    masterId integer,
    rawMasterUuid varchar,
    nonRawMasterUuid varchar,
    imageTimeZoneName varchar,
    mainRating integer,
    isFlagged integer,
    isEditable integer,
    masterHeight integer,
    masterWidth integer,
    processedHeight integer,
    processedWidth integer,
    hasAdjustments integer,
    overridePlaceId integer,
    latitude decimal,
    longitude decimal,
    exifLatitude decimal,
    exifLongitude decimal,
    renderVersion integer,
    supportedStatus integer,
    videoInPoint varchar,
    videoOutPoint varchar,
    videoPosterFramePoint varchar,
    showInLibrary integer,
    editState integer,
    contentVersion integer,
    propertiesVersion integer,
    faceDetectionIsFromPreview integer,
    faceDetectionRotationFromMaster integer,
    hasKeywords integer,
    subType integer,
    specialType integer,
    momentUuid varchar,
    burstPickType integer,
    extendedDescription varchar,
    outputUpToDate integer,
    previewsAdjustmentUuid varchar,
    pendingAdjustmentUuid varchar,
    faceAdjustmentUuid varchar,
    lastSharedDate timestamp,
    videoCpDurationValue integer,
    videoCpDurationTimescale integer,
    videoCpImageDisplayValue integer,
    videoCpImageDisplayTimescale integer,
    videoCpVisibilityState integer,
    colorSpaceValidationState integer,
    momentSortIdx integer,
    sceneAlgorithmVersion integer,
    sceneAdjustmentUuid varchar,
    graphProcessingState integer,
    mediaAnalysisProcessingState integer,
    mediaAnalysisData blob,
    mediaAnalysisVersion integer,
    statViewCount integer,
    statPlayCount integer,
    statShareCount integer,
    curationScore decimal,
    playbackStyle integer,
    playbackVariation integer,
    renderEffect integer,
    groupingState integer,
    cloudGroupingState integer,
    importMomentId integer,
    selfPortrait integer,
    syncFailureHidden integer,
    searchIndexInvalid integer,
    hdrGain decimal
);

CREATE TABLE RKVersion_decimalNote (
    keyPath integer,
    value decimal,
    attachedToId integer,
    primary key (attachedToId, keyPath)
);

CREATE TABLE RKVersion_stringNote (
    keyPath integer,
    value varchar,
    attachedToId integer,
    primary key (attachedToId, keyPath)
);

CREATE TABLE RKVersion_integerNote (
    keyPath integer,
    value integer,
    attachedToId integer,
    primary key (attachedToId, keyPath)
);

CREATE TABLE RKVersion_dataNote (
    keyPath integer,
    value blob,
    attachedToId integer,
    primary key (attachedToId, keyPath)
);

CREATE TABLE RKVersion_stringAtomNote (
    keyPath integer,
    value integer,
    attachedToId integer,
    primary key (attachedToId, keyPath)
);

CREATE TABLE RKVersion_dateNote (
    keyPath integer,
    value timestamp,
    attachedToId integer,
    primary key (attachedToId, keyPath)
);

CREATE TABLE RKVersion_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_isFavorite_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_isInTrash_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_isHidden_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_cloudLibraryState_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_hasBeenSynced_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_isCloudQuarantined_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_fileIsReference_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_type_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_supportedStatus_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_showInLibrary_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_faceDetectionIsFromPreview_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_hasKeywords_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_subType_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_specialType_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_momentUuid_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_burstPickType_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_outputUpToDate_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_videoCpVisibilityState_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_colorSpaceValidationState_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_graphProcessingState_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_mediaAnalysisProcessingState_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_playbackStyle_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_playbackVariation_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_renderEffect_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_groupingState_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_selfPortrait_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_syncFailureHidden_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersion_searchIndexInvalid_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersionAnalysisState (
    modelId integer primary key autoincrement,
    versionId integer,
    versionUuid varchar,
    workerType integer,
    analysisState integer,
    lastIgnoredDate timestamp,
    ignoreUntilDate timestamp,
    workerFlags integer
);

CREATE TABLE RKVersionAnalysisState_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersionAnalysisState_workerType_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVersionAnalysisState_analysisState_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE TABLE RKVolume (
    modelId integer primary key autoincrement,
    uuid varchar,
    modDate timestamp,
    name varchar,
    createDate timestamp,
    bookmarkId integer,
    diskUuid varchar,
    label varchar,
    isOffline integer,
    bookmarkSSBId integer
);

CREATE TABLE RKVolume_modelId_RidIndex (
    modelId integer primary key,
    value varchar,
    rids blob
);

CREATE INDEX LiGlobals_keyPath_index on LiGlobals(keyPath);

CREATE INDEX LiLibHistory_eventType_index on LiLibHistory(eventType);

CREATE INDEX LiStringAtom_string_index on LiStringAtom(string);

CREATE INDEX LiTableDef_tableName_index on LiTableDef(tableName);

CREATE INDEX LiPropertyDef_keyPath_index on LiPropertyDef(keyPath);

CREATE INDEX RKAdjustmentData_uuid_index on RKAdjustmentData(uuid);

CREATE INDEX RKAdjustmentData_versionId_index on RKAdjustmentData(versionId);

CREATE INDEX RKAdminData_propertyArea_index on RKAdminData(propertyArea);

CREATE INDEX RKAdminData_persistAfterRebuild_index on RKAdminData(persistAfterRebuild);

CREATE INDEX RKAlbum_uuid_index on RKAlbum(uuid);

CREATE INDEX RKAlbum_folderUuid_index on RKAlbum(folderUuid);

CREATE INDEX RKAlbum_createDate_index on RKAlbum(createDate);

CREATE INDEX RKAlbum_inTrashDate_index on RKAlbum(inTrashDate);

CREATE INDEX RKAlbum_recentUserChangeDate_index on RKAlbum(recentUserChangeDate);

CREATE INDEX RKAlbum_cloudIdentifier_index on RKAlbum(cloudIdentifier);

CREATE INDEX RKAlbum_projectExtensionIdentifier_index on RKAlbum(projectExtensionIdentifier);

CREATE INDEX RKAlbum_projectDocumentType_index on RKAlbum(projectDocumentType);

CREATE INDEX RKAlbum_stringNote_value_index on RKAlbum_stringNote(value);

CREATE INDEX RKAlbum_integerNote_value_index on RKAlbum_integerNote(value);

CREATE INDEX RKAlbum_decimalNote_value_index on RKAlbum_decimalNote(value);

CREATE INDEX RKAlbum_dateNote_value_index on RKAlbum_dateNote(value);

CREATE INDEX RKAlbumVersion_versionId_index on RKAlbumVersion(versionId);

CREATE INDEX RKAttachment_uuid_index on RKAttachment(uuid);

CREATE INDEX RKAttachment_isInTrash_index on RKAttachment(isInTrash);

CREATE INDEX RKAttachment_inTrashDate_index on RKAttachment(inTrashDate);

CREATE INDEX RKAttachment_attachedToUuid_index on RKAttachment(attachedToUuid);

CREATE INDEX RKAttachment_propertyKey_index on RKAttachment(propertyKey);

CREATE INDEX RKAttachment_filename_index on RKAttachment(filename);

CREATE INDEX RKAttachment_fileIsReference_index on RKAttachment(fileIsReference);

CREATE INDEX RKCloudResource_fingerprint_index on RKCloudResource(fingerprint);

CREATE INDEX RKCloudResource_identifier_index on RKCloudResource(identifier);

CREATE INDEX RKCustomSortOrder_containerUuid_index on RKCustomSortOrder(containerUuid);

CREATE INDEX RKCustomSortOrder_objectUuid_index on RKCustomSortOrder(objectUuid);

CREATE INDEX RKFace_uuid_index on RKFace(uuid);

CREATE INDEX RKFace_personId_index on RKFace(personId);

CREATE INDEX RKFace_imageModelId_index on RKFace(imageModelId);

CREATE INDEX RKFace_qualityMeasure_index on RKFace(qualityMeasure);

CREATE INDEX RKFace_clusterSequenceNumber_index on RKFace(clusterSequenceNumber);

CREATE INDEX RKFace_faceGroupId_index on RKFace(faceGroupId);

CREATE INDEX RKFace_personUuid_index on RKFace(personUuid);

CREATE INDEX RKFaceCrop_uuid_index on RKFaceCrop(uuid);

CREATE INDEX RKFaceCrop_personId_index on RKFaceCrop(personId);

CREATE INDEX RKFaceCrop_cloudIdentifier_index on RKFaceCrop(cloudIdentifier);

CREATE INDEX RKFaceCrop_faceId_index on RKFaceCrop(faceId);

CREATE INDEX RKFaceGroup_uuid_index on RKFaceGroup(uuid);

CREATE INDEX RKFacePrint_uuid_index on RKFacePrint(uuid);

CREATE INDEX RKFacePrint_faceId_index on RKFacePrint(faceId);

CREATE INDEX RKFolder_uuid_index on RKFolder(uuid);

CREATE INDEX RKFolder_createDate_index on RKFolder(createDate);

CREATE INDEX RKFolder_isInTrash_index on RKFolder(isInTrash);

CREATE INDEX RKFolder_inTrashDate_index on RKFolder(inTrashDate);

CREATE INDEX RKFolder_isMagic_index on RKFolder(isMagic);

CREATE INDEX RKFolder_cloudIdentifier_index on RKFolder(cloudIdentifier);

CREATE INDEX RKFolder_parentFolderUuid_index on RKFolder(parentFolderUuid);

CREATE INDEX RKFolder_folderPath_index on RKFolder(folderPath);

CREATE INDEX RKFolder_integerNote_value_index on RKFolder_integerNote(value);

CREATE INDEX RKImageMask_uuid_index on RKImageMask(uuid);

CREATE INDEX RKImageMask_createDate_index on RKImageMask(createDate);

CREATE INDEX RKImageProxyState_versionId_index on RKImageProxyState(versionId);

CREATE INDEX RKImportGroup_uuid_index on RKImportGroup(uuid);

CREATE INDEX RKImportGroup_name_index on RKImportGroup(name);

CREATE INDEX RKImportGroup_importDate_index on RKImportGroup(importDate);

CREATE INDEX RKImportGroup_isSynthesized_index on RKImportGroup(isSynthesized);

CREATE INDEX RKImportMoment_uuid_index on RKImportMoment(uuid);

CREATE INDEX RKImportMoment_importDate_index on RKImportMoment(importDate);

CREATE INDEX RKKeyword_uuid_index on RKKeyword(uuid);

CREATE INDEX RKKeyword_name_index on RKKeyword(name);

CREATE INDEX RKKeyword_searchName_index on RKKeyword(searchName);

CREATE INDEX RKKeywordForVersion_versionId_index on RKKeywordForVersion(versionId);

CREATE INDEX RKMaster_uuid_index on RKMaster(uuid);

CREATE INDEX RKMaster_createDate_index on RKMaster(createDate);

CREATE INDEX RKMaster_inTrashDate_index on RKMaster(inTrashDate);

CREATE INDEX RKMaster_fileModificationDate_index on RKMaster(fileModificationDate);

CREATE INDEX RKMaster_fileSize_index on RKMaster(fileSize);

CREATE INDEX RKMaster_importGroupUuid_index on RKMaster(importGroupUuid);

CREATE INDEX RKMaster_alternateMasterUuid_index on RKMaster(alternateMasterUuid);

CREATE INDEX RKMaster_fileName_index on RKMaster(fileName);

CREATE INDEX RKMaster_fileCreationDate_index on RKMaster(fileCreationDate);

CREATE INDEX RKMaster_burstUuid_index on RKMaster(burstUuid);

CREATE INDEX RKMaster_mediaGroupId_index on RKMaster(mediaGroupId);

CREATE INDEX RKMaster_groupingUuid_index on RKMaster(groupingUuid);

CREATE INDEX RKMaster_integerNote_value_index on RKMaster_integerNote(value);

CREATE INDEX RKMaster_stringNote_value_index on RKMaster_stringNote(value);

CREATE INDEX RKMemory_uuid_index on RKMemory(uuid);

CREATE INDEX RKMemory_cloudIdentifier_index on RKMemory(cloudIdentifier);

CREATE INDEX RKMemoryCuratedVersion_versionId_index on RKMemoryCuratedVersion(versionId);

CREATE INDEX RKMemoryExtendedCuratedVersion_versionId_index on RKMemoryExtendedCuratedVersion(versionId);

CREATE INDEX RKMemoryMovieVersion_versionId_index on RKMemoryMovieVersion(versionId);

CREATE INDEX RKMemoryRepresentativeVersion_versionId_index on RKMemoryRepresentativeVersion(versionId);

CREATE INDEX RKModelResource_attachedModelId_index on RKModelResource(attachedModelId);

CREATE INDEX RKModelResource_resourceTag_index on RKModelResource(resourceTag);

CREATE INDEX RKModelResource_resourceIsReference_index on RKModelResource(resourceIsReference);

CREATE INDEX RKModelResource_integerNote_value_index on RKModelResource_integerNote(value);

CREATE INDEX RKModelResource_stringNote_value_index on RKModelResource_stringNote(value);

CREATE INDEX RKMoment_uuid_index on RKMoment(uuid);

CREATE INDEX RKMoment_startDate_index on RKMoment(startDate);

CREATE INDEX RKMomentCollection_uuid_index on RKMomentCollection(uuid);

CREATE INDEX RKMomentYear_uuid_index on RKMomentYear(uuid);

CREATE INDEX RKPerson_uuid_index on RKPerson(uuid);

CREATE INDEX RKPerson_cloudIdentifier_index on RKPerson(cloudIdentifier);

CREATE INDEX RKPerson_associatedClusterId_index on RKPerson(associatedClusterId);

CREATE INDEX RKPerson_faceCount_index on RKPerson(faceCount);

CREATE INDEX RKPerson_mergeTargetPersonId_index on RKPerson(mergeTargetPersonId);

CREATE INDEX RKPersonInvalidMergeCandidatePerson_personId_index on RKPersonInvalidMergeCandidatePerson(personId);

CREATE INDEX RKPersonInvalidMergeCandidatePerson_invalidMergeCandidatePersonId_index on RKPersonInvalidMergeCandidatePerson(invalidMergeCandidatePersonId);

CREATE INDEX RKPersonMergeCandidatePerson_personId_index on RKPersonMergeCandidatePerson(personId);

CREATE INDEX RKPersonMergeCandidatePerson_mergeCandidatePersonId_index on RKPersonMergeCandidatePerson(mergeCandidatePersonId);

CREATE INDEX RKPersonRejectedFace_personId_index on RKPersonRejectedFace(personId);

CREATE INDEX RKPersonRejectedFace_faceId_index on RKPersonRejectedFace(faceId);

CREATE INDEX RKPersonRejectedFaceNeedingFaceCrop_faceId_index on RKPersonRejectedFaceNeedingFaceCrop(faceId);

CREATE INDEX RKPlace_uuid_index on RKPlace(uuid);

CREATE INDEX RKPlace_modDate_index on RKPlace(modDate);

CREATE INDEX RKPlace_createDate_index on RKPlace(createDate);

CREATE INDEX RKPlace_type_index on RKPlace(type);

CREATE INDEX RKPlace_recordLocator_index on RKPlace(recordLocator);

CREATE INDEX RKPlace_userDefined_index on RKPlace(userDefined);

CREATE INDEX RKPlaceForVersion_versionId_index on RKPlaceForVersion(versionId);

CREATE INDEX RKPlaceForVersion_placeId_index on RKPlaceForVersion(placeId);

CREATE INDEX RKVersion_uuid_index on RKVersion(uuid);

CREATE INDEX RKVersion_createDate_index on RKVersion(createDate);

CREATE INDEX RKVersion_inTrashDate_index on RKVersion(inTrashDate);

CREATE INDEX RKVersion_cloudIdentifier_index on RKVersion(cloudIdentifier);

CREATE INDEX RKVersion_adjustmentUuid_index on RKVersion(adjustmentUuid);

CREATE INDEX RKVersion_imageDate_index on RKVersion(imageDate);

CREATE INDEX RKVersion_burstUuid_index on RKVersion(burstUuid);

CREATE INDEX RKVersion_groupingUuid_index on RKVersion(groupingUuid);

CREATE INDEX RKVersion_masterUuid_index on RKVersion(masterUuid);

CREATE INDEX RKVersion_masterId_index on RKVersion(masterId);

CREATE INDEX RKVersion_rawMasterUuid_index on RKVersion(rawMasterUuid);

CREATE INDEX RKVersion_nonRawMasterUuid_index on RKVersion(nonRawMasterUuid);

CREATE INDEX RKVersion_latitude_index on RKVersion(latitude);

CREATE INDEX RKVersion_longitude_index on RKVersion(longitude);

CREATE INDEX RKVersion_previewsAdjustmentUuid_index on RKVersion(previewsAdjustmentUuid);

CREATE INDEX RKVersion_importMomentId_index on RKVersion(importMomentId);

CREATE INDEX RKVersion_decimalNote_value_index on RKVersion_decimalNote(value);

CREATE INDEX RKVersion_stringNote_value_index on RKVersion_stringNote(value);

CREATE INDEX RKVersion_integerNote_value_index on RKVersion_integerNote(value);

CREATE INDEX RKVersion_stringAtomNote_value_index on RKVersion_stringAtomNote(value);

CREATE INDEX RKVersion_dateNote_value_index on RKVersion_dateNote(value);

CREATE INDEX RKVersionAnalysisState_versionId_index on RKVersionAnalysisState(versionId);

CREATE INDEX RKVolume_uuid_index on RKVolume(uuid);

CREATE INDEX RKVolume_modDate_index on RKVolume(modDate);

CREATE INDEX RKVolume_name_index on RKVolume(name);

CREATE INDEX RKVolume_createDate_index on RKVolume(createDate);

CREATE INDEX RKVolume_diskUuid_index on RKVolume(diskUuid);

CREATE VIRTUAL TABLE RidList_VirtualReader using RidList_VirtualReaderModule;

CREATE VIRTUAL TABLE Array_VirtualReader using Array_VirtualReaderModule;

CREATE VIRTUAL TABLE LiGlobals_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE LiLibHistory_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE LiStringAtom_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE LiTableDef_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE LiPropertyDef_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE LiPropertyHistory_VirtualBufferReader using VirtualBufferReaderModule;

CREATE TRIGGER RKAdjustmentData_ridIndexDeleteTrigger before delete on RKAdjustmentData begin
select
    RKAdjustmentData_notifyRidIndexDelete(old.modelId, old.modelId)
from
    RKAdjustmentData
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKAdjustmentData_ridIndexInsertTrigger
after
insert
    on RKAdjustmentData begin
select
    RKAdjustmentData_notifyRidIndexInsert(new.modelId, new.modelId)
from
    RKAdjustmentData
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKAdjustmentData_ridIndexUpdateTrigger
after
update
    of modelId on RKAdjustmentData begin
select
    RKAdjustmentData_notifyRidIndexUpdate(new.modelId, old.modelId, new.modelId)
from
    RKAdjustmentData
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKAdminData_ridIndexDeleteTrigger before delete on RKAdminData begin
select
    RKAdminData_notifyRidIndexDelete(old.modelId, old.modelId)
from
    RKAdminData
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKAdminData_ridIndexInsertTrigger
after
insert
    on RKAdminData begin
select
    RKAdminData_notifyRidIndexInsert(new.modelId, new.modelId)
from
    RKAdminData
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKAdminData_ridIndexUpdateTrigger
after
update
    of modelId on RKAdminData begin
select
    RKAdminData_notifyRidIndexUpdate(new.modelId, old.modelId, new.modelId)
from
    RKAdminData
where
    rowid = old.rowid;

end;

CREATE VIRTUAL TABLE RKAlbum_dataNote_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKAlbum_stringNote_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKAlbum_integerNote_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKAlbum_decimalNote_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKAlbum_dateNote_VirtualBufferReader using VirtualBufferReaderModule;

CREATE TRIGGER RKAlbum_ridIndexDeleteTrigger before delete on RKAlbum begin
select
    RKAlbum_notifyRidIndexDelete(
        old.modelId,
        old.albumType,
        old.albumSubclass,
        old.isHidden,
        old.isMagic,
        old.hasBeenSynced,
        old.isCloudQuarantined,
        old.modelId,
        old.cloudLibraryState,
        old.isInTrash
    )
from
    RKAlbum
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKAlbum_ridIndexInsertTrigger
after
insert
    on RKAlbum begin
select
    RKAlbum_notifyRidIndexInsert(
        new.modelId,
        new.albumType,
        new.albumSubclass,
        new.isHidden,
        new.isMagic,
        new.hasBeenSynced,
        new.isCloudQuarantined,
        new.modelId,
        new.cloudLibraryState,
        new.isInTrash
    )
from
    RKAlbum
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKAlbum_ridIndexUpdateTrigger
after
update
    of albumType,
    albumSubclass,
    isHidden,
    isMagic,
    hasBeenSynced,
    isCloudQuarantined,
    modelId,
    cloudLibraryState,
    isInTrash on RKAlbum begin
select
    RKAlbum_notifyRidIndexUpdate(
        new.modelId,
        old.albumType,
        old.albumSubclass,
        old.isHidden,
        old.isMagic,
        old.hasBeenSynced,
        old.isCloudQuarantined,
        old.modelId,
        old.cloudLibraryState,
        old.isInTrash,
        new.albumType,
        new.albumSubclass,
        new.isHidden,
        new.isMagic,
        new.hasBeenSynced,
        new.isCloudQuarantined,
        new.modelId,
        new.cloudLibraryState,
        new.isInTrash
    )
from
    RKAlbum
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKAlbumVersion_ridIndexDeleteTrigger before delete on RKAlbumVersion begin
select
    RKAlbumVersion_notifyRidIndexDelete(
        old.versionId,
        old.modelId,
        old.albumId,
        old.modelId
    )
from
    RKAlbumVersion
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKAlbumVersion_ridIndexInsertTrigger
after
insert
    on RKAlbumVersion begin
select
    RKAlbumVersion_notifyRidIndexInsert(
        new.versionId,
        new.modelId,
        new.albumId,
        new.modelId
    )
from
    RKAlbumVersion
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKAlbumVersion_ridIndexUpdateTrigger
after
update
    of albumId,
    modelId on RKAlbumVersion begin
select
    RKAlbumVersion_notifyRidIndexUpdate(
        new.versionId,
        new.modelId,
        old.albumId,
        old.modelId,
        new.albumId,
        new.modelId
    )
from
    RKAlbumVersion
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKAttachment_ridIndexDeleteTrigger before delete on RKAttachment begin
select
    RKAttachment_notifyRidIndexDelete(old.modelId, old.modelId)
from
    RKAttachment
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKAttachment_ridIndexInsertTrigger
after
insert
    on RKAttachment begin
select
    RKAttachment_notifyRidIndexInsert(new.modelId, new.modelId)
from
    RKAttachment
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKAttachment_ridIndexUpdateTrigger
after
update
    of modelId on RKAttachment begin
select
    RKAttachment_notifyRidIndexUpdate(new.modelId, old.modelId, new.modelId)
from
    RKAttachment
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKBookmark_ridIndexDeleteTrigger before delete on RKBookmark begin
select
    RKBookmark_notifyRidIndexDelete(old.modelId, old.modelId)
from
    RKBookmark
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKBookmark_ridIndexInsertTrigger
after
insert
    on RKBookmark begin
select
    RKBookmark_notifyRidIndexInsert(new.modelId, new.modelId)
from
    RKBookmark
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKBookmark_ridIndexUpdateTrigger
after
update
    of modelId on RKBookmark begin
select
    RKBookmark_notifyRidIndexUpdate(new.modelId, old.modelId, new.modelId)
from
    RKBookmark
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKCloudResource_ridIndexDeleteTrigger before delete on RKCloudResource begin
select
    RKCloudResource_notifyRidIndexDelete(
        old.modelId,
        old.isOnDisk,
        old.isFullSizeOutput,
        old.type,
        old.available,
        old.modelId,
        old.status
    )
from
    RKCloudResource
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKCloudResource_ridIndexInsertTrigger
after
insert
    on RKCloudResource begin
select
    RKCloudResource_notifyRidIndexInsert(
        new.modelId,
        new.isOnDisk,
        new.isFullSizeOutput,
        new.type,
        new.available,
        new.modelId,
        new.status
    )
from
    RKCloudResource
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKCloudResource_ridIndexUpdateTrigger
after
update
    of isOnDisk,
    isFullSizeOutput,
    type,
    available,
    modelId,
    status on RKCloudResource begin
select
    RKCloudResource_notifyRidIndexUpdate(
        new.modelId,
        old.isOnDisk,
        old.isFullSizeOutput,
        old.type,
        old.available,
        old.modelId,
        old.status,
        new.isOnDisk,
        new.isFullSizeOutput,
        new.type,
        new.available,
        new.modelId,
        new.status
    )
from
    RKCloudResource
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKCustomSortOrder_ridIndexDeleteTrigger before delete on RKCustomSortOrder begin
select
    RKCustomSortOrder_notifyRidIndexDelete(old.modelId, old.modelId)
from
    RKCustomSortOrder
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKCustomSortOrder_ridIndexInsertTrigger
after
insert
    on RKCustomSortOrder begin
select
    RKCustomSortOrder_notifyRidIndexInsert(new.modelId, new.modelId)
from
    RKCustomSortOrder
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKCustomSortOrder_ridIndexUpdateTrigger
after
update
    of modelId on RKCustomSortOrder begin
select
    RKCustomSortOrder_notifyRidIndexUpdate(new.modelId, old.modelId, new.modelId)
from
    RKCustomSortOrder
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKFace_ridIndexDeleteTrigger before delete on RKFace begin
select
    RKFace_notifyRidIndexDelete(
        old.modelId,
        old.faceAlgorithmVersion,
        old.hasBeenSynced,
        old.confirmedFaceCropGenerationState,
        old.hidden,
        old.manual,
        old.faceType,
        old.modelId,
        old.trainingType,
        old.nameSource,
        old.isInTrash
    )
from
    RKFace
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKFace_ridIndexInsertTrigger
after
insert
    on RKFace begin
select
    RKFace_notifyRidIndexInsert(
        new.modelId,
        new.faceAlgorithmVersion,
        new.hasBeenSynced,
        new.confirmedFaceCropGenerationState,
        new.hidden,
        new.manual,
        new.faceType,
        new.modelId,
        new.trainingType,
        new.nameSource,
        new.isInTrash
    )
from
    RKFace
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKFace_ridIndexUpdateTrigger
after
update
    of faceAlgorithmVersion,
    hasBeenSynced,
    confirmedFaceCropGenerationState,
    hidden,
    manual,
    faceType,
    modelId,
    trainingType,
    nameSource,
    isInTrash on RKFace begin
select
    RKFace_notifyRidIndexUpdate(
        new.modelId,
        old.faceAlgorithmVersion,
        old.hasBeenSynced,
        old.confirmedFaceCropGenerationState,
        old.hidden,
        old.manual,
        old.faceType,
        old.modelId,
        old.trainingType,
        old.nameSource,
        old.isInTrash,
        new.faceAlgorithmVersion,
        new.hasBeenSynced,
        new.confirmedFaceCropGenerationState,
        new.hidden,
        new.manual,
        new.faceType,
        new.modelId,
        new.trainingType,
        new.nameSource,
        new.isInTrash
    )
from
    RKFace
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKFaceCrop_ridIndexDeleteTrigger before delete on RKFaceCrop begin
select
    RKFaceCrop_notifyRidIndexDelete(
        old.modelId,
        old.isCloudQuarantined,
        old.state,
        old.type,
        old.cloudLibraryState,
        old.hasBeenSynced,
        old.modelId
    )
from
    RKFaceCrop
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKFaceCrop_ridIndexInsertTrigger
after
insert
    on RKFaceCrop begin
select
    RKFaceCrop_notifyRidIndexInsert(
        new.modelId,
        new.isCloudQuarantined,
        new.state,
        new.type,
        new.cloudLibraryState,
        new.hasBeenSynced,
        new.modelId
    )
from
    RKFaceCrop
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKFaceCrop_ridIndexUpdateTrigger
after
update
    of isCloudQuarantined,
    state,
    type,
    cloudLibraryState,
    hasBeenSynced,
    modelId on RKFaceCrop begin
select
    RKFaceCrop_notifyRidIndexUpdate(
        new.modelId,
        old.isCloudQuarantined,
        old.state,
        old.type,
        old.cloudLibraryState,
        old.hasBeenSynced,
        old.modelId,
        new.isCloudQuarantined,
        new.state,
        new.type,
        new.cloudLibraryState,
        new.hasBeenSynced,
        new.modelId
    )
from
    RKFaceCrop
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKFaceGroup_ridIndexDeleteTrigger before delete on RKFaceGroup begin
select
    RKFaceGroup_notifyRidIndexDelete(
        old.modelId,
        old.faceGroupType,
        old.personBuilderState,
        old.modelId
    )
from
    RKFaceGroup
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKFaceGroup_ridIndexInsertTrigger
after
insert
    on RKFaceGroup begin
select
    RKFaceGroup_notifyRidIndexInsert(
        new.modelId,
        new.faceGroupType,
        new.personBuilderState,
        new.modelId
    )
from
    RKFaceGroup
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKFaceGroup_ridIndexUpdateTrigger
after
update
    of faceGroupType,
    personBuilderState,
    modelId on RKFaceGroup begin
select
    RKFaceGroup_notifyRidIndexUpdate(
        new.modelId,
        old.faceGroupType,
        old.personBuilderState,
        old.modelId,
        new.faceGroupType,
        new.personBuilderState,
        new.modelId
    )
from
    RKFaceGroup
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKFacePrint_ridIndexDeleteTrigger before delete on RKFacePrint begin
select
    RKFacePrint_notifyRidIndexDelete(old.modelId, old.modelId)
from
    RKFacePrint
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKFacePrint_ridIndexInsertTrigger
after
insert
    on RKFacePrint begin
select
    RKFacePrint_notifyRidIndexInsert(new.modelId, new.modelId)
from
    RKFacePrint
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKFacePrint_ridIndexUpdateTrigger
after
update
    of modelId on RKFacePrint begin
select
    RKFacePrint_notifyRidIndexUpdate(new.modelId, old.modelId, new.modelId)
from
    RKFacePrint
where
    rowid = old.rowid;

end;

CREATE VIRTUAL TABLE RKFolder_integerNote_VirtualBufferReader using VirtualBufferReaderModule;

CREATE TRIGGER RKFolder_ridIndexDeleteTrigger before delete on RKFolder begin
select
    RKFolder_notifyRidIndexDelete(
        old.modelId,
        old.isCloudQuarantined,
        old.folderType,
        old.cloudLibraryState,
        old.hasBeenSynced,
        old.modelId
    )
from
    RKFolder
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKFolder_ridIndexInsertTrigger
after
insert
    on RKFolder begin
select
    RKFolder_notifyRidIndexInsert(
        new.modelId,
        new.isCloudQuarantined,
        new.folderType,
        new.cloudLibraryState,
        new.hasBeenSynced,
        new.modelId
    )
from
    RKFolder
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKFolder_ridIndexUpdateTrigger
after
update
    of isCloudQuarantined,
    folderType,
    cloudLibraryState,
    hasBeenSynced,
    modelId on RKFolder begin
select
    RKFolder_notifyRidIndexUpdate(
        new.modelId,
        old.isCloudQuarantined,
        old.folderType,
        old.cloudLibraryState,
        old.hasBeenSynced,
        old.modelId,
        new.isCloudQuarantined,
        new.folderType,
        new.cloudLibraryState,
        new.hasBeenSynced,
        new.modelId
    )
from
    RKFolder
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKImageMask_ridIndexDeleteTrigger before delete on RKImageMask begin
select
    RKImageMask_notifyRidIndexDelete(old.modelId, old.modelId)
from
    RKImageMask
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKImageMask_ridIndexInsertTrigger
after
insert
    on RKImageMask begin
select
    RKImageMask_notifyRidIndexInsert(new.modelId, new.modelId)
from
    RKImageMask
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKImageMask_ridIndexUpdateTrigger
after
update
    of modelId on RKImageMask begin
select
    RKImageMask_notifyRidIndexUpdate(new.modelId, old.modelId, new.modelId)
from
    RKImageMask
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKImageProxyState_ridIndexDeleteTrigger before delete on RKImageProxyState begin
select
    RKImageProxyState_notifyRidIndexDelete(
        old.versionId,
        old.modelId,
        old.microThumbnailsCurrent,
        old.thumbnailsCurrent,
        old.miniThumbnailsCurrent,
        old.modelId,
        old.tinyThumbnailsCurrent,
        old.fullSizePreviewUpToDate,
        old.thumbnailRendered,
        old.previewRendered,
        old.faceTilesCurrent
    )
from
    RKImageProxyState
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKImageProxyState_ridIndexInsertTrigger
after
insert
    on RKImageProxyState begin
select
    RKImageProxyState_notifyRidIndexInsert(
        new.versionId,
        new.modelId,
        new.microThumbnailsCurrent,
        new.thumbnailsCurrent,
        new.miniThumbnailsCurrent,
        new.modelId,
        new.tinyThumbnailsCurrent,
        new.fullSizePreviewUpToDate,
        new.thumbnailRendered,
        new.previewRendered,
        new.faceTilesCurrent
    )
from
    RKImageProxyState
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKImageProxyState_ridIndexUpdateTrigger
after
update
    of microThumbnailsCurrent,
    thumbnailsCurrent,
    miniThumbnailsCurrent,
    modelId,
    tinyThumbnailsCurrent,
    fullSizePreviewUpToDate,
    thumbnailRendered,
    previewRendered,
    faceTilesCurrent on RKImageProxyState begin
select
    RKImageProxyState_notifyRidIndexUpdate(
        new.versionId,
        new.modelId,
        old.microThumbnailsCurrent,
        old.thumbnailsCurrent,
        old.miniThumbnailsCurrent,
        old.modelId,
        old.tinyThumbnailsCurrent,
        old.fullSizePreviewUpToDate,
        old.thumbnailRendered,
        old.previewRendered,
        old.faceTilesCurrent,
        new.microThumbnailsCurrent,
        new.thumbnailsCurrent,
        new.miniThumbnailsCurrent,
        new.modelId,
        new.tinyThumbnailsCurrent,
        new.fullSizePreviewUpToDate,
        new.thumbnailRendered,
        new.previewRendered,
        new.faceTilesCurrent
    )
from
    RKImageProxyState
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKImportGroup_ridIndexDeleteTrigger before delete on RKImportGroup begin
select
    RKImportGroup_notifyRidIndexDelete(old.modelId, old.modelId)
from
    RKImportGroup
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKImportGroup_ridIndexInsertTrigger
after
insert
    on RKImportGroup begin
select
    RKImportGroup_notifyRidIndexInsert(new.modelId, new.modelId)
from
    RKImportGroup
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKImportGroup_ridIndexUpdateTrigger
after
update
    of modelId on RKImportGroup begin
select
    RKImportGroup_notifyRidIndexUpdate(new.modelId, old.modelId, new.modelId)
from
    RKImportGroup
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKImportMoment_ridIndexDeleteTrigger before delete on RKImportMoment begin
select
    RKImportMoment_notifyRidIndexDelete(old.modelId, old.modelId)
from
    RKImportMoment
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKImportMoment_ridIndexInsertTrigger
after
insert
    on RKImportMoment begin
select
    RKImportMoment_notifyRidIndexInsert(new.modelId, new.modelId)
from
    RKImportMoment
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKImportMoment_ridIndexUpdateTrigger
after
update
    of modelId on RKImportMoment begin
select
    RKImportMoment_notifyRidIndexUpdate(new.modelId, old.modelId, new.modelId)
from
    RKImportMoment
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKKeyword_ridIndexDeleteTrigger before delete on RKKeyword begin
select
    RKKeyword_notifyRidIndexDelete(old.modelId, old.modelId)
from
    RKKeyword
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKKeyword_ridIndexInsertTrigger
after
insert
    on RKKeyword begin
select
    RKKeyword_notifyRidIndexInsert(new.modelId, new.modelId)
from
    RKKeyword
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKKeyword_ridIndexUpdateTrigger
after
update
    of modelId on RKKeyword begin
select
    RKKeyword_notifyRidIndexUpdate(new.modelId, old.modelId, new.modelId)
from
    RKKeyword
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKKeywordForVersion_ridIndexDeleteTrigger before delete on RKKeywordForVersion begin
select
    RKKeywordForVersion_notifyRidIndexDelete(old.modelId, old.modelId)
from
    RKKeywordForVersion
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKKeywordForVersion_ridIndexInsertTrigger
after
insert
    on RKKeywordForVersion begin
select
    RKKeywordForVersion_notifyRidIndexInsert(new.modelId, new.modelId)
from
    RKKeywordForVersion
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKKeywordForVersion_ridIndexUpdateTrigger
after
update
    of modelId on RKKeywordForVersion begin
select
    RKKeywordForVersion_notifyRidIndexUpdate(new.modelId, old.modelId, new.modelId)
from
    RKKeywordForVersion
where
    rowid = old.rowid;

end;

CREATE VIRTUAL TABLE RKMaster_dataNote_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKMaster_integerNote_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKMaster_stringNote_VirtualBufferReader using VirtualBufferReaderModule;

CREATE TRIGGER RKMaster_ridIndexDeleteTrigger before delete on RKMaster begin
select
    RKMaster_notifyRidIndexDelete(
        old.modelId,
        old.fileIsReference,
        old.isMissing,
        old.importedBy,
        old.originatingAssetIdentifier,
        old.fingerprint,
        old.isInTrash,
        old.cloudLibraryState,
        old.hasBeenSynced,
        old.modelId,
        old.isCloudQuarantined,
        old.volumeId,
        old.importComplete,
        old.photoStreamTagId,
        old.hasCheckedMediaGroupId,
        old.isExternallyEditable,
        old.isTrulyRaw,
        old.hasAttachments
    )
from
    RKMaster
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKMaster_ridIndexInsertTrigger
after
insert
    on RKMaster begin
select
    RKMaster_notifyRidIndexInsert(
        new.modelId,
        new.fileIsReference,
        new.isMissing,
        new.importedBy,
        new.originatingAssetIdentifier,
        new.fingerprint,
        new.isInTrash,
        new.cloudLibraryState,
        new.hasBeenSynced,
        new.modelId,
        new.isCloudQuarantined,
        new.volumeId,
        new.importComplete,
        new.photoStreamTagId,
        new.hasCheckedMediaGroupId,
        new.isExternallyEditable,
        new.isTrulyRaw,
        new.hasAttachments
    )
from
    RKMaster
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKMaster_ridIndexUpdateTrigger
after
update
    of fileIsReference,
    isMissing,
    importedBy,
    originatingAssetIdentifier,
    fingerprint,
    isInTrash,
    cloudLibraryState,
    hasBeenSynced,
    modelId,
    isCloudQuarantined,
    volumeId,
    importComplete,
    photoStreamTagId,
    hasCheckedMediaGroupId,
    isExternallyEditable,
    isTrulyRaw,
    hasAttachments on RKMaster begin
select
    RKMaster_notifyRidIndexUpdate(
        new.modelId,
        old.fileIsReference,
        old.isMissing,
        old.importedBy,
        old.originatingAssetIdentifier,
        old.fingerprint,
        old.isInTrash,
        old.cloudLibraryState,
        old.hasBeenSynced,
        old.modelId,
        old.isCloudQuarantined,
        old.volumeId,
        old.importComplete,
        old.photoStreamTagId,
        old.hasCheckedMediaGroupId,
        old.isExternallyEditable,
        old.isTrulyRaw,
        old.hasAttachments,
        new.fileIsReference,
        new.isMissing,
        new.importedBy,
        new.originatingAssetIdentifier,
        new.fingerprint,
        new.isInTrash,
        new.cloudLibraryState,
        new.hasBeenSynced,
        new.modelId,
        new.isCloudQuarantined,
        new.volumeId,
        new.importComplete,
        new.photoStreamTagId,
        new.hasCheckedMediaGroupId,
        new.isExternallyEditable,
        new.isTrulyRaw,
        new.hasAttachments
    )
from
    RKMaster
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKMemory_ridIndexDeleteTrigger before delete on RKMemory begin
select
    RKMemory_notifyRidIndexDelete(
        old.modelId,
        old.isCloudQuarantined,
        old.rejected,
        old.notificationState,
        old.pending,
        old.subcategory,
        old.modelId,
        old.favorite,
        old.cloudLibraryState,
        old.hasBeenSynced
    )
from
    RKMemory
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKMemory_ridIndexInsertTrigger
after
insert
    on RKMemory begin
select
    RKMemory_notifyRidIndexInsert(
        new.modelId,
        new.isCloudQuarantined,
        new.rejected,
        new.notificationState,
        new.pending,
        new.subcategory,
        new.modelId,
        new.favorite,
        new.cloudLibraryState,
        new.hasBeenSynced
    )
from
    RKMemory
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKMemory_ridIndexUpdateTrigger
after
update
    of isCloudQuarantined,
    rejected,
    notificationState,
    pending,
    subcategory,
    modelId,
    favorite,
    cloudLibraryState,
    hasBeenSynced on RKMemory begin
select
    RKMemory_notifyRidIndexUpdate(
        new.modelId,
        old.isCloudQuarantined,
        old.rejected,
        old.notificationState,
        old.pending,
        old.subcategory,
        old.modelId,
        old.favorite,
        old.cloudLibraryState,
        old.hasBeenSynced,
        new.isCloudQuarantined,
        new.rejected,
        new.notificationState,
        new.pending,
        new.subcategory,
        new.modelId,
        new.favorite,
        new.cloudLibraryState,
        new.hasBeenSynced
    )
from
    RKMemory
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKMemoryCuratedVersion_ridIndexDeleteTrigger before delete on RKMemoryCuratedVersion begin
select
    RKMemoryCuratedVersion_notifyRidIndexDelete(
        old.versionId,
        old.modelId,
        old.memoryId,
        old.modelId
    )
from
    RKMemoryCuratedVersion
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKMemoryCuratedVersion_ridIndexInsertTrigger
after
insert
    on RKMemoryCuratedVersion begin
select
    RKMemoryCuratedVersion_notifyRidIndexInsert(
        new.versionId,
        new.modelId,
        new.memoryId,
        new.modelId
    )
from
    RKMemoryCuratedVersion
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKMemoryCuratedVersion_ridIndexUpdateTrigger
after
update
    of memoryId,
    modelId on RKMemoryCuratedVersion begin
select
    RKMemoryCuratedVersion_notifyRidIndexUpdate(
        new.versionId,
        new.modelId,
        old.memoryId,
        old.modelId,
        new.memoryId,
        new.modelId
    )
from
    RKMemoryCuratedVersion
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKMemoryExtendedCuratedVersion_ridIndexDeleteTrigger before delete on RKMemoryExtendedCuratedVersion begin
select
    RKMemoryExtendedCuratedVersion_notifyRidIndexDelete(
        old.versionId,
        old.modelId,
        old.memoryId,
        old.modelId
    )
from
    RKMemoryExtendedCuratedVersion
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKMemoryExtendedCuratedVersion_ridIndexInsertTrigger
after
insert
    on RKMemoryExtendedCuratedVersion begin
select
    RKMemoryExtendedCuratedVersion_notifyRidIndexInsert(
        new.versionId,
        new.modelId,
        new.memoryId,
        new.modelId
    )
from
    RKMemoryExtendedCuratedVersion
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKMemoryExtendedCuratedVersion_ridIndexUpdateTrigger
after
update
    of memoryId,
    modelId on RKMemoryExtendedCuratedVersion begin
select
    RKMemoryExtendedCuratedVersion_notifyRidIndexUpdate(
        new.versionId,
        new.modelId,
        old.memoryId,
        old.modelId,
        new.memoryId,
        new.modelId
    )
from
    RKMemoryExtendedCuratedVersion
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKMemoryMovieVersion_ridIndexDeleteTrigger before delete on RKMemoryMovieVersion begin
select
    RKMemoryMovieVersion_notifyRidIndexDelete(
        old.versionId,
        old.modelId,
        old.memoryId,
        old.modelId
    )
from
    RKMemoryMovieVersion
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKMemoryMovieVersion_ridIndexInsertTrigger
after
insert
    on RKMemoryMovieVersion begin
select
    RKMemoryMovieVersion_notifyRidIndexInsert(
        new.versionId,
        new.modelId,
        new.memoryId,
        new.modelId
    )
from
    RKMemoryMovieVersion
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKMemoryMovieVersion_ridIndexUpdateTrigger
after
update
    of memoryId,
    modelId on RKMemoryMovieVersion begin
select
    RKMemoryMovieVersion_notifyRidIndexUpdate(
        new.versionId,
        new.modelId,
        old.memoryId,
        old.modelId,
        new.memoryId,
        new.modelId
    )
from
    RKMemoryMovieVersion
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKMemoryRepresentativeVersion_ridIndexDeleteTrigger before delete on RKMemoryRepresentativeVersion begin
select
    RKMemoryRepresentativeVersion_notifyRidIndexDelete(
        old.versionId,
        old.modelId,
        old.memoryId,
        old.modelId
    )
from
    RKMemoryRepresentativeVersion
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKMemoryRepresentativeVersion_ridIndexInsertTrigger
after
insert
    on RKMemoryRepresentativeVersion begin
select
    RKMemoryRepresentativeVersion_notifyRidIndexInsert(
        new.versionId,
        new.modelId,
        new.memoryId,
        new.modelId
    )
from
    RKMemoryRepresentativeVersion
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKMemoryRepresentativeVersion_ridIndexUpdateTrigger
after
update
    of memoryId,
    modelId on RKMemoryRepresentativeVersion begin
select
    RKMemoryRepresentativeVersion_notifyRidIndexUpdate(
        new.versionId,
        new.modelId,
        old.memoryId,
        old.modelId,
        new.memoryId,
        new.modelId
    )
from
    RKMemoryRepresentativeVersion
where
    rowid = old.rowid;

end;

CREATE VIRTUAL TABLE RKModelResource_integerNote_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKModelResource_stringNote_VirtualBufferReader using VirtualBufferReaderModule;

CREATE TRIGGER RKModelResource_ridIndexDeleteTrigger before delete on RKModelResource begin
select
    RKModelResource_notifyRidIndexDelete(
        old.modelId,
        old.attachedModelType,
        old.resourceType,
        old.modelId,
        old.isOnDisk
    )
from
    RKModelResource
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKModelResource_ridIndexInsertTrigger
after
insert
    on RKModelResource begin
select
    RKModelResource_notifyRidIndexInsert(
        new.modelId,
        new.attachedModelType,
        new.resourceType,
        new.modelId,
        new.isOnDisk
    )
from
    RKModelResource
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKModelResource_ridIndexUpdateTrigger
after
update
    of attachedModelType,
    resourceType,
    modelId,
    isOnDisk on RKModelResource begin
select
    RKModelResource_notifyRidIndexUpdate(
        new.modelId,
        old.attachedModelType,
        old.resourceType,
        old.modelId,
        old.isOnDisk,
        new.attachedModelType,
        new.resourceType,
        new.modelId,
        new.isOnDisk
    )
from
    RKModelResource
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKMoment_ridIndexDeleteTrigger before delete on RKMoment begin
select
    RKMoment_notifyRidIndexDelete(
        old.modelId,
        old.reverseLocationDataIsValid,
        old.modelId
    )
from
    RKMoment
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKMoment_ridIndexInsertTrigger
after
insert
    on RKMoment begin
select
    RKMoment_notifyRidIndexInsert(
        new.modelId,
        new.reverseLocationDataIsValid,
        new.modelId
    )
from
    RKMoment
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKMoment_ridIndexUpdateTrigger
after
update
    of reverseLocationDataIsValid,
    modelId on RKMoment begin
select
    RKMoment_notifyRidIndexUpdate(
        new.modelId,
        old.reverseLocationDataIsValid,
        old.modelId,
        new.reverseLocationDataIsValid,
        new.modelId
    )
from
    RKMoment
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKMomentCollection_ridIndexDeleteTrigger before delete on RKMomentCollection begin
select
    RKMomentCollection_notifyRidIndexDelete(old.modelId, old.modelId)
from
    RKMomentCollection
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKMomentCollection_ridIndexInsertTrigger
after
insert
    on RKMomentCollection begin
select
    RKMomentCollection_notifyRidIndexInsert(new.modelId, new.modelId)
from
    RKMomentCollection
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKMomentCollection_ridIndexUpdateTrigger
after
update
    of modelId on RKMomentCollection begin
select
    RKMomentCollection_notifyRidIndexUpdate(new.modelId, old.modelId, new.modelId)
from
    RKMomentCollection
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKMomentYear_ridIndexDeleteTrigger before delete on RKMomentYear begin
select
    RKMomentYear_notifyRidIndexDelete(old.modelId, old.modelId)
from
    RKMomentYear
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKMomentYear_ridIndexInsertTrigger
after
insert
    on RKMomentYear begin
select
    RKMomentYear_notifyRidIndexInsert(new.modelId, new.modelId)
from
    RKMomentYear
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKMomentYear_ridIndexUpdateTrigger
after
update
    of modelId on RKMomentYear begin
select
    RKMomentYear_notifyRidIndexUpdate(new.modelId, old.modelId, new.modelId)
from
    RKMomentYear
where
    rowid = old.rowid;

end;

CREATE VIRTUAL TABLE RKPerson_dataNote_VirtualBufferReader using VirtualBufferReaderModule;

CREATE TRIGGER RKPerson_ridIndexDeleteTrigger before delete on RKPerson begin
select
    RKPerson_notifyRidIndexDelete(
        old.modelId,
        old.cloudLibraryState,
        old.isCloudQuarantined,
        old.hasBeenSynced,
        old.verifiedType,
        old.modelId,
        old.pendingMergeTargetPersonCloudIdentifier,
        old.personType,
        old.isInPersonNamingModel,
        old.isVerified
    )
from
    RKPerson
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKPerson_ridIndexInsertTrigger
after
insert
    on RKPerson begin
select
    RKPerson_notifyRidIndexInsert(
        new.modelId,
        new.cloudLibraryState,
        new.isCloudQuarantined,
        new.hasBeenSynced,
        new.verifiedType,
        new.modelId,
        new.pendingMergeTargetPersonCloudIdentifier,
        new.personType,
        new.isInPersonNamingModel,
        new.isVerified
    )
from
    RKPerson
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKPerson_ridIndexUpdateTrigger
after
update
    of cloudLibraryState,
    isCloudQuarantined,
    hasBeenSynced,
    verifiedType,
    modelId,
    pendingMergeTargetPersonCloudIdentifier,
    personType,
    isInPersonNamingModel,
    isVerified on RKPerson begin
select
    RKPerson_notifyRidIndexUpdate(
        new.modelId,
        old.cloudLibraryState,
        old.isCloudQuarantined,
        old.hasBeenSynced,
        old.verifiedType,
        old.modelId,
        old.pendingMergeTargetPersonCloudIdentifier,
        old.personType,
        old.isInPersonNamingModel,
        old.isVerified,
        new.cloudLibraryState,
        new.isCloudQuarantined,
        new.hasBeenSynced,
        new.verifiedType,
        new.modelId,
        new.pendingMergeTargetPersonCloudIdentifier,
        new.personType,
        new.isInPersonNamingModel,
        new.isVerified
    )
from
    RKPerson
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKPersonInvalidMergeCandidatePerson_ridIndexDeleteTrigger before delete on RKPersonInvalidMergeCandidatePerson begin
select
    RKPersonInvalidMergeCandidatePerson_notifyRidIndexDelete(old.modelId, old.modelId)
from
    RKPersonInvalidMergeCandidatePerson
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKPersonInvalidMergeCandidatePerson_ridIndexInsertTrigger
after
insert
    on RKPersonInvalidMergeCandidatePerson begin
select
    RKPersonInvalidMergeCandidatePerson_notifyRidIndexInsert(new.modelId, new.modelId)
from
    RKPersonInvalidMergeCandidatePerson
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKPersonInvalidMergeCandidatePerson_ridIndexUpdateTrigger
after
update
    of modelId on RKPersonInvalidMergeCandidatePerson begin
select
    RKPersonInvalidMergeCandidatePerson_notifyRidIndexUpdate(new.modelId, old.modelId, new.modelId)
from
    RKPersonInvalidMergeCandidatePerson
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKPersonMergeCandidatePerson_ridIndexDeleteTrigger before delete on RKPersonMergeCandidatePerson begin
select
    RKPersonMergeCandidatePerson_notifyRidIndexDelete(old.modelId, old.modelId)
from
    RKPersonMergeCandidatePerson
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKPersonMergeCandidatePerson_ridIndexInsertTrigger
after
insert
    on RKPersonMergeCandidatePerson begin
select
    RKPersonMergeCandidatePerson_notifyRidIndexInsert(new.modelId, new.modelId)
from
    RKPersonMergeCandidatePerson
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKPersonMergeCandidatePerson_ridIndexUpdateTrigger
after
update
    of modelId on RKPersonMergeCandidatePerson begin
select
    RKPersonMergeCandidatePerson_notifyRidIndexUpdate(new.modelId, old.modelId, new.modelId)
from
    RKPersonMergeCandidatePerson
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKPersonRejectedFace_ridIndexDeleteTrigger before delete on RKPersonRejectedFace begin
select
    RKPersonRejectedFace_notifyRidIndexDelete(old.modelId, old.modelId)
from
    RKPersonRejectedFace
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKPersonRejectedFace_ridIndexInsertTrigger
after
insert
    on RKPersonRejectedFace begin
select
    RKPersonRejectedFace_notifyRidIndexInsert(new.modelId, new.modelId)
from
    RKPersonRejectedFace
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKPersonRejectedFace_ridIndexUpdateTrigger
after
update
    of modelId on RKPersonRejectedFace begin
select
    RKPersonRejectedFace_notifyRidIndexUpdate(new.modelId, old.modelId, new.modelId)
from
    RKPersonRejectedFace
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKPersonRejectedFaceNeedingFaceCrop_ridIndexDeleteTrigger before delete on RKPersonRejectedFaceNeedingFaceCrop begin
select
    RKPersonRejectedFaceNeedingFaceCrop_notifyRidIndexDelete(
        old.personId,
        old.modelId,
        old.personId,
        old.modelId
    )
from
    RKPersonRejectedFaceNeedingFaceCrop
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKPersonRejectedFaceNeedingFaceCrop_ridIndexInsertTrigger
after
insert
    on RKPersonRejectedFaceNeedingFaceCrop begin
select
    RKPersonRejectedFaceNeedingFaceCrop_notifyRidIndexInsert(
        new.personId,
        new.modelId,
        new.personId,
        new.modelId
    )
from
    RKPersonRejectedFaceNeedingFaceCrop
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKPersonRejectedFaceNeedingFaceCrop_ridIndexUpdateTrigger
after
update
    of personId,
    modelId on RKPersonRejectedFaceNeedingFaceCrop begin
select
    RKPersonRejectedFaceNeedingFaceCrop_notifyRidIndexUpdate(
        new.personId,
        new.modelId,
        old.personId,
        old.modelId,
        new.personId,
        new.modelId
    )
from
    RKPersonRejectedFaceNeedingFaceCrop
where
    rowid = old.rowid;

end;

CREATE VIRTUAL TABLE RKPlace_RTree using rtree (
    modelId,
    minLongitude,
    maxLongitude,
    minLatitude,
    maxLatitude
)
/* RKPlace_RTree(modelId,minLongitude,maxLongitude,minLatitude,maxLatitude) */
;

CREATE TRIGGER RKPlace_ridIndexDeleteTrigger before delete on RKPlace begin
select
    RKPlace_notifyRidIndexDelete(old.modelId, old.modelId)
from
    RKPlace
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKPlace_ridIndexInsertTrigger
after
insert
    on RKPlace begin
select
    RKPlace_notifyRidIndexInsert(new.modelId, new.modelId)
from
    RKPlace
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKPlace_ridIndexUpdateTrigger
after
update
    of modelId on RKPlace begin
select
    RKPlace_notifyRidIndexUpdate(new.modelId, old.modelId, new.modelId)
from
    RKPlace
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKPlaceForVersion_ridIndexDeleteTrigger before delete on RKPlaceForVersion begin
select
    RKPlaceForVersion_notifyRidIndexDelete(old.modelId, old.modelId)
from
    RKPlaceForVersion
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKPlaceForVersion_ridIndexInsertTrigger
after
insert
    on RKPlaceForVersion begin
select
    RKPlaceForVersion_notifyRidIndexInsert(new.modelId, new.modelId)
from
    RKPlaceForVersion
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKPlaceForVersion_ridIndexUpdateTrigger
after
update
    of modelId on RKPlaceForVersion begin
select
    RKPlaceForVersion_notifyRidIndexUpdate(new.modelId, old.modelId, new.modelId)
from
    RKPlaceForVersion
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKSceneInVersion_ridIndexDeleteTrigger before delete on RKSceneInVersion begin
select
    RKSceneInVersion_notifyRidIndexDelete(old.modelId, old.versionId, old.modelId)
from
    RKSceneInVersion
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKSceneInVersion_ridIndexInsertTrigger
after
insert
    on RKSceneInVersion begin
select
    RKSceneInVersion_notifyRidIndexInsert(new.modelId, new.versionId, new.modelId)
from
    RKSceneInVersion
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKSceneInVersion_ridIndexUpdateTrigger
after
update
    of versionId,
    modelId on RKSceneInVersion begin
select
    RKSceneInVersion_notifyRidIndexUpdate(
        new.modelId,
        old.versionId,
        old.modelId,
        new.versionId,
        new.modelId
    )
from
    RKSceneInVersion
where
    rowid = old.rowid;

end;

CREATE VIRTUAL TABLE RKVersion_decimalNote_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKVersion_stringNote_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKVersion_integerNote_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKVersion_dataNote_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKVersion_stringAtomNote_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKVersion_dateNote_VirtualBufferReader using VirtualBufferReaderModule;

CREATE TRIGGER RKVersionAnalysisState_ridIndexDeleteTrigger before delete on RKVersionAnalysisState begin
select
    RKVersionAnalysisState_notifyRidIndexDelete(
        old.modelId,
        old.analysisState,
        old.workerType,
        old.modelId
    )
from
    RKVersionAnalysisState
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKVersionAnalysisState_ridIndexInsertTrigger
after
insert
    on RKVersionAnalysisState begin
select
    RKVersionAnalysisState_notifyRidIndexInsert(
        new.modelId,
        new.analysisState,
        new.workerType,
        new.modelId
    )
from
    RKVersionAnalysisState
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKVersionAnalysisState_ridIndexUpdateTrigger
after
update
    of analysisState,
    workerType,
    modelId on RKVersionAnalysisState begin
select
    RKVersionAnalysisState_notifyRidIndexUpdate(
        new.modelId,
        old.analysisState,
        old.workerType,
        old.modelId,
        new.analysisState,
        new.workerType,
        new.modelId
    )
from
    RKVersionAnalysisState
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKVolume_ridIndexDeleteTrigger before delete on RKVolume begin
select
    RKVolume_notifyRidIndexDelete(old.modelId, old.modelId)
from
    RKVolume
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKVolume_ridIndexInsertTrigger
after
insert
    on RKVolume begin
select
    RKVolume_notifyRidIndexInsert(new.modelId, new.modelId)
from
    RKVolume
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKVolume_ridIndexUpdateTrigger
after
update
    of modelId on RKVolume begin
select
    RKVolume_notifyRidIndexUpdate(new.modelId, old.modelId, new.modelId)
from
    RKVolume
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKVersion_ridIndexDeleteTrigger before delete on RKVersion begin
select
    RKVersion_notifyRidIndexDelete(
        old.modelId,
        old.isCloudQuarantined,
        old.videoCpVisibilityState,
        old.colorSpaceValidationState,
        old.supportedStatus,
        old.isFavorite,
        old.fileIsReference,
        old.isInTrash,
        old.isHidden,
        old.showInLibrary,
        old.faceDetectionIsFromPreview,
        old.graphProcessingState,
        old.hasKeywords,
        old.subType,
        old.specialType,
        old.momentUuid,
        old.burstPickType,
        old.type,
        old.mediaAnalysisProcessingState,
        old.playbackStyle,
        old.playbackVariation,
        old.renderEffect,
        old.groupingState,
        old.selfPortrait,
        old.syncFailureHidden,
        old.modelId,
        old.outputUpToDate,
        old.searchIndexInvalid,
        old.cloudLibraryState,
        old.hasBeenSynced
    )
from
    RKVersion
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKVersion_ridIndexInsertTrigger
after
insert
    on RKVersion begin
select
    RKVersion_notifyRidIndexInsert(
        new.modelId,
        new.isCloudQuarantined,
        new.videoCpVisibilityState,
        new.colorSpaceValidationState,
        new.supportedStatus,
        new.isFavorite,
        new.fileIsReference,
        new.isInTrash,
        new.isHidden,
        new.showInLibrary,
        new.faceDetectionIsFromPreview,
        new.graphProcessingState,
        new.hasKeywords,
        new.subType,
        new.specialType,
        new.momentUuid,
        new.burstPickType,
        new.type,
        new.mediaAnalysisProcessingState,
        new.playbackStyle,
        new.playbackVariation,
        new.renderEffect,
        new.groupingState,
        new.selfPortrait,
        new.syncFailureHidden,
        new.modelId,
        new.outputUpToDate,
        new.searchIndexInvalid,
        new.cloudLibraryState,
        new.hasBeenSynced
    )
from
    RKVersion
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKVersion_ridIndexUpdateTrigger
after
update
    of isCloudQuarantined,
    videoCpVisibilityState,
    colorSpaceValidationState,
    supportedStatus,
    isFavorite,
    fileIsReference,
    isInTrash,
    isHidden,
    showInLibrary,
    faceDetectionIsFromPreview,
    graphProcessingState,
    hasKeywords,
    subType,
    specialType,
    momentUuid,
    burstPickType,
    type,
    mediaAnalysisProcessingState,
    playbackStyle,
    playbackVariation,
    renderEffect,
    groupingState,
    selfPortrait,
    syncFailureHidden,
    modelId,
    outputUpToDate,
    searchIndexInvalid,
    cloudLibraryState,
    hasBeenSynced on RKVersion begin
select
    RKVersion_notifyRidIndexUpdate(
        new.modelId,
        old.isCloudQuarantined,
        old.videoCpVisibilityState,
        old.colorSpaceValidationState,
        old.supportedStatus,
        old.isFavorite,
        old.fileIsReference,
        old.isInTrash,
        old.isHidden,
        old.showInLibrary,
        old.faceDetectionIsFromPreview,
        old.graphProcessingState,
        old.hasKeywords,
        old.subType,
        old.specialType,
        old.momentUuid,
        old.burstPickType,
        old.type,
        old.mediaAnalysisProcessingState,
        old.playbackStyle,
        old.playbackVariation,
        old.renderEffect,
        old.groupingState,
        old.selfPortrait,
        old.syncFailureHidden,
        old.modelId,
        old.outputUpToDate,
        old.searchIndexInvalid,
        old.cloudLibraryState,
        old.hasBeenSynced,
        new.isCloudQuarantined,
        new.videoCpVisibilityState,
        new.colorSpaceValidationState,
        new.supportedStatus,
        new.isFavorite,
        new.fileIsReference,
        new.isInTrash,
        new.isHidden,
        new.showInLibrary,
        new.faceDetectionIsFromPreview,
        new.graphProcessingState,
        new.hasKeywords,
        new.subType,
        new.specialType,
        new.momentUuid,
        new.burstPickType,
        new.type,
        new.mediaAnalysisProcessingState,
        new.playbackStyle,
        new.playbackVariation,
        new.renderEffect,
        new.groupingState,
        new.selfPortrait,
        new.syncFailureHidden,
        new.modelId,
        new.outputUpToDate,
        new.searchIndexInvalid,
        new.cloudLibraryState,
        new.hasBeenSynced
    )
from
    RKVersion
where
    rowid = old.rowid;

end;

CREATE VIRTUAL TABLE RKMemoryMovieVersion_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKModelResource_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKAlbum_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKImageProxyState_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKMemoryExtendedCuratedVersion_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKKeywordForVersion_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKKeyword_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKVersion_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKMoment_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKImportGroup_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKPersonMergeCandidatePerson_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKImportMoment_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKMaster_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKMemory_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKFaceGroup_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKFacePrint_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKPersonInvalidMergeCandidatePerson_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKPersonRejectedFaceNeedingFaceCrop_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKAlbumVersion_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKPersonRejectedFace_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKBookmark_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKMomentCollection_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKVersionAnalysisState_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKPerson_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKFaceCrop_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKMemoryRepresentativeVersion_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKAttachment_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKImageMask_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKSceneInVersion_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKMemoryCuratedVersion_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKFace_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKCloudResource_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKVolume_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKPlaceForVersion_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKPlace_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKAdjustmentData_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKAdminData_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKCustomSortOrder_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKMomentYear_VirtualBufferReader using VirtualBufferReaderModule;

CREATE VIRTUAL TABLE RKFolder_VirtualBufferReader using VirtualBufferReaderModule;

CREATE TRIGGER RKAlbum_skIndexDeleteTrigger before delete on RKAlbum begin
select
    RKAlbum_notifySKIndexDelete(modelId)
from
    RKAlbum
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKAlbum_skIndexInsertTrigger
after
insert
    on RKAlbum begin
select
    RKAlbum_notifySKIndexInsert(modelId, name)
from
    RKAlbum
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKAlbum_skIndexUpdateTrigger
after
update
    of name on RKAlbum begin
select
    RKAlbum_notifySKIndexUpdate(modelId, old.name, new.name)
from
    RKAlbum
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKMemory_skIndexDeleteTrigger before delete on RKMemory begin
select
    RKMemory_notifySKIndexDelete(modelId)
from
    RKMemory
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKMemory_skIndexInsertTrigger
after
insert
    on RKMemory begin
select
    RKMemory_notifySKIndexInsert(modelId, title)
from
    RKMemory
where
    rowid = new.rowid;

end;

CREATE TRIGGER RKMemory_skIndexUpdateTrigger
after
update
    of title on RKMemory begin
select
    RKMemory_notifySKIndexUpdate(modelId, old.title, new.title)
from
    RKMemory
where
    rowid = old.rowid;

end;

CREATE TRIGGER RKPlace_RTree_update_trigger
after
update
    of minLongitude,
    maxLongitude,
    minLatitude,
    maxLatitude on RKPlace begin
update
    RKPlace_RTree
set
    minLongitude = NEW.minLongitude,
    maxLongitude = NEW.maxLongitude,
    minLatitude = NEW.minLatitude,
    maxLatitude = NEW.maxLatitude
where
    modelId = NEW.modelId;

end;

CREATE TRIGGER RKPlace_RTree_delete_trigger
after
    delete on RKPlace begin
delete from
    RKPlace_RTree
where
    modelId = OLD.modelId;

end;

CREATE TRIGGER RKPlace_RTree_insert_trigger
after
insert
    on RKPlace begin
insert
    or replace into RKPlace_RTree (
        modelId,
        minLongitude,
        maxLongitude,
        minLatitude,
        maxLatitude
    )
values
(
        NEW.modelId,
        NEW.minLongitude,
        NEW.maxLongitude,
        NEW.minLatitude,
        NEW.maxLatitude
    );

end;

CREATE TRIGGER RKVersion_stringNote_skIndexDeleteTrigger before delete on RKVersion_stringNote begin
select
    RKVersion_stringNote_notifySKIndexDelete(attachedToId, keyPath)
from
    RKVersion_stringNote
where
    rowid = old.rowid
    and keyPath in (763);

end;

CREATE TRIGGER RKVersion_stringNote_skIndexInsertTrigger
after
insert
    on RKVersion_stringNote begin
select
    RKVersion_stringNote_notifySKIndexInsert(attachedToId, value, keyPath)
from
    RKVersion_stringNote
where
    rowid = new.rowid
    and keyPath in (763);

end;

CREATE TRIGGER RKVersion_stringNote_skIndexUpdateTrigger
after
update
    of value on RKVersion_stringNote begin
select
    RKVersion_stringNote_notifySKIndexUpdate(attachedToId, keyPath, old.value, new.value)
from
    RKVersion_stringNote
where
    rowid = new.rowid
    and keyPath in (763);

end;
Clone this wiki locally