ALTER TABLE maps ADD pattern VARCHAR(200) NOT NULL AFTER geo_name;
UPDATE maps SET pattern = CONCAT('http://localhost/geo/?a=tile&id=', geo_name, '&z={z}&x={x}&y={y}') WHERE geo_name <> '';

ALTER TABLE maps ADD token VARCHAR(4096) AFTER pattern;
UPDATE maps SET token = '';

ALTER TABLE maps DROP geo_name;

INSERT INTO maps (codename, pattern, token, tile_size, min_zoom, max_zoom, attribution) 
VALUES ('static', 'http://localhost/geo/?a=tile&id=static&z=13&x={x}&y={y}', '', 400, 13, 13, '');

INSERT INTO maps (codename, pattern, token, tile_size, min_zoom, max_zoom, attribution) 
VALUES ('static_marker', 'http://localhost/geo/?a=tile&id=static.marker&z=13&x={x}&y={y}&marker=http://localhost/spot/images/footprint_mapbox.png', '', 400, 13, 13, '');

UPDATE maps SET max_zoom = 17 WHERE codename = 'otm';