Skip to content

Commit cb0f0d9

Browse files
committed
add comments explaining the document_type column
1 parent 6004cdf commit cb0f0d9

File tree

1 file changed

+6
-0
lines changed
  • firebase-firestore/src/main/java/com/google/firebase/firestore/local

1 file changed

+6
-0
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/local/SQLiteSchema.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,12 @@ private void addPathLength() {
453453
}
454454

455455
private void addDocumentType() {
456+
// The new "document_type" column is a copy of the document type encoded in the "contents" blob.
457+
// Its range of values are defined in the `SQLiteRemoteDocumentCache.DocumentType` enum.
458+
// The "document_type" value for a given row must be equal to the document type encoded in the
459+
// "contents" column for that row. The purpose of the "document_type" column is to enable
460+
// efficient filtering on document type. But when using it as a filter, a null value must also
461+
// be considered as their document type must be determined by parsing the the "contents" column.
456462
if (!tableContainsColumn("remote_documents", "document_type")) {
457463
db.execSQL("ALTER TABLE remote_documents ADD COLUMN document_type INTEGER");
458464
}

0 commit comments

Comments
 (0)