ALTER TABLE tiles ADD COLUMN version INT NOT NULL DEFAULT 2025;

DELETE FROM tiles a
USING tiles b
WHERE a.id > b.id
  AND a.latitude = b.latitude
  AND a.longitude = b.longitude
  AND a.zoom_level = b.zoom_level
  AND a.tile_size_meters = b.tile_size_meters
  AND a.version = b.version;

CREATE UNIQUE INDEX idx_tiles_unique_location ON tiles(latitude, longitude, zoom_level, tile_size_meters, version);

