Skip to content

Commit 0b13b10

Browse files
Revert 6135c4a (#674)
1 parent 1a9ca97 commit 0b13b10

File tree

2 files changed

+2
-30
lines changed

2 files changed

+2
-30
lines changed

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import static com.google.firebase.firestore.util.Assert.hardAssert;
1919

2020
import androidx.annotation.Nullable;
21-
import com.google.firebase.Timestamp;
2221
import com.google.firebase.database.collection.ImmutableSortedMap;
2322
import com.google.firebase.firestore.core.Query;
2423
import com.google.firebase.firestore.model.Document;
@@ -52,18 +51,13 @@ final class SQLiteRemoteDocumentCache implements RemoteDocumentCache {
5251
@Override
5352
public void add(MaybeDocument maybeDocument) {
5453
String path = pathForKey(maybeDocument.getKey());
55-
Timestamp timestamp = maybeDocument.getVersion().getTimestamp();
5654
MessageLite message = serializer.encodeMaybeDocument(maybeDocument);
5755

5856
statsCollector.recordRowsWritten(STATS_TAG, 1);
5957

6058
db.execute(
61-
"INSERT OR REPLACE INTO remote_documents "
62-
+ "(path, update_time_seconds, update_time_nanos, contents) "
63-
+ "VALUES (?, ?, ?, ?)",
59+
"INSERT OR REPLACE INTO remote_documents (path, contents) VALUES (?, ?)",
6460
path,
65-
timestamp.getSeconds(),
66-
timestamp.getNanoseconds(),
6761
message.toByteArray());
6862

6963
db.getIndexManager().addToCollectionParentIndex(maybeDocument.getKey().getPath().popLast());

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

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,8 @@ class SQLiteSchema {
4545
/**
4646
* The version of the schema. Increase this by one for each migration added to runMigrations
4747
* below.
48-
*
49-
* <p>TODO(index-free): The migration to schema version 9 doesn't backfill `update_time` as this
50-
* requires rewriting the RemoteDocumentCache. For index-free queries to efficiently handle
51-
* existing documents, we still need to populate update_time for all existing entries, drop the
52-
* RemoteDocumentCache or ask users to invoke `clearPersistence()` manually. If we decide to
53-
* backfill or drop the contents of the RemoteDocumentCache, we need to perform an additional
54-
* schema migration.
5548
*/
56-
static final int VERSION = 9;
57-
49+
static final int VERSION = 8;
5850
// Remove this constant and increment VERSION to enable indexing support
5951
static final int INDEXING_SUPPORT_VERSION = VERSION + 1;
6052

@@ -135,10 +127,6 @@ void runMigrations(int fromVersion, int toVersion) {
135127
createV8CollectionParentsIndex();
136128
}
137129

138-
if (fromVersion < 9 && toVersion >= 9) {
139-
addUpdateTime();
140-
}
141-
142130
/*
143131
* Adding a new migration? READ THIS FIRST!
144132
*
@@ -363,16 +351,6 @@ private void addSequenceNumber() {
363351
}
364352
}
365353

366-
private void addUpdateTime() {
367-
if (!tableContainsColumn("remote_documents", "update_time_seconds")) {
368-
hardAssert(
369-
!tableContainsColumn("remote_documents", "update_time_nanos"),
370-
"Table contained update_time_seconds, but is missing update_time_nanos");
371-
db.execSQL("ALTER TABLE remote_documents ADD COLUMN update_time_seconds INTEGER");
372-
db.execSQL("ALTER TABLE remote_documents ADD COLUMN update_time_nanos INTEGER");
373-
}
374-
}
375-
376354
/**
377355
* Ensures that each entry in the remote document cache has a corresponding sentinel row. Any
378356
* entries that lack a sentinel row are given one with the sequence number set to the highest

0 commit comments

Comments
 (0)