@Test public void addsSentinelRows() { schema.runMigrations(0, 6); long oldSequenceNumber = 1; long newSequenceNumber = 2; db.execSQL( "UPDATE target_globals SET highest_listen_sequence_number = ?", new Object[] {newSequenceNumber}); for (int i = 0; i < 10; i++) { String encodedPath = encode(path("docs/doc_" + i)); db.execSQL("INSERT INTO remote_documents (path) VALUES (?)", new String[] {encodedPath}); if (i % 2 == 1) { db.execSQL( "INSERT INTO target_documents (target_id, path, sequence_number) VALUES (0, ?, ?)", new Object[] {encodedPath, oldSequenceNumber}); } } schema.runMigrations(6, 7); new SQLitePersistence.Query( db, "SELECT path, sequence_number FROM target_documents WHERE target_id = 0") .forEach( row -> { String path = decodeResourcePath(row.getString(0)).getLastSegment(); long sequenceNumber = row.getLong(1); int docNum = Integer.parseInt(path.split("_", -1)[1]); long expected = docNum % 2 == 1 ? oldSequenceNumber : newSequenceNumber; assertEquals(expected, sequenceNumber); }); }
void runMigrations() { runMigrations(0, VERSION); }
SQLiteSchema { void runMigrations() { runMigrations(0, VERSION); } }
SQLiteSchema { void runMigrations() { runMigrations(0, VERSION); } SQLiteSchema(SQLiteDatabase db, LocalSerializer serializer); }
SQLiteSchema { void runMigrations() { runMigrations(0, VERSION); } SQLiteSchema(SQLiteDatabase db, LocalSerializer serializer);  }
SQLiteSchema { void runMigrations() { runMigrations(0, VERSION); } SQLiteSchema(SQLiteDatabase db, LocalSerializer serializer);   }