         "server_modified AS local_modified, " +
         "guid, type, bmkUri, title, parentid, parentName, " +
         "feedUri, siteUri, pos, description, tags, keyword, folderName, queryId, faviconID " +
-        "FROM \(TableBookmarksMirror)"
+        "FROM \(TableBookmarksMirror) WHERE is_overridden IS 0"
+
+        // 5.(pre) I have a database right in front of me that violates an assumption: a full
+        // bookmarksMirrorStructure and an empty bookmarksMirror. Clean up, just in case.
+        let removeOverriddenStructure =
+        "DELETE FROM \(TableBookmarksMirrorStructure) WHERE parent IN (SELECT guid FROM \(TableBookmarksMirror) WHERE is_overridden IS 1)"
 
         // 5. Insert into localStructure anything left in mirrorStructure.
         //    This won't copy the structure of any folders that were already overridden --

    }

    public func wipeBookmarks() -> Success {
        return self.db.run("DELETE FROM \(TableBookmarksBuffer)")
         >>> { self.db.run("DELETE FROM \(TableBookmarksBufferStructure)") }
    }
}


        // As implemented, this won't work correctly without ON DELETE CASCADE.
        assert(SwiftData.EnableForeignKeys)

        // 1. Wait until we commit to complain about constraint violations.
        let deferForeignKeys =
        "PRAGMA defer_foreign_keys = ON"

        // 2. Drop anything from local that's deleted. We don't need to track the
        //    deletion now. Optional: keep them around if they're non-uploaded changes.
