code: func (t *PlatformsTable) remove(c context.Context) error {
  	// Avoid using the database connection to prepare unnecessary statements.
  	if len(t.removals) == 0 {
  		return nil
  	}
  
  	db := database.Get(c)
  	stmt, err := db.PrepareContext(c, `
  		DELETE FROM platforms
  		WHERE id = ?
  	`)
  	if err != nil {
  		return errors.Annotate(err, "failed to prepare statement").Err()
  	}
  	defer stmt.Close()
  
  	// Remove each platform from the table. It's more efficient to update the slice of
  	// platforms once at the end rather than for each removal, so use a defer.
  	removed := make(map[int64]struct{}, len(t.removals))
  	defer func() {
  		var platforms []*Platform
  		for _, p := range t.current {
  			if _, ok := removed[p.Id]; !ok {
  				platforms = append(platforms, p)
  			}
  		}
  		t.current = platforms
  	}()
  	for len(t.removals) > 0 {
  		p := t.removals[0]
  		if _, err := stmt.ExecContext(c, p.Id); err != nil {
  			// Defer ensures the slice of platforms is updated even if we exit early.
  			return errors.Annotate(err, "failed to remove platform %q", p.Name).Err()
  		}
  		removed[p.Id] = struct{}{}
  		t.removals = t.removals[1:]
  		logging.Infof(c, "Removed platform %q", p.Name)
  	}
  	return nil
  }
docs: // remove removes all platforms pending removal from the database, clearing pending removals.
  // No-op unless computeChanges was called first. Idempotent until computeChanges is called again.