mirror of
https://github.com/maplibre/martin.git
synced 2024-12-19 21:01:45 +03:00
8b34cd374c
* Fix metadata copying * Introduce a new metadata field `agg_tiles_hash_after_apply` for diff files * Added a lot of new info and debug logging * Simplified Copying interface - not much value in having all the complex builder pattern here it seems, might as well use a simple object. ## Testing * Generate SQLite DBs in memory on the fly to validate just what we need * Use `insta` for validating DB content There is now a function `dump(connection) -> Vec<Entry>` to dump the content of the entire SQLite DB into text with `serde`. At many steps through the testing, the DB content is validated with the corresponding .snap file with `insta` crate (which makes this process mega-simple, including a simple way to "bless" (update) any changes). ## Discovered bugs * Seems like normalized files do not get copied properly - they contain extras that should be removed.
86 lines
2.1 KiB
Plaintext
86 lines
2.1 KiB
Plaintext
---
|
|
source: martin-mbtiles/tests/mbtiles.rs
|
|
expression: actual_value
|
|
---
|
|
[[]]
|
|
type = 'table'
|
|
tbl_name = 'images'
|
|
sql = '''
|
|
CREATE TABLE images (
|
|
tile_id text NOT NULL PRIMARY KEY,
|
|
tile_data blob)'''
|
|
values = [
|
|
'( "51037A4A37730F52C8732586D3AAA316", blob(same) )',
|
|
'( "535A5575B48444EDEB926815AB26EC9B", blob(1-keep-1-rm) )',
|
|
'( "EFE0AE5FD114DE99855BC2838BE97E1D", blob(edit-v1) )',
|
|
]
|
|
|
|
[[]]
|
|
type = 'table'
|
|
tbl_name = 'map'
|
|
sql = '''
|
|
CREATE TABLE map (
|
|
zoom_level integer NOT NULL,
|
|
tile_column integer NOT NULL,
|
|
tile_row integer NOT NULL,
|
|
tile_id text,
|
|
PRIMARY KEY(zoom_level, tile_column, tile_row))'''
|
|
values = [
|
|
'( 6, 0, 3, "51037A4A37730F52C8732586D3AAA316" )',
|
|
'( 6, 0, 5, "535A5575B48444EDEB926815AB26EC9B" )',
|
|
'( 6, 1, 4, "EFE0AE5FD114DE99855BC2838BE97E1D" )',
|
|
'( 6, 2, 6, "535A5575B48444EDEB926815AB26EC9B" )',
|
|
]
|
|
|
|
[[]]
|
|
type = 'table'
|
|
tbl_name = 'metadata'
|
|
sql = '''
|
|
CREATE TABLE metadata (
|
|
name text NOT NULL PRIMARY KEY,
|
|
value text)'''
|
|
values = [
|
|
'( "agg_tiles_hash", "675349A4153AEC0679BE9C0637AEEBCC" )',
|
|
'( "md-edit", "value - v1" )',
|
|
'( "md-remove", "value - remove" )',
|
|
'( "md-same", "value - same" )',
|
|
]
|
|
|
|
[[]]
|
|
type = 'index'
|
|
tbl_name = 'images'
|
|
|
|
[[]]
|
|
type = 'index'
|
|
tbl_name = 'map'
|
|
|
|
[[]]
|
|
type = 'index'
|
|
tbl_name = 'metadata'
|
|
|
|
[[]]
|
|
type = 'view'
|
|
tbl_name = 'tiles'
|
|
sql = '''
|
|
CREATE VIEW tiles AS
|
|
SELECT map.zoom_level AS zoom_level,
|
|
map.tile_column AS tile_column,
|
|
map.tile_row AS tile_row,
|
|
images.tile_data AS tile_data
|
|
FROM map
|
|
JOIN images ON images.tile_id = map.tile_id'''
|
|
|
|
[[]]
|
|
type = 'view'
|
|
tbl_name = 'tiles_with_hash'
|
|
sql = '''
|
|
CREATE VIEW tiles_with_hash AS
|
|
SELECT
|
|
map.zoom_level AS zoom_level,
|
|
map.tile_column AS tile_column,
|
|
map.tile_row AS tile_row,
|
|
images.tile_data AS tile_data,
|
|
images.tile_id AS tile_hash
|
|
FROM map
|
|
JOIN images ON images.tile_id = map.tile_id'''
|