Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create primary keys on metadata and tiles tables when copying with force-simple #786

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions martin-mbtiles/src/tile_copier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading