From ed3b793108282cd3d9ea06137a8b77a00c448271 Mon Sep 17 00:00:00 2001 From: rstanciu Date: Thu, 27 Jul 2023 12:21:56 -0700 Subject: [PATCH] Create primary keys on metadata and tiles tables when copying with force-simple --- martin-mbtiles/src/tile_copier.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/martin-mbtiles/src/tile_copier.rs b/martin-mbtiles/src/tile_copier.rs index 338ea44b3..8fcf6e986 100644 --- a/martin-mbtiles/src/tile_copier.rs +++ b/martin-mbtiles/src/tile_copier.rs @@ -171,10 +171,9 @@ impl TileCopier { query!("VACUUM").execute(&mut conn).await?; if force_simple { - for statement in &["CREATE TABLE metadata (name text, value text);", - "CREATE TABLE tiles (zoom_level integer, tile_column integer, tile_row integer, tile_data blob);", - "CREATE UNIQUE INDEX name on metadata (name);", - "CREATE UNIQUE INDEX tile_index on tiles (zoom_level, tile_column, tile_row);"] { + for statement in &["CREATE TABLE metadata (name text NOT NULL PRIMARY KEY, value text);", + "CREATE TABLE tiles (zoom_level integer NOT NULL, tile_column integer NOT NULL, tile_row integer NOT NULL, tile_data blob, + PRIMARY KEY(zoom_level, tile_column, tile_row));"] { query(statement).execute(&mut conn).await?; } } else {