mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 19:40:34 +00:00
feat(ferratas): keep loaded via ferratas in a tile cache on server and device, group segments, own look and count badge
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
import { Migration } from '@mikro-orm/migrations';
|
||||
|
||||
/**
|
||||
* `ferrata_tiles` keeps what Overpass answered for one cell of the via
|
||||
* ferrata grid (0.05 degrees a side), so a restart does not send every map
|
||||
* pan back to the public mirrors.
|
||||
*
|
||||
* `tile_key` names the cell by its grid indices (`"<lat index>,<lng index>"`),
|
||||
* `payload` is the JSON of the cell's ferratas and whether the answer was cut,
|
||||
* and `fetched_at` is the epoch of that answer in seconds (not ms, so it fits
|
||||
* the 32-bit integer this column is on Postgres). Nothing references the
|
||||
* table and nothing deletes from it: an old cell is served and refreshed, not
|
||||
* dropped.
|
||||
*/
|
||||
export class Migration20200101043200_via_ferrata_tiles_outlive_a_restart extends Migration {
|
||||
override name = 'Migration20200101043200_via_ferrata_tiles_outlive_a_restart';
|
||||
|
||||
override up(): void {
|
||||
this.addSql(`
|
||||
CREATE TABLE IF NOT EXISTS ferrata_tiles (
|
||||
tile_key TEXT PRIMARY KEY NOT NULL,
|
||||
payload TEXT NOT NULL,
|
||||
fetched_at INTEGER NOT NULL
|
||||
)
|
||||
`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user